From 3cc59597c5af574ed7d39f6408b774857b7ec4dc Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 21 Oct 2020 12:29:02 -0700 Subject: [PATCH] Add tests where resolutions are reused which is much more common scenario --- .../unittests/tsbuild/persistResolutions.ts | 39 +- src/testRunner/unittests/tsbuild/watchMode.ts | 218 +++-------- .../unittests/tsc/persistResolutions.ts | 39 +- .../unittests/tscWatch/persistResolutions.ts | 216 +++-------- ...nd-uses-it-for-new-program-with-outFile.js | 295 ++++++++++---- ...-resolution-and-uses-it-for-new-program.js | 282 +++++++++++--- ...er-resolutions-are-cleaned-with-outFile.js | 193 ++++++--- ...can-build-after-resolutions-are-cleaned.js | 246 ++++++++++-- ...-saved-in-tsbuildinfo-file-with-outFile.js | 193 ++++++--- ...ons-have-been-saved-in-tsbuildinfo-file.js | 246 ++++++++++-- ...nd-uses-it-for-new-program-with-outFile.js | 193 ++++++--- ...-resolution-and-uses-it-for-new-program.js | 247 ++++++++++-- ...nd-uses-it-for-new-program-with-outFile.js | 367 +++++++++++++----- ...-resolution-and-uses-it-for-new-program.js | 291 +++++++++++--- ...er-resolutions-are-cleaned-with-outFile.js | 231 ++++++++--- ...can-build-after-resolutions-are-cleaned.js | 233 +++++++++-- ...-saved-in-tsbuildinfo-file-with-outFile.js | 231 ++++++++--- ...ons-have-been-saved-in-tsbuildinfo-file.js | 233 +++++++++-- ...nd-uses-it-for-new-program-with-outFile.js | 217 ++++++++--- ...-resolution-and-uses-it-for-new-program.js | 234 +++++++++-- 20 files changed, 3199 insertions(+), 1245 deletions(-) diff --git a/src/testRunner/unittests/tsbuild/persistResolutions.ts b/src/testRunner/unittests/tsbuild/persistResolutions.ts index db6dc4fbffcd0..7b609f8065d74 100644 --- a/src/testRunner/unittests/tsbuild/persistResolutions.ts +++ b/src/testRunner/unittests/tsbuild/persistResolutions.ts @@ -1,12 +1,14 @@ namespace ts { describe("unittests:: tsbuild:: persistResolutions::", () => { - verifyTscSerializedIncrementalEdits({ - scenario: "persistResolutions", - subScenario: `saves resolution and uses it for new program`, - fs: () => loadProjectFromFiles({ + function getFs(outFile?: string) { + return loadProjectFromFiles({ "/src/project/src/main.ts": Utils.dedent` - import { something } from "./filePresent"; - import { something2 } from "./fileNotFound";`, + import { something } from "./filePresent"; + import { something as something1 } from "./filePresent"; + import { something2 } from "./fileNotFound";`, + "/src/project/src/anotherFileReusingResolution.ts": Utils.dedent` + import { something } from "./filePresent"; + import { something2 } from "./fileNotFound";`, "/src/project/src/filePresent.ts": `export function something() { return 10; }`, "/src/project/tsconfig.json": JSON.stringify({ compilerOptions: { @@ -14,10 +16,16 @@ namespace ts { composite: true, persistResolutions: true, traceResolution: true, + outFile }, include: ["src/**/*.ts"] }), - }), + }); + } + verifyTscSerializedIncrementalEdits({ + scenario: "persistResolutions", + subScenario: `saves resolution and uses it for new program`, + fs: getFs, commandLineArgs: ["--b", "src/project"], incrementalScenarios: [ noChangeRun, @@ -58,22 +66,7 @@ namespace ts { verifyTscSerializedIncrementalEdits({ scenario: "persistResolutions", subScenario: `saves resolution and uses it for new program with outFile`, - fs: () => loadProjectFromFiles({ - "/src/project/src/main.ts": Utils.dedent` - import { something } from "./filePresent"; - import { something2 } from "./fileNotFound";`, - "/src/project/src/filePresent.ts": `export function something() { return 10; }`, - "/src/project/tsconfig.json": JSON.stringify({ - compilerOptions: { - module: "amd", - composite: true, - persistResolutions: true, - traceResolution: true, - outFile: "outFile.js" - }, - include: ["src/**/*.ts"] - }), - }), + fs: () => getFs("outFile.js"), commandLineArgs: ["--b", "src/project"], incrementalScenarios: [ noChangeRun, diff --git a/src/testRunner/unittests/tsbuild/watchMode.ts b/src/testRunner/unittests/tsbuild/watchMode.ts index 9c66e40ff56ba..f078e0d01c80d 100644 --- a/src/testRunner/unittests/tsbuild/watchMode.ts +++ b/src/testRunner/unittests/tsbuild/watchMode.ts @@ -1021,13 +1021,18 @@ const a: string = "hello";`), }); }); - describe("unittests:: tsbuild:: watchMode:: persistentResolutions", () => { - verifyTscWatch({ - scenario: "persistResolutions", - subScenario: "saves resolution and uses it for new program", - sys: () => createWatchedSystem([ + describe("unittests:: tsbuild:: watchMode:: persistResolutions", () => { + function getSys(outFile?: string) { + return createWatchedSystem([ { path: `${projectRoot}/src/main.ts`, + content: Utils.dedent` + import { something } from "./filePresent"; + import { something as something1 } from "./filePresent"; + import { something2 } from "./fileNotFound";`, + }, + { + path: `${projectRoot}/src/anotherFileReusingResolution.ts`, content: Utils.dedent` import { something } from "./filePresent"; import { something2 } from "./fileNotFound";`, @@ -1044,12 +1049,42 @@ const a: string = "hello";`), composite: true, persistResolutions: true, traceResolution: true, + outFile }, include: ["src/**/*.ts"] }), }, libFile - ], { currentDirectory: projectRoot }), + ], { currentDirectory: projectRoot }); + } + + function getSysWithSavedResolutions(outFile?: string) { + const sys = getSys(outFile); + const exit = sys.exit; + sys.exit = noop; + fakes.withTemporaryPatchingForBuildinfoReadWrite(sys, sys => executeCommandLine(sys, noop, ["--b", "."])); + sys.exit = exit; + sys.clearOutput(); + return sys; + } + + function getSysWithClearedResolutions(outFile?: string) { + const sys = getSys(outFile); + const exit = sys.exit; + sys.exit = noop; + fakes.withTemporaryPatchingForBuildinfoReadWrite(sys, sys => { + executeCommandLine(sys, noop, ["--b", "."]); + executeCommandLine(sys, noop, ["--b", ".", "--cleanPersistedProgram"]); + }); + sys.exit = exit; + sys.clearOutput(); + return sys; + } + + verifyTscWatch({ + scenario: "persistResolutions", + subScenario: "saves resolution and uses it for new program", + sys: getSys, commandLineArgs: ["--b", ".", "-w", "--extendedDiagnostics"], changes: [ { @@ -1078,39 +1113,7 @@ const a: string = "hello";`), verifyTscWatch({ scenario: "persistResolutions", subScenario: "can build after resolutions have been saved in tsbuildinfo file", - sys: () => { - const sys = createWatchedSystem([ - { - path: `${projectRoot}/src/main.ts`, - content: Utils.dedent` - import { something } from "./filePresent"; - import { something2 } from "./fileNotFound";`, - }, - { - path: `${projectRoot}/src/filePresent.ts`, - content: `export function something() { return 10; }`, - }, - { - path: `${projectRoot}/tsconfig.json`, - content: JSON.stringify({ - compilerOptions: { - module: "amd", - composite: true, - persistResolutions: true, - traceResolution: true, - }, - include: ["src/**/*.ts"] - }), - }, - libFile - ], { currentDirectory: projectRoot }); - const exit = sys.exit; - sys.exit = noop; - fakes.withTemporaryPatchingForBuildinfoReadWrite(sys, sys => executeCommandLine(sys, noop, ["--b", "."])); - sys.exit = exit; - sys.clearOutput(); - return sys; - }, + sys: getSysWithSavedResolutions, commandLineArgs: ["--b", ".", "-w", "--extendedDiagnostics"], changes: [ { @@ -1139,42 +1142,7 @@ const a: string = "hello";`), verifyTscWatch({ scenario: "persistResolutions", subScenario: "can build after resolutions are cleaned", - sys: () => { - const sys = createWatchedSystem([ - { - path: `${projectRoot}/src/main.ts`, - content: Utils.dedent` - import { something } from "./filePresent"; - import { something2 } from "./fileNotFound";`, - }, - { - path: `${projectRoot}/src/filePresent.ts`, - content: `export function something() { return 10; }`, - }, - { - path: `${projectRoot}/tsconfig.json`, - content: JSON.stringify({ - compilerOptions: { - module: "amd", - composite: true, - persistResolutions: true, - traceResolution: true, - }, - include: ["src/**/*.ts"] - }), - }, - libFile - ], { currentDirectory: projectRoot }); - const exit = sys.exit; - sys.exit = noop; - fakes.withTemporaryPatchingForBuildinfoReadWrite(sys, sys => { - executeCommandLine(sys, noop, ["--b", "."]); - executeCommandLine(sys, noop, ["--b", ".", "--cleanPersistedProgram"]); - }); - sys.exit = exit; - sys.clearOutput(); - return sys; - }, + sys: getSysWithClearedResolutions, commandLineArgs: ["--b", ".", "-w", "--extendedDiagnostics"], changes: [ { @@ -1204,32 +1172,7 @@ const a: string = "hello";`), verifyTscWatch({ scenario: "persistResolutions", subScenario: "saves resolution and uses it for new program with outFile", - sys: () => createWatchedSystem([ - { - path: `${projectRoot}/src/main.ts`, - content: Utils.dedent` - import { something } from "./filePresent"; - import { something2 } from "./fileNotFound";`, - }, - { - path: `${projectRoot}/src/filePresent.ts`, - content: `export function something() { return 10; }`, - }, - { - path: `${projectRoot}/tsconfig.json`, - content: JSON.stringify({ - compilerOptions: { - module: "amd", - composite: true, - persistResolutions: true, - traceResolution: true, - outFile: "outFile.js" - }, - include: ["src/**/*.ts"] - }), - }, - libFile - ], { currentDirectory: projectRoot }), + sys: () => getSys("outFile.js"), commandLineArgs: ["--b", ".", "-w", "--extendedDiagnostics"], changes: [ { @@ -1258,40 +1201,7 @@ const a: string = "hello";`), verifyTscWatch({ scenario: "persistResolutions", subScenario: "can build after resolutions have been saved in tsbuildinfo file with outFile", - sys: () => { - const sys = createWatchedSystem([ - { - path: `${projectRoot}/src/main.ts`, - content: Utils.dedent` - import { something } from "./filePresent"; - import { something2 } from "./fileNotFound";`, - }, - { - path: `${projectRoot}/src/filePresent.ts`, - content: `export function something() { return 10; }`, - }, - { - path: `${projectRoot}/tsconfig.json`, - content: JSON.stringify({ - compilerOptions: { - module: "amd", - composite: true, - persistResolutions: true, - traceResolution: true, - outFile: "outFile.js" - }, - include: ["src/**/*.ts"] - }), - }, - libFile - ], { currentDirectory: projectRoot }); - const exit = sys.exit; - sys.exit = noop; - fakes.withTemporaryPatchingForBuildinfoReadWrite(sys, sys => executeCommandLine(sys, noop, ["--b", "."])); - sys.exit = exit; - sys.clearOutput(); - return sys; - }, + sys: () => getSysWithSavedResolutions("outFile.js"), commandLineArgs: ["--b", ".", "-w", "--extendedDiagnostics"], changes: [ { @@ -1320,43 +1230,7 @@ const a: string = "hello";`), verifyTscWatch({ scenario: "persistResolutions", subScenario: "can build after resolutions are cleaned with outFile", - sys: () => { - const sys = createWatchedSystem([ - { - path: `${projectRoot}/src/main.ts`, - content: Utils.dedent` - import { something } from "./filePresent"; - import { something2 } from "./fileNotFound";`, - }, - { - path: `${projectRoot}/src/filePresent.ts`, - content: `export function something() { return 10; }`, - }, - { - path: `${projectRoot}/tsconfig.json`, - content: JSON.stringify({ - compilerOptions: { - module: "amd", - composite: true, - persistResolutions: true, - traceResolution: true, - outFile: "outFile.js" - }, - include: ["src/**/*.ts"] - }), - }, - libFile - ], { currentDirectory: projectRoot }); - const exit = sys.exit; - sys.exit = noop; - fakes.withTemporaryPatchingForBuildinfoReadWrite(sys, sys => { - executeCommandLine(sys, noop, ["--b", "."]); - executeCommandLine(sys, noop, ["--b", ".", "--cleanPersistedProgram"]); - }); - sys.exit = exit; - sys.clearOutput(); - return sys; - }, + sys: () => getSysWithClearedResolutions("outFile.js"), commandLineArgs: ["--b", ".", "-w", "--extendedDiagnostics"], changes: [ { diff --git a/src/testRunner/unittests/tsc/persistResolutions.ts b/src/testRunner/unittests/tsc/persistResolutions.ts index a0a592428be55..621e9e3ebcd2c 100644 --- a/src/testRunner/unittests/tsc/persistResolutions.ts +++ b/src/testRunner/unittests/tsc/persistResolutions.ts @@ -1,12 +1,14 @@ namespace ts { describe("unittests:: tsc:: persistResolutions::", () => { - verifyTscSerializedIncrementalEdits({ - scenario: "persistResolutions", - subScenario: `saves resolution and uses it for new program`, - fs: () => loadProjectFromFiles({ + function getFs(outFile?: string) { + return loadProjectFromFiles({ "/src/project/src/main.ts": Utils.dedent` - import { something } from "./filePresent"; - import { something2 } from "./fileNotFound";`, + import { something } from "./filePresent"; + import { something as something1 } from "./filePresent"; + import { something2 } from "./fileNotFound";`, + "/src/project/src/anotherFileReusingResolution.ts": Utils.dedent` + import { something } from "./filePresent"; + import { something2 } from "./fileNotFound";`, "/src/project/src/filePresent.ts": `export function something() { return 10; }`, "/src/project/tsconfig.json": JSON.stringify({ compilerOptions: { @@ -14,10 +16,16 @@ namespace ts { composite: true, persistResolutions: true, traceResolution: true, + outFile }, include: ["src/**/*.ts"] }), - }), + }); + } + verifyTscSerializedIncrementalEdits({ + scenario: "persistResolutions", + subScenario: `saves resolution and uses it for new program`, + fs: getFs, commandLineArgs: ["--p", "src/project"], incrementalScenarios: [ noChangeRun, @@ -58,22 +66,7 @@ namespace ts { verifyTscSerializedIncrementalEdits({ scenario: "persistResolutions", subScenario: `saves resolution and uses it for new program with outFile`, - fs: () => loadProjectFromFiles({ - "/src/project/src/main.ts": Utils.dedent` - import { something } from "./filePresent"; - import { something2 } from "./fileNotFound";`, - "/src/project/src/filePresent.ts": `export function something() { return 10; }`, - "/src/project/tsconfig.json": JSON.stringify({ - compilerOptions: { - module: "amd", - composite: true, - persistResolutions: true, - traceResolution: true, - outFile: "outFile.js" - }, - include: ["src/**/*.ts"] - }), - }), + fs: () => getFs("outFile.js"), commandLineArgs: ["--p", "src/project"], incrementalScenarios: [ noChangeRun, diff --git a/src/testRunner/unittests/tscWatch/persistResolutions.ts b/src/testRunner/unittests/tscWatch/persistResolutions.ts index ba14369cc16b0..843bb67cb9dde 100644 --- a/src/testRunner/unittests/tscWatch/persistResolutions.ts +++ b/src/testRunner/unittests/tscWatch/persistResolutions.ts @@ -1,11 +1,16 @@ namespace ts.tscWatch { describe("unittests:: tsc-watch:: persistResolutions", () => { - verifyTscWatch({ - scenario: "persistResolutions", - subScenario: "saves resolution and uses it for new program", - sys: () => createWatchedSystem([ + function getSys(outFile?: string) { + return createWatchedSystem([ { path: `${projectRoot}/src/main.ts`, + content: Utils.dedent` + import { something } from "./filePresent"; + import { something as something1 } from "./filePresent"; + import { something2 } from "./fileNotFound";`, + }, + { + path: `${projectRoot}/src/anotherFileReusingResolution.ts`, content: Utils.dedent` import { something } from "./filePresent"; import { something2 } from "./fileNotFound";`, @@ -22,12 +27,42 @@ namespace ts.tscWatch { composite: true, persistResolutions: true, traceResolution: true, + outFile }, include: ["src/**/*.ts"] }), }, libFile - ], { currentDirectory: projectRoot }), + ], { currentDirectory: projectRoot }); + } + + function getSysWithSavedResolutions(outFile?: string) { + const sys = getSys(outFile); + const exit = sys.exit; + sys.exit = noop; + fakes.withTemporaryPatchingForBuildinfoReadWrite(sys, sys => executeCommandLine(sys, noop, ["--p", "."])); + sys.exit = exit; + sys.clearOutput(); + return sys; + } + + function getSysWithClearedResolutions(outFile?: string) { + const sys = getSys(outFile); + const exit = sys.exit; + sys.exit = noop; + fakes.withTemporaryPatchingForBuildinfoReadWrite(sys, sys => { + executeCommandLine(sys, noop, ["--p", "."]); + executeCommandLine(sys, noop, ["--p", ".", "--cleanPersistedProgram"]); + }); + sys.exit = exit; + sys.clearOutput(); + return sys; + } + + verifyTscWatch({ + scenario: "persistResolutions", + subScenario: "saves resolution and uses it for new program", + sys: getSys, commandLineArgs: ["--p", ".", "-w", "--extendedDiagnostics"], changes: [ { @@ -56,39 +91,7 @@ namespace ts.tscWatch { verifyTscWatch({ scenario: "persistResolutions", subScenario: "can build after resolutions have been saved in tsbuildinfo file", - sys: () => { - const sys = createWatchedSystem([ - { - path: `${projectRoot}/src/main.ts`, - content: Utils.dedent` - import { something } from "./filePresent"; - import { something2 } from "./fileNotFound";`, - }, - { - path: `${projectRoot}/src/filePresent.ts`, - content: `export function something() { return 10; }`, - }, - { - path: `${projectRoot}/tsconfig.json`, - content: JSON.stringify({ - compilerOptions: { - module: "amd", - composite: true, - persistResolutions: true, - traceResolution: true, - }, - include: ["src/**/*.ts"] - }), - }, - libFile - ], { currentDirectory: projectRoot }); - const exit = sys.exit; - sys.exit = noop; - fakes.withTemporaryPatchingForBuildinfoReadWrite(sys, sys => executeCommandLine(sys, noop, ["--p", "."])); - sys.exit = exit; - sys.clearOutput(); - return sys; - }, + sys: getSysWithSavedResolutions, commandLineArgs: ["--p", ".", "-w", "--extendedDiagnostics"], changes: [ { @@ -117,42 +120,7 @@ namespace ts.tscWatch { verifyTscWatch({ scenario: "persistResolutions", subScenario: "can build after resolutions are cleaned", - sys: () => { - const sys = createWatchedSystem([ - { - path: `${projectRoot}/src/main.ts`, - content: Utils.dedent` - import { something } from "./filePresent"; - import { something2 } from "./fileNotFound";`, - }, - { - path: `${projectRoot}/src/filePresent.ts`, - content: `export function something() { return 10; }`, - }, - { - path: `${projectRoot}/tsconfig.json`, - content: JSON.stringify({ - compilerOptions: { - module: "amd", - composite: true, - persistResolutions: true, - traceResolution: true, - }, - include: ["src/**/*.ts"] - }), - }, - libFile - ], { currentDirectory: projectRoot }); - const exit = sys.exit; - sys.exit = noop; - fakes.withTemporaryPatchingForBuildinfoReadWrite(sys, sys => { - executeCommandLine(sys, noop, ["--p", "."]); - executeCommandLine(sys, noop, ["--p", ".", "--cleanPersistedProgram"]); - }); - sys.exit = exit; - sys.clearOutput(); - return sys; - }, + sys: getSysWithClearedResolutions, commandLineArgs: ["--p", ".", "-w", "--extendedDiagnostics"], changes: [ { @@ -182,32 +150,7 @@ namespace ts.tscWatch { verifyTscWatch({ scenario: "persistResolutions", subScenario: "saves resolution and uses it for new program with outFile", - sys: () => createWatchedSystem([ - { - path: `${projectRoot}/src/main.ts`, - content: Utils.dedent` - import { something } from "./filePresent"; - import { something2 } from "./fileNotFound";`, - }, - { - path: `${projectRoot}/src/filePresent.ts`, - content: `export function something() { return 10; }`, - }, - { - path: `${projectRoot}/tsconfig.json`, - content: JSON.stringify({ - compilerOptions: { - module: "amd", - composite: true, - persistResolutions: true, - traceResolution: true, - outFile: "outFile.js" - }, - include: ["src/**/*.ts"] - }), - }, - libFile - ], { currentDirectory: projectRoot }), + sys: () => getSys("outFile.js"), commandLineArgs: ["--p", ".", "-w", "--extendedDiagnostics"], changes: [ { @@ -236,40 +179,7 @@ namespace ts.tscWatch { verifyTscWatch({ scenario: "persistResolutions", subScenario: "can build after resolutions have been saved in tsbuildinfo file with outFile", - sys: () => { - const sys = createWatchedSystem([ - { - path: `${projectRoot}/src/main.ts`, - content: Utils.dedent` - import { something } from "./filePresent"; - import { something2 } from "./fileNotFound";`, - }, - { - path: `${projectRoot}/src/filePresent.ts`, - content: `export function something() { return 10; }`, - }, - { - path: `${projectRoot}/tsconfig.json`, - content: JSON.stringify({ - compilerOptions: { - module: "amd", - composite: true, - persistResolutions: true, - traceResolution: true, - outFile: "outFile.js" - }, - include: ["src/**/*.ts"] - }), - }, - libFile - ], { currentDirectory: projectRoot }); - const exit = sys.exit; - sys.exit = noop; - fakes.withTemporaryPatchingForBuildinfoReadWrite(sys, sys => executeCommandLine(sys, noop, ["--p", "."])); - sys.exit = exit; - sys.clearOutput(); - return sys; - }, + sys: () => getSysWithSavedResolutions("outFile.js"), commandLineArgs: ["--p", ".", "-w", "--extendedDiagnostics"], changes: [ { @@ -298,43 +208,7 @@ namespace ts.tscWatch { verifyTscWatch({ scenario: "persistResolutions", subScenario: "can build after resolutions are cleaned with outFile", - sys: () => { - const sys = createWatchedSystem([ - { - path: `${projectRoot}/src/main.ts`, - content: Utils.dedent` - import { something } from "./filePresent"; - import { something2 } from "./fileNotFound";`, - }, - { - path: `${projectRoot}/src/filePresent.ts`, - content: `export function something() { return 10; }`, - }, - { - path: `${projectRoot}/tsconfig.json`, - content: JSON.stringify({ - compilerOptions: { - module: "amd", - composite: true, - persistResolutions: true, - traceResolution: true, - outFile: "outFile.js" - }, - include: ["src/**/*.ts"] - }), - }, - libFile - ], { currentDirectory: projectRoot }); - const exit = sys.exit; - sys.exit = noop; - fakes.withTemporaryPatchingForBuildinfoReadWrite(sys, sys => { - executeCommandLine(sys, noop, ["--p", "."]); - executeCommandLine(sys, noop, ["--p", ".", "--cleanPersistedProgram"]); - }); - sys.exit = exit; - sys.clearOutput(); - return sys; - }, + sys: () => getSysWithClearedResolutions("outFile.js"), commandLineArgs: ["--p", ".", "-w", "--extendedDiagnostics"], changes: [ { diff --git a/tests/baselines/reference/tsbuild/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program-with-outFile.js b/tests/baselines/reference/tsbuild/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program-with-outFile.js index 2398991c4293e..729b1ab996b17 100644 --- a/tests/baselines/reference/tsbuild/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program-with-outFile.js +++ b/tests/baselines/reference/tsbuild/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program-with-outFile.js @@ -14,11 +14,16 @@ interface Array { length: number; [n: number]: T; } interface ReadonlyArray {} declare const console: { log(msg: any): void; }; +//// [/src/project/src/anotherFileReusingResolution.ts] +import { something } from "./filePresent"; +import { something2 } from "./fileNotFound"; + //// [/src/project/src/filePresent.ts] export function something() { return 10; } //// [/src/project/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound"; //// [/src/project/tsconfig.json] @@ -28,11 +33,11 @@ import { something2 } from "./fileNotFound"; Output:: /lib/tsc --b src/project -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/fileNotFound.ts' does not exist. File '/src/project/src/fileNotFound.tsx' does not exist. @@ -40,21 +45,33 @@ File '/src/project/src/fileNotFound.d.ts' does not exist. File '/src/project/src/fileNotFound.js' does not exist. File '/src/project/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/project/src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/src/project/src'. +======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ +src/project/src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + -Found 1 error. +Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped -Program root files: ["/src/project/src/filePresent.ts","/src/project/src/main.ts"] +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/src/project/outFile.js","configFilePath":"/src/project/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/main.ts No cached semantic diagnostics in the builder:: @@ -66,6 +83,7 @@ No cached semantic diagnostics in the builder:: "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", "./src/main.ts" ] }, @@ -79,9 +97,13 @@ No cached semantic diagnostics in the builder:: "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, - "./src/main.ts": { + "./src/anotherfilereusingresolution.ts": { "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false } }, "options": { @@ -93,6 +115,9 @@ No cached semantic diagnostics in the builder:: "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -110,11 +135,11 @@ Input:: Output:: /lib/tsc --b src/project -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/fileNotFound.ts' does not exist. File '/src/project/src/fileNotFound.tsx' does not exist. @@ -122,21 +147,33 @@ File '/src/project/src/fileNotFound.d.ts' does not exist. File '/src/project/src/fileNotFound.js' does not exist. File '/src/project/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/project/src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/src/project/src'. +======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ +src/project/src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + -Found 1 error. +Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped -Program root files: ["/src/project/src/filePresent.ts","/src/project/src/main.ts"] +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/src/project/outFile.js","configFilePath":"/src/project/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/main.ts No cached semantic diagnostics in the builder:: @@ -148,17 +185,18 @@ Change:: Modify main file Input:: //// [/src/project/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); Output:: /lib/tsc --b src/project -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/fileNotFound.ts' does not exist. File '/src/project/src/fileNotFound.tsx' does not exist. @@ -166,21 +204,33 @@ File '/src/project/src/fileNotFound.d.ts' does not exist. File '/src/project/src/fileNotFound.js' does not exist. File '/src/project/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/project/src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/src/project/src'. +======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ +src/project/src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -Found 1 error. +3 import { something2 } from "./fileNotFound";something(); +   ~~~~~~~~~~~~~~~~ + + +Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped -Program root files: ["/src/project/src/filePresent.ts","/src/project/src/main.ts"] +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/src/project/outFile.js","configFilePath":"/src/project/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/main.ts No cached semantic diagnostics in the builder:: @@ -192,6 +242,7 @@ No cached semantic diagnostics in the builder:: "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", "./src/main.ts" ] }, @@ -205,8 +256,12 @@ No cached semantic diagnostics in the builder:: "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false + }, "./src/main.ts": { - "version": "-22084070133-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "affectsGlobalScope": false } }, @@ -219,6 +274,9 @@ No cached semantic diagnostics in the builder:: "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -234,6 +292,7 @@ Change:: Add new module and update main file Input:: //// [/src/project/src/main.ts] import { foo } from "./newFile";import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); //// [/src/project/src/newFile.ts] @@ -243,15 +302,11 @@ export function foo() { return 20; } Output:: /lib/tsc --b src/project -======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/newFile.ts' exist - use it as a name resolution result. -======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/fileNotFound.ts' does not exist. File '/src/project/src/fileNotFound.tsx' does not exist. @@ -259,21 +314,37 @@ File '/src/project/src/fileNotFound.d.ts' does not exist. File '/src/project/src/fileNotFound.js' does not exist. File '/src/project/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/project/src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/src/project/src/newFile.ts' exist - use it as a name resolution result. +======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== +======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/src/project/src'. +======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ +src/project/src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something(); +   ~~~~~~~~~~~~~~~~ -Found 1 error. + +Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped -Program root files: ["/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/src/project/outFile.js","configFilePath":"/src/project/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/newFile.ts /src/project/src/main.ts @@ -286,6 +357,7 @@ No cached semantic diagnostics in the builder:: "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", "./src/newFile.ts", "./src/main.ts" ] @@ -300,12 +372,16 @@ No cached semantic diagnostics in the builder:: "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "affectsGlobalScope": false } }, @@ -318,6 +394,9 @@ No cached semantic diagnostics in the builder:: "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts", "./src/newfile.ts" @@ -339,26 +418,33 @@ export function something2() { return 20; } Output:: /lib/tsc --b src/project +======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. +======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/src/project/src/fileNotFound.ts' exist - use it as a name resolution result. +======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== ======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== ======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. +Resolution for module './filePresent' was found in cache from location '/src/project/src'. ======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== ======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' exist - use it as a name resolution result. +Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. ======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== exitCode:: ExitStatus.Success -Program root files: ["/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/src/project/outFile.js","configFilePath":"/src/project/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts -/src/project/src/fileNotFound.ts /src/project/src/filePresent.ts +/src/project/src/fileNotFound.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/newFile.ts /src/project/src/main.ts @@ -366,12 +452,13 @@ No cached semantic diagnostics in the builder:: //// [/src/project/outFile.d.ts] -declare module "src/fileNotFound" { - export function something2(): number; -} declare module "src/filePresent" { export function something(): number; } +declare module "src/fileNotFound" { + export function something2(): number; +} +declare module "src/anotherFileReusingResolution" { } declare module "src/newFile" { export function foo(): number; } @@ -379,6 +466,13 @@ declare module "src/main" { } //// [/src/project/outFile.js] +define("src/filePresent", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.something = void 0; + function something() { return 10; } + exports.something = something; +}); define("src/fileNotFound", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -386,12 +480,9 @@ define("src/fileNotFound", ["require", "exports"], function (require, exports) { function something2() { return 20; } exports.something2 = something2; }); -define("src/filePresent", ["require", "exports"], function (require, exports) { +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; - exports.something = void 0; - function something() { return 10; } - exports.something = something; }); define("src/newFile", ["require", "exports"], function (require, exports) { "use strict"; @@ -412,8 +503,9 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "bundle": { "commonSourceDirectory": "./", "sourceFiles": [ - "./src/fileNotFound.ts", "./src/filePresent.ts", + "./src/fileNotFound.ts", + "./src/anotherFileReusingResolution.ts", "./src/newFile.ts", "./src/main.ts" ], @@ -421,7 +513,7 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "sections": [ { "pos": 0, - "end": 914, + "end": 1068, "kind": "text" } ] @@ -430,7 +522,7 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "sections": [ { "pos": 0, - "end": 266, + "end": 321, "kind": "text" } ] @@ -442,12 +534,16 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", "affectsGlobalScope": true }, + "./src/filepresent.ts": { + "version": "11598859296-export function something() { return 10; }", + "affectsGlobalScope": false + }, "./src/filenotfound.ts": { "version": "-497034637-export function something2() { return 20; }", "affectsGlobalScope": false }, - "./src/filepresent.ts": { - "version": "11598859296-export function something() { return 10; }", + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "affectsGlobalScope": false }, "./src/newfile.ts": { @@ -455,7 +551,7 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "affectsGlobalScope": false } }, @@ -468,6 +564,10 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filenotfound.ts", + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filenotfound.ts", "./src/filepresent.ts", @@ -483,7 +583,14 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, ====================================================================== File:: /src/project/outFile.js ---------------------------------------------------------------------- -text: (0-914) +text: (0-1068) +define("src/filePresent", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.something = void 0; + function something() { return 10; } + exports.something = something; +}); define("src/fileNotFound", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -491,12 +598,9 @@ define("src/fileNotFound", ["require", "exports"], function (require, exports) { function something2() { return 20; } exports.something2 = something2; }); -define("src/filePresent", ["require", "exports"], function (require, exports) { +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; - exports.something = void 0; - function something() { return 10; } - exports.something = something; }); define("src/newFile", ["require", "exports"], function (require, exports) { "use strict"; @@ -515,13 +619,14 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, ====================================================================== File:: /src/project/outFile.d.ts ---------------------------------------------------------------------- -text: (0-266) -declare module "src/fileNotFound" { - export function something2(): number; -} +text: (0-321) declare module "src/filePresent" { export function something(): number; } +declare module "src/fileNotFound" { + export function something2(): number; +} +declare module "src/anotherFileReusingResolution" { } declare module "src/newFile" { export function foo(): number; } @@ -558,32 +663,40 @@ Change:: Modify main file Input:: //// [/src/project/src/main.ts] import { foo } from "./newFile";import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something();something(); Output:: /lib/tsc --b src/project +======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. +======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/src/project/src/fileNotFound.ts' exist - use it as a name resolution result. +======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== ======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== ======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. +Resolution for module './filePresent' was found in cache from location '/src/project/src'. ======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== ======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' exist - use it as a name resolution result. +Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. ======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== exitCode:: ExitStatus.Success -Program root files: ["/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/src/project/outFile.js","configFilePath":"/src/project/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts -/src/project/src/fileNotFound.ts /src/project/src/filePresent.ts +/src/project/src/fileNotFound.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/newFile.ts /src/project/src/main.ts @@ -592,6 +705,13 @@ No cached semantic diagnostics in the builder:: //// [/src/project/outFile.d.ts] file written with same contents //// [/src/project/outFile.js] +define("src/filePresent", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.something = void 0; + function something() { return 10; } + exports.something = something; +}); define("src/fileNotFound", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -599,12 +719,9 @@ define("src/fileNotFound", ["require", "exports"], function (require, exports) { function something2() { return 20; } exports.something2 = something2; }); -define("src/filePresent", ["require", "exports"], function (require, exports) { +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; - exports.something = void 0; - function something() { return 10; } - exports.something = something; }); define("src/newFile", ["require", "exports"], function (require, exports) { "use strict"; @@ -626,8 +743,9 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "bundle": { "commonSourceDirectory": "./", "sourceFiles": [ - "./src/fileNotFound.ts", "./src/filePresent.ts", + "./src/fileNotFound.ts", + "./src/anotherFileReusingResolution.ts", "./src/newFile.ts", "./src/main.ts" ], @@ -635,7 +753,7 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "sections": [ { "pos": 0, - "end": 946, + "end": 1100, "kind": "text" } ] @@ -644,7 +762,7 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "sections": [ { "pos": 0, - "end": 266, + "end": 321, "kind": "text" } ] @@ -656,12 +774,16 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", "affectsGlobalScope": true }, + "./src/filepresent.ts": { + "version": "11598859296-export function something() { return 10; }", + "affectsGlobalScope": false + }, "./src/filenotfound.ts": { "version": "-497034637-export function something2() { return 20; }", "affectsGlobalScope": false }, - "./src/filepresent.ts": { - "version": "11598859296-export function something() { return 10; }", + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "affectsGlobalScope": false }, "./src/newfile.ts": { @@ -669,7 +791,7 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "affectsGlobalScope": false }, "./src/main.ts": { - "version": "992573078-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();something();", + "version": "26360741061-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();something();", "affectsGlobalScope": false } }, @@ -682,6 +804,10 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filenotfound.ts", + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filenotfound.ts", "./src/filepresent.ts", @@ -697,7 +823,14 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, ====================================================================== File:: /src/project/outFile.js ---------------------------------------------------------------------- -text: (0-946) +text: (0-1100) +define("src/filePresent", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.something = void 0; + function something() { return 10; } + exports.something = something; +}); define("src/fileNotFound", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -705,12 +838,9 @@ define("src/fileNotFound", ["require", "exports"], function (require, exports) { function something2() { return 20; } exports.something2 = something2; }); -define("src/filePresent", ["require", "exports"], function (require, exports) { +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; - exports.something = void 0; - function something() { return 10; } - exports.something = something; }); define("src/newFile", ["require", "exports"], function (require, exports) { "use strict"; @@ -730,13 +860,14 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, ====================================================================== File:: /src/project/outFile.d.ts ---------------------------------------------------------------------- -text: (0-266) -declare module "src/fileNotFound" { - export function something2(): number; -} +text: (0-321) declare module "src/filePresent" { export function something(): number; } +declare module "src/fileNotFound" { + export function something2(): number; +} +declare module "src/anotherFileReusingResolution" { } declare module "src/newFile" { export function foo(): number; } diff --git a/tests/baselines/reference/tsbuild/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program.js b/tests/baselines/reference/tsbuild/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program.js index 8d10c8525a891..f52dfd28c2f95 100644 --- a/tests/baselines/reference/tsbuild/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program.js +++ b/tests/baselines/reference/tsbuild/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program.js @@ -14,11 +14,16 @@ interface Array { length: number; [n: number]: T; } interface ReadonlyArray {} declare const console: { log(msg: any): void; }; +//// [/src/project/src/anotherFileReusingResolution.ts] +import { something } from "./filePresent"; +import { something2 } from "./fileNotFound"; + //// [/src/project/src/filePresent.ts] export function something() { return 10; } //// [/src/project/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound"; //// [/src/project/tsconfig.json] @@ -28,11 +33,11 @@ import { something2 } from "./fileNotFound"; Output:: /lib/tsc --b src/project -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/fileNotFound.ts' does not exist. File '/src/project/src/fileNotFound.tsx' does not exist. @@ -40,26 +45,39 @@ File '/src/project/src/fileNotFound.d.ts' does not exist. File '/src/project/src/fileNotFound.js' does not exist. File '/src/project/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/project/src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/src/project/src'. +======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ +src/project/src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + -Found 1 error. +Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped -Program root files: ["/src/project/src/filePresent.ts","/src/project/src/main.ts"] +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"configFilePath":"/src/project/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/main.ts Semantic diagnostics in builder refreshed for:: /lib/lib.d.ts /src/project/src/filePresent.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/main.ts @@ -77,10 +95,15 @@ Semantic diagnostics in builder refreshed for:: "signature": "-15062742831-export declare function something(): number;\r\n", "affectsGlobalScope": false }, - "./src/main.ts": { + "./src/anotherfilereusingresolution.ts": { "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "signature": "-4882119183-export {};\r\n", "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false } }, "options": { @@ -91,6 +114,9 @@ Semantic diagnostics in builder refreshed for:: "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -98,13 +124,26 @@ Semantic diagnostics in builder refreshed for:: "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filepresent.ts", [ "./src/main.ts", [ { "file": "./src/main.ts", - "start": 70, + "start": 127, "length": 16, "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", "category": 1, @@ -114,6 +153,10 @@ Semantic diagnostics in builder refreshed for:: ] ], "affectedFilesPendingEmit": [ + [ + "./src/anotherfilereusingresolution.ts", + 1 + ], [ "./src/filepresent.ts", 1 @@ -135,11 +178,11 @@ Input:: Output:: /lib/tsc --b src/project -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/fileNotFound.ts' does not exist. File '/src/project/src/fileNotFound.tsx' does not exist. @@ -147,21 +190,33 @@ File '/src/project/src/fileNotFound.d.ts' does not exist. File '/src/project/src/fileNotFound.js' does not exist. File '/src/project/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/project/src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/src/project/src'. +======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ +src/project/src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + -Found 1 error. +Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped -Program root files: ["/src/project/src/filePresent.ts","/src/project/src/main.ts"] +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"configFilePath":"/src/project/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/main.ts Semantic diagnostics in builder refreshed for:: @@ -173,17 +228,18 @@ Change:: Modify main file Input:: //// [/src/project/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); Output:: /lib/tsc --b src/project -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/fileNotFound.ts' does not exist. File '/src/project/src/fileNotFound.tsx' does not exist. @@ -191,21 +247,33 @@ File '/src/project/src/fileNotFound.d.ts' does not exist. File '/src/project/src/fileNotFound.js' does not exist. File '/src/project/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/project/src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/src/project/src'. +======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ +src/project/src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something(); +   ~~~~~~~~~~~~~~~~ -Found 1 error. + +Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped -Program root files: ["/src/project/src/filePresent.ts","/src/project/src/main.ts"] +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"configFilePath":"/src/project/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/main.ts Semantic diagnostics in builder refreshed for:: @@ -226,8 +294,13 @@ Semantic diagnostics in builder refreshed for:: "signature": "-15062742831-export declare function something(): number;\r\n", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, "./src/main.ts": { - "version": "-22084070133-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "signature": "-4882119183-export {};\r\n", "affectsGlobalScope": false } @@ -240,6 +313,9 @@ Semantic diagnostics in builder refreshed for:: "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -247,13 +323,26 @@ Semantic diagnostics in builder refreshed for:: "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filepresent.ts", [ "./src/main.ts", [ { "file": "./src/main.ts", - "start": 70, + "start": 127, "length": 16, "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", "category": 1, @@ -263,6 +352,10 @@ Semantic diagnostics in builder refreshed for:: ] ], "affectedFilesPendingEmit": [ + [ + "./src/anotherfilereusingresolution.ts", + 1 + ], [ "./src/filepresent.ts", 1 @@ -282,6 +375,7 @@ Change:: Add new module and update main file Input:: //// [/src/project/src/main.ts] import { foo } from "./newFile";import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); //// [/src/project/src/newFile.ts] @@ -291,15 +385,11 @@ export function foo() { return 20; } Output:: /lib/tsc --b src/project -======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/newFile.ts' exist - use it as a name resolution result. -======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/fileNotFound.ts' does not exist. File '/src/project/src/fileNotFound.tsx' does not exist. @@ -307,21 +397,37 @@ File '/src/project/src/fileNotFound.d.ts' does not exist. File '/src/project/src/fileNotFound.js' does not exist. File '/src/project/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/project/src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/src/project/src/newFile.ts' exist - use it as a name resolution result. +======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== +======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/src/project/src'. +======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +src/project/src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -Found 1 error. +Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped -Program root files: ["/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"configFilePath":"/src/project/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/newFile.ts /src/project/src/main.ts @@ -344,13 +450,18 @@ Semantic diagnostics in builder refreshed for:: "signature": "-15062742831-export declare function something(): number;\r\n", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "signature": "-3405156953-export declare function foo(): number;\r\n", "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "signature": "-4882119183-export {};\r\n", "affectsGlobalScope": false } @@ -363,6 +474,9 @@ Semantic diagnostics in builder refreshed for:: "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts", "./src/newfile.ts" @@ -371,13 +485,26 @@ Semantic diagnostics in builder refreshed for:: "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filepresent.ts", [ "./src/main.ts", [ { "file": "./src/main.ts", - "start": 102, + "start": 159, "length": 16, "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", "category": 1, @@ -388,6 +515,10 @@ Semantic diagnostics in builder refreshed for:: "./src/newfile.ts" ], "affectedFilesPendingEmit": [ + [ + "./src/anotherfilereusingresolution.ts", + 1 + ], [ "./src/filepresent.ts", 1 @@ -416,34 +547,53 @@ export function something2() { return 20; } Output:: /lib/tsc --b src/project +======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. +======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/src/project/src/fileNotFound.ts' exist - use it as a name resolution result. +======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== ======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== ======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. +Resolution for module './filePresent' was found in cache from location '/src/project/src'. ======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== ======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' exist - use it as a name resolution result. +Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. ======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== exitCode:: ExitStatus.Success -Program root files: ["/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"configFilePath":"/src/project/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts -/src/project/src/fileNotFound.ts /src/project/src/filePresent.ts +/src/project/src/fileNotFound.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/newFile.ts /src/project/src/main.ts Semantic diagnostics in builder refreshed for:: /src/project/src/fileNotFound.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/main.ts +//// [/src/project/src/anotherFileReusingResolution.d.ts] +export {}; + + +//// [/src/project/src/anotherFileReusingResolution.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); + + //// [/src/project/src/fileNotFound.d.ts] export declare function something2(): number; @@ -507,14 +657,19 @@ define(["require", "exports"], function (require, exports) { "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", "affectsGlobalScope": true }, + "./src/filepresent.ts": { + "version": "11598859296-export function something() { return 10; }", + "signature": "-15062742831-export declare function something(): number;\r\n", + "affectsGlobalScope": false + }, "./src/filenotfound.ts": { "version": "-497034637-export function something2() { return 20; }", "signature": "-13705775197-export declare function something2(): number;\r\n", "affectsGlobalScope": false }, - "./src/filepresent.ts": { - "version": "11598859296-export function something() { return 10; }", - "signature": "-15062742831-export declare function something(): number;\r\n", + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-4882119183-export {};\r\n", "affectsGlobalScope": false }, "./src/newfile.ts": { @@ -523,7 +678,7 @@ define(["require", "exports"], function (require, exports) { "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "signature": "-4882119183-export {};\r\n", "affectsGlobalScope": false } @@ -536,6 +691,10 @@ define(["require", "exports"], function (require, exports) { "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filenotfound.ts", + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filenotfound.ts", "./src/filepresent.ts", @@ -545,6 +704,7 @@ define(["require", "exports"], function (require, exports) { "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../lib/lib.d.ts", + "./src/anotherfilereusingresolution.ts", "./src/filenotfound.ts", "./src/filepresent.ts", "./src/main.ts", @@ -583,32 +743,40 @@ Change:: Modify main file Input:: //// [/src/project/src/main.ts] import { foo } from "./newFile";import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something();something(); Output:: /lib/tsc --b src/project +======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. +======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/src/project/src/fileNotFound.ts' exist - use it as a name resolution result. +======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== ======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== ======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. +Resolution for module './filePresent' was found in cache from location '/src/project/src'. ======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== ======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' exist - use it as a name resolution result. +Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. ======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== exitCode:: ExitStatus.Success -Program root files: ["/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"configFilePath":"/src/project/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts -/src/project/src/fileNotFound.ts /src/project/src/filePresent.ts +/src/project/src/fileNotFound.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/newFile.ts /src/project/src/main.ts @@ -635,14 +803,19 @@ define(["require", "exports", "./filePresent"], function (require, exports, file "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", "affectsGlobalScope": true }, + "./src/filepresent.ts": { + "version": "11598859296-export function something() { return 10; }", + "signature": "-15062742831-export declare function something(): number;\r\n", + "affectsGlobalScope": false + }, "./src/filenotfound.ts": { "version": "-497034637-export function something2() { return 20; }", "signature": "-13705775197-export declare function something2(): number;\r\n", "affectsGlobalScope": false }, - "./src/filepresent.ts": { - "version": "11598859296-export function something() { return 10; }", - "signature": "-15062742831-export declare function something(): number;\r\n", + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-4882119183-export {};\r\n", "affectsGlobalScope": false }, "./src/newfile.ts": { @@ -651,7 +824,7 @@ define(["require", "exports", "./filePresent"], function (require, exports, file "affectsGlobalScope": false }, "./src/main.ts": { - "version": "992573078-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();something();", + "version": "26360741061-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();something();", "signature": "-4882119183-export {};\r\n", "affectsGlobalScope": false } @@ -664,6 +837,10 @@ define(["require", "exports", "./filePresent"], function (require, exports, file "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filenotfound.ts", + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filenotfound.ts", "./src/filepresent.ts", @@ -673,6 +850,7 @@ define(["require", "exports", "./filePresent"], function (require, exports, file "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../lib/lib.d.ts", + "./src/anotherfilereusingresolution.ts", "./src/filenotfound.ts", "./src/filepresent.ts", "./src/main.ts", diff --git a/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-are-cleaned-with-outFile.js b/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-are-cleaned-with-outFile.js index f62fa27c3541b..87004ce816473 100644 --- a/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-are-cleaned-with-outFile.js +++ b/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-are-cleaned-with-outFile.js @@ -1,6 +1,11 @@ Input:: //// [/user/username/projects/myproject/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; +import { something2 } from "./fileNotFound"; + +//// [/user/username/projects/myproject/src/anotherFileReusingResolution.ts] +import { something } from "./filePresent"; import { something2 } from "./fileNotFound"; //// [/user/username/projects/myproject/src/filePresent.ts] @@ -28,6 +33,7 @@ interface Array { length: number; [n: number]: T; } "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", "./src/main.ts" ] }, @@ -41,9 +47,13 @@ interface Array { length: number; [n: number]: T; } "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, - "./src/main.ts": { + "./src/anotherfilereusingresolution.ts": { "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false } }, "options": { @@ -55,6 +65,9 @@ interface Array { length: number; [n: number]: T; } "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -67,13 +80,13 @@ interface Array { length: number; [n: number]: T; } /a/lib/tsc.js --b . -w --extendedDiagnostics Output:: -[12:00:30 AM] Starting compilation in watch mode... +[12:00:32 AM] Starting compilation in watch mode... -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. @@ -81,26 +94,39 @@ File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ -[12:00:31 AM] Found 1 error. Watching for file changes. +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +[12:00:33 AM] Found 2 errors. Watching for file changes. FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Config file /user/username/projects/myproject/tsconfig.json DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/anotherFileReusingResolution.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/filePresent.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts No cached semantic diagnostics in the builder:: @@ -108,6 +134,8 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -127,19 +155,20 @@ Change:: Modify main file Input:: //// [/user/username/projects/myproject/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); Output:: FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -[12:00:34 AM] File change detected. Starting incremental compilation... +[12:00:36 AM] File change detected. Starting incremental compilation... -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. @@ -147,21 +176,33 @@ File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ -[12:00:38 AM] Found 1 error. Watching for file changes. +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something(); +   ~~~~~~~~~~~~~~~~ + +[12:00:40 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts No cached semantic diagnostics in the builder:: @@ -169,6 +210,8 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -188,6 +231,7 @@ exitCode:: ExitStatus.undefined "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", "./src/main.ts" ] }, @@ -201,8 +245,12 @@ exitCode:: ExitStatus.undefined "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false + }, "./src/main.ts": { - "version": "-22084070133-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "affectsGlobalScope": false } }, @@ -217,6 +265,9 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -232,6 +283,7 @@ Change:: Add new module and update main file Input:: //// [/user/username/projects/myproject/src/main.ts] import { foo } from "./newFile";import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); //// [/user/username/projects/myproject/src/newFile.ts] @@ -243,18 +295,14 @@ DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile. Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -[12:00:43 AM] File change detected. Starting incremental compilation... +[12:00:45 AM] File change detected. Starting incremental compilation... FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/newFile.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. -======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. @@ -262,21 +310,37 @@ File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. +======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ -[12:00:47 AM] Found 1 error. Watching for file changes. +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something(); +   ~~~~~~~~~~~~~~~~ + +[12:00:49 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts @@ -285,6 +349,8 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -306,6 +372,7 @@ exitCode:: ExitStatus.undefined "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", "./src/newFile.ts", "./src/main.ts" ] @@ -320,12 +387,16 @@ exitCode:: ExitStatus.undefined "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "affectsGlobalScope": false } }, @@ -340,6 +411,9 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts", "./src/newfile.ts" @@ -361,32 +435,39 @@ export function something2() { return 20; } Output:: DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -[12:00:50 AM] File change detected. Starting incremental compilation... +[12:00:52 AM] File change detected. Starting incremental compilation... FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileNotFound.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/user/username/projects/myproject/src/fileNotFound.ts' exist - use it as a name resolution result. +======== Module name './fileNotFound' was successfully resolved to '/user/username/projects/myproject/src/fileNotFound.ts'. ======== ======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== ======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== ======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' exist - use it as a name resolution result. +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. ======== Module name './fileNotFound' was successfully resolved to '/user/username/projects/myproject/src/fileNotFound.ts'. ======== -[12:00:58 AM] Found 0 errors. Watching for file changes. +[12:01:00 AM] Found 0 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts -/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/fileNotFound.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts @@ -395,6 +476,8 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -417,8 +500,9 @@ exitCode:: ExitStatus.undefined "bundle": { "commonSourceDirectory": "./", "sourceFiles": [ - "./src/fileNotFound.ts", "./src/filePresent.ts", + "./src/fileNotFound.ts", + "./src/anotherFileReusingResolution.ts", "./src/newFile.ts", "./src/main.ts" ], @@ -426,7 +510,7 @@ exitCode:: ExitStatus.undefined "sections": [ { "pos": 0, - "end": 888, + "end": 1038, "kind": "text" } ] @@ -435,7 +519,7 @@ exitCode:: ExitStatus.undefined "sections": [ { "pos": 0, - "end": 256, + "end": 310, "kind": "text" } ] @@ -447,12 +531,16 @@ exitCode:: ExitStatus.undefined "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", "affectsGlobalScope": true }, + "./src/filepresent.ts": { + "version": "11598859296-export function something() { return 10; }", + "affectsGlobalScope": false + }, "./src/filenotfound.ts": { "version": "-497034637-export function something2() { return 20; }", "affectsGlobalScope": false }, - "./src/filepresent.ts": { - "version": "11598859296-export function something() { return 10; }", + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "affectsGlobalScope": false }, "./src/newfile.ts": { @@ -460,7 +548,7 @@ exitCode:: ExitStatus.undefined "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "affectsGlobalScope": false } }, @@ -475,6 +563,10 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filenotfound.ts", + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filenotfound.ts", "./src/filepresent.ts", @@ -487,6 +579,13 @@ exitCode:: ExitStatus.undefined } //// [/user/username/projects/myproject/outFile.js] +define("src/filePresent", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.something = void 0; + function something() { return 10; } + exports.something = something; +}); define("src/fileNotFound", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -494,12 +593,9 @@ define("src/fileNotFound", ["require", "exports"], function (require, exports) { function something2() { return 20; } exports.something2 = something2; }); -define("src/filePresent", ["require", "exports"], function (require, exports) { +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; - exports.something = void 0; - function something() { return 10; } - exports.something = something; }); define("src/newFile", ["require", "exports"], function (require, exports) { "use strict"; @@ -516,12 +612,13 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, //// [/user/username/projects/myproject/outFile.d.ts] -declare module "src/fileNotFound" { - export function something2(): number; -} declare module "src/filePresent" { export function something(): number; } +declare module "src/fileNotFound" { + export function something2(): number; +} +declare module "src/anotherFileReusingResolution" { } declare module "src/newFile" { export function foo(): number; } diff --git a/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-are-cleaned.js b/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-are-cleaned.js index b58d70d08da2d..80dc6165fc85d 100644 --- a/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-are-cleaned.js +++ b/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-are-cleaned.js @@ -1,6 +1,11 @@ Input:: //// [/user/username/projects/myproject/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; +import { something2 } from "./fileNotFound"; + +//// [/user/username/projects/myproject/src/anotherFileReusingResolution.ts] +import { something } from "./filePresent"; import { something2 } from "./fileNotFound"; //// [/user/username/projects/myproject/src/filePresent.ts] @@ -36,10 +41,15 @@ interface Array { length: number; [n: number]: T; } "signature": "-13601649692-export declare function something(): number;\n", "affectsGlobalScope": false }, - "./src/main.ts": { + "./src/anotherfilereusingresolution.ts": { "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "signature": "-3531856636-export {};\n", "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", + "affectsGlobalScope": false } }, "options": { @@ -50,6 +60,9 @@ interface Array { length: number; [n: number]: T; } "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -57,13 +70,26 @@ interface Array { length: number; [n: number]: T; } "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filepresent.ts", [ "./src/main.ts", [ { "file": "./src/main.ts", - "start": 70, + "start": 127, "length": 16, "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", "category": 1, @@ -73,6 +99,10 @@ interface Array { length: number; [n: number]: T; } ] ], "affectedFilesPendingEmit": [ + [ + "./src/anotherfilereusingresolution.ts", + 1 + ], [ "./src/filepresent.ts", 1 @@ -89,13 +119,13 @@ interface Array { length: number; [n: number]: T; } /a/lib/tsc.js --b . -w --extendedDiagnostics Output:: -[12:00:30 AM] Starting compilation in watch mode... +[12:00:32 AM] Starting compilation in watch mode... -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. @@ -103,26 +133,39 @@ File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ -[12:00:31 AM] Found 1 error. Watching for file changes. +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +[12:00:33 AM] Found 2 errors. Watching for file changes. FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Config file /user/username/projects/myproject/tsconfig.json DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/anotherFileReusingResolution.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/filePresent.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts Semantic diagnostics in builder refreshed for:: @@ -130,6 +173,8 @@ Semantic diagnostics in builder refreshed for:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -149,19 +194,20 @@ Change:: Modify main file Input:: //// [/user/username/projects/myproject/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); Output:: FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -[12:00:34 AM] File change detected. Starting incremental compilation... +[12:00:36 AM] File change detected. Starting incremental compilation... -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. @@ -169,21 +215,33 @@ File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -[12:00:38 AM] Found 1 error. Watching for file changes. +[12:00:40 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts Semantic diagnostics in builder refreshed for:: @@ -192,6 +250,8 @@ Semantic diagnostics in builder refreshed for:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -219,8 +279,13 @@ exitCode:: ExitStatus.undefined "signature": "-13601649692-export declare function something(): number;\n", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", + "affectsGlobalScope": false + }, "./src/main.ts": { - "version": "-22084070133-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "signature": "-3531856636-export {};\n", "affectsGlobalScope": false } @@ -235,6 +300,9 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -242,13 +310,26 @@ exitCode:: ExitStatus.undefined "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filepresent.ts", [ "./src/main.ts", [ { "file": "./src/main.ts", - "start": 70, + "start": 127, "length": 16, "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", "category": 1, @@ -258,6 +339,10 @@ exitCode:: ExitStatus.undefined ] ], "affectedFilesPendingEmit": [ + [ + "./src/anotherfilereusingresolution.ts", + 1 + ], [ "./src/filepresent.ts", 1 @@ -277,6 +362,7 @@ Change:: Add new module and update main file Input:: //// [/user/username/projects/myproject/src/main.ts] import { foo } from "./newFile";import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); //// [/user/username/projects/myproject/src/newFile.ts] @@ -288,18 +374,14 @@ DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile. Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -[12:00:43 AM] File change detected. Starting incremental compilation... +[12:00:45 AM] File change detected. Starting incremental compilation... FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/newFile.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. -======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. @@ -307,21 +389,37 @@ File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. +======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ -2 import { something2 } from "./fileNotFound";something(); +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -[12:00:47 AM] Found 1 error. Watching for file changes. +[12:00:49 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts @@ -332,6 +430,8 @@ Semantic diagnostics in builder refreshed for:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -361,13 +461,18 @@ exitCode:: ExitStatus.undefined "signature": "-13601649692-export declare function something(): number;\n", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "signature": "-4788605446-export declare function foo(): number;\n", "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "signature": "-3531856636-export {};\n", "affectsGlobalScope": false } @@ -382,6 +487,9 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts", "./src/newfile.ts" @@ -390,13 +498,26 @@ exitCode:: ExitStatus.undefined "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filepresent.ts", [ "./src/main.ts", [ { "file": "./src/main.ts", - "start": 102, + "start": 159, "length": 16, "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", "category": 1, @@ -407,6 +528,10 @@ exitCode:: ExitStatus.undefined "./src/newfile.ts" ], "affectedFilesPendingEmit": [ + [ + "./src/anotherfilereusingresolution.ts", + 1 + ], [ "./src/filepresent.ts", 1 @@ -435,21 +560,33 @@ export function something2() { return 20; } Output:: DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -[12:00:50 AM] File change detected. Starting incremental compilation... +[12:00:52 AM] File change detected. Starting incremental compilation... FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileNotFound.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/user/username/projects/myproject/src/fileNotFound.ts' exist - use it as a name resolution result. +======== Module name './fileNotFound' was successfully resolved to '/user/username/projects/myproject/src/fileNotFound.ts'. ======== ======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== ======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== ======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' exist - use it as a name resolution result. +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. ======== Module name './fileNotFound' was successfully resolved to '/user/username/projects/myproject/src/fileNotFound.ts'. ======== +DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/anotherFileReusingResolution.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json +Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/src/anotherFileReusingResolution.js +Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/anotherFileReusingResolution.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/anotherFileReusingResolution.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json +Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/anotherFileReusingResolution.d.ts +Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/anotherFileReusingResolution.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/filePresent.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/src/filePresent.js Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/filePresent.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json @@ -474,27 +611,31 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/fileNotFound.d.ts Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -[12:01:10 AM] Found 0 errors. Watching for file changes. +[12:01:16 AM] Found 0 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts -/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/fileNotFound.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts Semantic diagnostics in builder refreshed for:: /user/username/projects/myproject/src/fileNotFound.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -521,14 +662,19 @@ exitCode:: ExitStatus.undefined "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", "affectsGlobalScope": true }, + "./src/filepresent.ts": { + "version": "11598859296-export function something() { return 10; }", + "signature": "-13601649692-export declare function something(): number;\n", + "affectsGlobalScope": false + }, "./src/filenotfound.ts": { "version": "-497034637-export function something2() { return 20; }", "signature": "-14992185226-export declare function something2(): number;\n", "affectsGlobalScope": false }, - "./src/filepresent.ts": { - "version": "11598859296-export function something() { return 10; }", - "signature": "-13601649692-export declare function something(): number;\n", + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", "affectsGlobalScope": false }, "./src/newfile.ts": { @@ -537,7 +683,7 @@ exitCode:: ExitStatus.undefined "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "signature": "-3531856636-export {};\n", "affectsGlobalScope": false } @@ -552,6 +698,10 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filenotfound.ts", + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filenotfound.ts", "./src/filepresent.ts", @@ -561,6 +711,7 @@ exitCode:: ExitStatus.undefined "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", + "./src/anotherfilereusingresolution.ts", "./src/filenotfound.ts", "./src/filepresent.ts", "./src/main.ts", @@ -570,6 +721,17 @@ exitCode:: ExitStatus.undefined "version": "FakeTSVersion" } +//// [/user/username/projects/myproject/src/anotherFileReusingResolution.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); + + +//// [/user/username/projects/myproject/src/anotherFileReusingResolution.d.ts] +export {}; + + //// [/user/username/projects/myproject/src/filePresent.js] define(["require", "exports"], function (require, exports) { "use strict"; diff --git a/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file-with-outFile.js b/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file-with-outFile.js index 81b5865a315cc..963062063e36d 100644 --- a/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file-with-outFile.js +++ b/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file-with-outFile.js @@ -1,6 +1,11 @@ Input:: //// [/user/username/projects/myproject/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; +import { something2 } from "./fileNotFound"; + +//// [/user/username/projects/myproject/src/anotherFileReusingResolution.ts] +import { something } from "./filePresent"; import { something2 } from "./fileNotFound"; //// [/user/username/projects/myproject/src/filePresent.ts] @@ -28,6 +33,7 @@ interface Array { length: number; [n: number]: T; } "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", "./src/main.ts" ] }, @@ -41,9 +47,13 @@ interface Array { length: number; [n: number]: T; } "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, - "./src/main.ts": { + "./src/anotherfilereusingresolution.ts": { "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false } }, "options": { @@ -55,6 +65,9 @@ interface Array { length: number; [n: number]: T; } "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -67,13 +80,13 @@ interface Array { length: number; [n: number]: T; } /a/lib/tsc.js --b . -w --extendedDiagnostics Output:: -[12:00:27 AM] Starting compilation in watch mode... +[12:00:29 AM] Starting compilation in watch mode... -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. @@ -81,26 +94,39 @@ File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ -[12:00:28 AM] Found 1 error. Watching for file changes. +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +[12:00:30 AM] Found 2 errors. Watching for file changes. FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Config file /user/username/projects/myproject/tsconfig.json DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/anotherFileReusingResolution.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/filePresent.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts No cached semantic diagnostics in the builder:: @@ -108,6 +134,8 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -127,19 +155,20 @@ Change:: Modify main file Input:: //// [/user/username/projects/myproject/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); Output:: FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -[12:00:31 AM] File change detected. Starting incremental compilation... +[12:00:33 AM] File change detected. Starting incremental compilation... -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. @@ -147,21 +176,33 @@ File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ -[12:00:35 AM] Found 1 error. Watching for file changes. +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something(); +   ~~~~~~~~~~~~~~~~ + +[12:00:37 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts No cached semantic diagnostics in the builder:: @@ -169,6 +210,8 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -188,6 +231,7 @@ exitCode:: ExitStatus.undefined "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", "./src/main.ts" ] }, @@ -201,8 +245,12 @@ exitCode:: ExitStatus.undefined "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false + }, "./src/main.ts": { - "version": "-22084070133-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "affectsGlobalScope": false } }, @@ -217,6 +265,9 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -232,6 +283,7 @@ Change:: Add new module and update main file Input:: //// [/user/username/projects/myproject/src/main.ts] import { foo } from "./newFile";import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); //// [/user/username/projects/myproject/src/newFile.ts] @@ -243,18 +295,14 @@ DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile. Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -[12:00:40 AM] File change detected. Starting incremental compilation... +[12:00:42 AM] File change detected. Starting incremental compilation... FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/newFile.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. -======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. @@ -262,21 +310,37 @@ File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. +======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ -[12:00:44 AM] Found 1 error. Watching for file changes. +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something(); +   ~~~~~~~~~~~~~~~~ + +[12:00:46 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts @@ -285,6 +349,8 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -306,6 +372,7 @@ exitCode:: ExitStatus.undefined "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", "./src/newFile.ts", "./src/main.ts" ] @@ -320,12 +387,16 @@ exitCode:: ExitStatus.undefined "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "affectsGlobalScope": false } }, @@ -340,6 +411,9 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts", "./src/newfile.ts" @@ -361,32 +435,39 @@ export function something2() { return 20; } Output:: DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -[12:00:47 AM] File change detected. Starting incremental compilation... +[12:00:49 AM] File change detected. Starting incremental compilation... FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileNotFound.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/user/username/projects/myproject/src/fileNotFound.ts' exist - use it as a name resolution result. +======== Module name './fileNotFound' was successfully resolved to '/user/username/projects/myproject/src/fileNotFound.ts'. ======== ======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== ======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== ======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' exist - use it as a name resolution result. +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. ======== Module name './fileNotFound' was successfully resolved to '/user/username/projects/myproject/src/fileNotFound.ts'. ======== -[12:00:55 AM] Found 0 errors. Watching for file changes. +[12:00:57 AM] Found 0 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts -/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/fileNotFound.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts @@ -395,6 +476,8 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -417,8 +500,9 @@ exitCode:: ExitStatus.undefined "bundle": { "commonSourceDirectory": "./", "sourceFiles": [ - "./src/fileNotFound.ts", "./src/filePresent.ts", + "./src/fileNotFound.ts", + "./src/anotherFileReusingResolution.ts", "./src/newFile.ts", "./src/main.ts" ], @@ -426,7 +510,7 @@ exitCode:: ExitStatus.undefined "sections": [ { "pos": 0, - "end": 888, + "end": 1038, "kind": "text" } ] @@ -435,7 +519,7 @@ exitCode:: ExitStatus.undefined "sections": [ { "pos": 0, - "end": 256, + "end": 310, "kind": "text" } ] @@ -447,12 +531,16 @@ exitCode:: ExitStatus.undefined "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", "affectsGlobalScope": true }, + "./src/filepresent.ts": { + "version": "11598859296-export function something() { return 10; }", + "affectsGlobalScope": false + }, "./src/filenotfound.ts": { "version": "-497034637-export function something2() { return 20; }", "affectsGlobalScope": false }, - "./src/filepresent.ts": { - "version": "11598859296-export function something() { return 10; }", + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "affectsGlobalScope": false }, "./src/newfile.ts": { @@ -460,7 +548,7 @@ exitCode:: ExitStatus.undefined "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "affectsGlobalScope": false } }, @@ -475,6 +563,10 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filenotfound.ts", + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filenotfound.ts", "./src/filepresent.ts", @@ -487,6 +579,13 @@ exitCode:: ExitStatus.undefined } //// [/user/username/projects/myproject/outFile.js] +define("src/filePresent", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.something = void 0; + function something() { return 10; } + exports.something = something; +}); define("src/fileNotFound", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -494,12 +593,9 @@ define("src/fileNotFound", ["require", "exports"], function (require, exports) { function something2() { return 20; } exports.something2 = something2; }); -define("src/filePresent", ["require", "exports"], function (require, exports) { +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; - exports.something = void 0; - function something() { return 10; } - exports.something = something; }); define("src/newFile", ["require", "exports"], function (require, exports) { "use strict"; @@ -516,12 +612,13 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, //// [/user/username/projects/myproject/outFile.d.ts] -declare module "src/fileNotFound" { - export function something2(): number; -} declare module "src/filePresent" { export function something(): number; } +declare module "src/fileNotFound" { + export function something2(): number; +} +declare module "src/anotherFileReusingResolution" { } declare module "src/newFile" { export function foo(): number; } diff --git a/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file.js b/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file.js index 1fb417222f854..6e3a6ccdbfad8 100644 --- a/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file.js +++ b/tests/baselines/reference/tsbuild/watchMode/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file.js @@ -1,6 +1,11 @@ Input:: //// [/user/username/projects/myproject/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; +import { something2 } from "./fileNotFound"; + +//// [/user/username/projects/myproject/src/anotherFileReusingResolution.ts] +import { something } from "./filePresent"; import { something2 } from "./fileNotFound"; //// [/user/username/projects/myproject/src/filePresent.ts] @@ -36,10 +41,15 @@ interface Array { length: number; [n: number]: T; } "signature": "-13601649692-export declare function something(): number;\n", "affectsGlobalScope": false }, - "./src/main.ts": { + "./src/anotherfilereusingresolution.ts": { "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "signature": "-3531856636-export {};\n", "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", + "affectsGlobalScope": false } }, "options": { @@ -50,6 +60,9 @@ interface Array { length: number; [n: number]: T; } "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -57,13 +70,26 @@ interface Array { length: number; [n: number]: T; } "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filepresent.ts", [ "./src/main.ts", [ { "file": "./src/main.ts", - "start": 70, + "start": 127, "length": 16, "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", "category": 1, @@ -73,6 +99,10 @@ interface Array { length: number; [n: number]: T; } ] ], "affectedFilesPendingEmit": [ + [ + "./src/anotherfilereusingresolution.ts", + 1 + ], [ "./src/filepresent.ts", 1 @@ -89,13 +119,13 @@ interface Array { length: number; [n: number]: T; } /a/lib/tsc.js --b . -w --extendedDiagnostics Output:: -[12:00:27 AM] Starting compilation in watch mode... +[12:00:29 AM] Starting compilation in watch mode... -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. @@ -103,26 +133,39 @@ File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ -[12:00:28 AM] Found 1 error. Watching for file changes. +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +[12:00:30 AM] Found 2 errors. Watching for file changes. FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Config file /user/username/projects/myproject/tsconfig.json DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/anotherFileReusingResolution.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/filePresent.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts Semantic diagnostics in builder refreshed for:: @@ -130,6 +173,8 @@ Semantic diagnostics in builder refreshed for:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -149,19 +194,20 @@ Change:: Modify main file Input:: //// [/user/username/projects/myproject/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); Output:: FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -[12:00:31 AM] File change detected. Starting incremental compilation... +[12:00:33 AM] File change detected. Starting incremental compilation... -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. @@ -169,21 +215,33 @@ File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -[12:00:35 AM] Found 1 error. Watching for file changes. +[12:00:37 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts Semantic diagnostics in builder refreshed for:: @@ -192,6 +250,8 @@ Semantic diagnostics in builder refreshed for:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -219,8 +279,13 @@ exitCode:: ExitStatus.undefined "signature": "-13601649692-export declare function something(): number;\n", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", + "affectsGlobalScope": false + }, "./src/main.ts": { - "version": "-22084070133-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "signature": "-3531856636-export {};\n", "affectsGlobalScope": false } @@ -235,6 +300,9 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -242,13 +310,26 @@ exitCode:: ExitStatus.undefined "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filepresent.ts", [ "./src/main.ts", [ { "file": "./src/main.ts", - "start": 70, + "start": 127, "length": 16, "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", "category": 1, @@ -258,6 +339,10 @@ exitCode:: ExitStatus.undefined ] ], "affectedFilesPendingEmit": [ + [ + "./src/anotherfilereusingresolution.ts", + 1 + ], [ "./src/filepresent.ts", 1 @@ -277,6 +362,7 @@ Change:: Add new module and update main file Input:: //// [/user/username/projects/myproject/src/main.ts] import { foo } from "./newFile";import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); //// [/user/username/projects/myproject/src/newFile.ts] @@ -288,18 +374,14 @@ DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile. Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -[12:00:40 AM] File change detected. Starting incremental compilation... +[12:00:42 AM] File change detected. Starting incremental compilation... FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/newFile.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. -======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. @@ -307,21 +389,37 @@ File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. +======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ -2 import { something2 } from "./fileNotFound";something(); +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -[12:00:44 AM] Found 1 error. Watching for file changes. +[12:00:46 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts @@ -332,6 +430,8 @@ Semantic diagnostics in builder refreshed for:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -361,13 +461,18 @@ exitCode:: ExitStatus.undefined "signature": "-13601649692-export declare function something(): number;\n", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "signature": "-4788605446-export declare function foo(): number;\n", "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "signature": "-3531856636-export {};\n", "affectsGlobalScope": false } @@ -382,6 +487,9 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts", "./src/newfile.ts" @@ -390,13 +498,26 @@ exitCode:: ExitStatus.undefined "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filepresent.ts", [ "./src/main.ts", [ { "file": "./src/main.ts", - "start": 102, + "start": 159, "length": 16, "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", "category": 1, @@ -407,6 +528,10 @@ exitCode:: ExitStatus.undefined "./src/newfile.ts" ], "affectedFilesPendingEmit": [ + [ + "./src/anotherfilereusingresolution.ts", + 1 + ], [ "./src/filepresent.ts", 1 @@ -435,21 +560,33 @@ export function something2() { return 20; } Output:: DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -[12:00:47 AM] File change detected. Starting incremental compilation... +[12:00:49 AM] File change detected. Starting incremental compilation... FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileNotFound.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/user/username/projects/myproject/src/fileNotFound.ts' exist - use it as a name resolution result. +======== Module name './fileNotFound' was successfully resolved to '/user/username/projects/myproject/src/fileNotFound.ts'. ======== ======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== ======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== ======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' exist - use it as a name resolution result. +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. ======== Module name './fileNotFound' was successfully resolved to '/user/username/projects/myproject/src/fileNotFound.ts'. ======== +DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/anotherFileReusingResolution.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json +Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/src/anotherFileReusingResolution.js +Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/anotherFileReusingResolution.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/anotherFileReusingResolution.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json +Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/anotherFileReusingResolution.d.ts +Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/anotherFileReusingResolution.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/filePresent.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/src/filePresent.js Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/filePresent.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json @@ -474,27 +611,31 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/fileNotFound.d.ts Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -[12:01:07 AM] Found 0 errors. Watching for file changes. +[12:01:13 AM] Found 0 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts -/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/fileNotFound.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts Semantic diagnostics in builder refreshed for:: /user/username/projects/myproject/src/fileNotFound.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -521,14 +662,19 @@ exitCode:: ExitStatus.undefined "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", "affectsGlobalScope": true }, + "./src/filepresent.ts": { + "version": "11598859296-export function something() { return 10; }", + "signature": "-13601649692-export declare function something(): number;\n", + "affectsGlobalScope": false + }, "./src/filenotfound.ts": { "version": "-497034637-export function something2() { return 20; }", "signature": "-14992185226-export declare function something2(): number;\n", "affectsGlobalScope": false }, - "./src/filepresent.ts": { - "version": "11598859296-export function something() { return 10; }", - "signature": "-13601649692-export declare function something(): number;\n", + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", "affectsGlobalScope": false }, "./src/newfile.ts": { @@ -537,7 +683,7 @@ exitCode:: ExitStatus.undefined "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "signature": "-3531856636-export {};\n", "affectsGlobalScope": false } @@ -552,6 +698,10 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filenotfound.ts", + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filenotfound.ts", "./src/filepresent.ts", @@ -561,6 +711,7 @@ exitCode:: ExitStatus.undefined "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", + "./src/anotherfilereusingresolution.ts", "./src/filenotfound.ts", "./src/filepresent.ts", "./src/main.ts", @@ -570,6 +721,17 @@ exitCode:: ExitStatus.undefined "version": "FakeTSVersion" } +//// [/user/username/projects/myproject/src/anotherFileReusingResolution.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); + + +//// [/user/username/projects/myproject/src/anotherFileReusingResolution.d.ts] +export {}; + + //// [/user/username/projects/myproject/src/filePresent.js] define(["require", "exports"], function (require, exports) { "use strict"; diff --git a/tests/baselines/reference/tsbuild/watchMode/persistResolutions/saves-resolution-and-uses-it-for-new-program-with-outFile.js b/tests/baselines/reference/tsbuild/watchMode/persistResolutions/saves-resolution-and-uses-it-for-new-program-with-outFile.js index 3b479dd6842e1..0c12c57caf4a0 100644 --- a/tests/baselines/reference/tsbuild/watchMode/persistResolutions/saves-resolution-and-uses-it-for-new-program-with-outFile.js +++ b/tests/baselines/reference/tsbuild/watchMode/persistResolutions/saves-resolution-and-uses-it-for-new-program-with-outFile.js @@ -1,6 +1,11 @@ Input:: //// [/user/username/projects/myproject/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; +import { something2 } from "./fileNotFound"; + +//// [/user/username/projects/myproject/src/anotherFileReusingResolution.ts] +import { something } from "./filePresent"; import { something2 } from "./fileNotFound"; //// [/user/username/projects/myproject/src/filePresent.ts] @@ -25,13 +30,13 @@ interface Array { length: number; [n: number]: T; } /a/lib/tsc.js --b . -w --extendedDiagnostics Output:: -[12:00:25 AM] Starting compilation in watch mode... +[12:00:27 AM] Starting compilation in watch mode... -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. @@ -39,26 +44,39 @@ File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ -[12:00:28 AM] Found 1 error. Watching for file changes. +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +[12:00:30 AM] Found 2 errors. Watching for file changes. FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Config file /user/username/projects/myproject/tsconfig.json DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/anotherFileReusingResolution.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/filePresent.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts No cached semantic diagnostics in the builder:: @@ -66,6 +84,8 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -85,6 +105,7 @@ exitCode:: ExitStatus.undefined "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", "./src/main.ts" ] }, @@ -98,9 +119,13 @@ exitCode:: ExitStatus.undefined "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, - "./src/main.ts": { + "./src/anotherfilereusingresolution.ts": { "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false } }, "options": { @@ -114,6 +139,9 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -129,19 +157,20 @@ Change:: Modify main file Input:: //// [/user/username/projects/myproject/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); Output:: FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -[12:00:31 AM] File change detected. Starting incremental compilation... +[12:00:33 AM] File change detected. Starting incremental compilation... -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. @@ -149,21 +178,33 @@ File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ -[12:00:35 AM] Found 1 error. Watching for file changes. +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something(); +   ~~~~~~~~~~~~~~~~ + +[12:00:37 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts No cached semantic diagnostics in the builder:: @@ -171,6 +212,8 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -190,6 +233,7 @@ exitCode:: ExitStatus.undefined "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", "./src/main.ts" ] }, @@ -203,8 +247,12 @@ exitCode:: ExitStatus.undefined "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false + }, "./src/main.ts": { - "version": "-22084070133-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "affectsGlobalScope": false } }, @@ -219,6 +267,9 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -234,6 +285,7 @@ Change:: Add new module and update main file Input:: //// [/user/username/projects/myproject/src/main.ts] import { foo } from "./newFile";import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); //// [/user/username/projects/myproject/src/newFile.ts] @@ -245,18 +297,14 @@ DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile. Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -[12:00:40 AM] File change detected. Starting incremental compilation... +[12:00:42 AM] File change detected. Starting incremental compilation... FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/newFile.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. -======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. @@ -264,21 +312,37 @@ File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. +======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ -[12:00:44 AM] Found 1 error. Watching for file changes. +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something(); +   ~~~~~~~~~~~~~~~~ + +[12:00:46 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts @@ -287,6 +351,8 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -308,6 +374,7 @@ exitCode:: ExitStatus.undefined "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", "./src/newFile.ts", "./src/main.ts" ] @@ -322,12 +389,16 @@ exitCode:: ExitStatus.undefined "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "affectsGlobalScope": false } }, @@ -342,6 +413,9 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts", "./src/newfile.ts" @@ -363,32 +437,39 @@ export function something2() { return 20; } Output:: DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -[12:00:47 AM] File change detected. Starting incremental compilation... +[12:00:49 AM] File change detected. Starting incremental compilation... FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileNotFound.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/user/username/projects/myproject/src/fileNotFound.ts' exist - use it as a name resolution result. +======== Module name './fileNotFound' was successfully resolved to '/user/username/projects/myproject/src/fileNotFound.ts'. ======== ======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== ======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== ======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' exist - use it as a name resolution result. +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. ======== Module name './fileNotFound' was successfully resolved to '/user/username/projects/myproject/src/fileNotFound.ts'. ======== -[12:00:55 AM] Found 0 errors. Watching for file changes. +[12:00:57 AM] Found 0 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts -/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/fileNotFound.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts @@ -397,6 +478,8 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -419,8 +502,9 @@ exitCode:: ExitStatus.undefined "bundle": { "commonSourceDirectory": "./", "sourceFiles": [ - "./src/fileNotFound.ts", "./src/filePresent.ts", + "./src/fileNotFound.ts", + "./src/anotherFileReusingResolution.ts", "./src/newFile.ts", "./src/main.ts" ], @@ -428,7 +512,7 @@ exitCode:: ExitStatus.undefined "sections": [ { "pos": 0, - "end": 888, + "end": 1038, "kind": "text" } ] @@ -437,7 +521,7 @@ exitCode:: ExitStatus.undefined "sections": [ { "pos": 0, - "end": 256, + "end": 310, "kind": "text" } ] @@ -449,12 +533,16 @@ exitCode:: ExitStatus.undefined "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", "affectsGlobalScope": true }, + "./src/filepresent.ts": { + "version": "11598859296-export function something() { return 10; }", + "affectsGlobalScope": false + }, "./src/filenotfound.ts": { "version": "-497034637-export function something2() { return 20; }", "affectsGlobalScope": false }, - "./src/filepresent.ts": { - "version": "11598859296-export function something() { return 10; }", + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "affectsGlobalScope": false }, "./src/newfile.ts": { @@ -462,7 +550,7 @@ exitCode:: ExitStatus.undefined "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "affectsGlobalScope": false } }, @@ -477,6 +565,10 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filenotfound.ts", + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filenotfound.ts", "./src/filepresent.ts", @@ -489,6 +581,13 @@ exitCode:: ExitStatus.undefined } //// [/user/username/projects/myproject/outFile.js] +define("src/filePresent", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.something = void 0; + function something() { return 10; } + exports.something = something; +}); define("src/fileNotFound", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -496,12 +595,9 @@ define("src/fileNotFound", ["require", "exports"], function (require, exports) { function something2() { return 20; } exports.something2 = something2; }); -define("src/filePresent", ["require", "exports"], function (require, exports) { +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; - exports.something = void 0; - function something() { return 10; } - exports.something = something; }); define("src/newFile", ["require", "exports"], function (require, exports) { "use strict"; @@ -518,12 +614,13 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, //// [/user/username/projects/myproject/outFile.d.ts] -declare module "src/fileNotFound" { - export function something2(): number; -} declare module "src/filePresent" { export function something(): number; } +declare module "src/fileNotFound" { + export function something2(): number; +} +declare module "src/anotherFileReusingResolution" { } declare module "src/newFile" { export function foo(): number; } diff --git a/tests/baselines/reference/tsbuild/watchMode/persistResolutions/saves-resolution-and-uses-it-for-new-program.js b/tests/baselines/reference/tsbuild/watchMode/persistResolutions/saves-resolution-and-uses-it-for-new-program.js index e0e32202f58e4..0b7033e4e0677 100644 --- a/tests/baselines/reference/tsbuild/watchMode/persistResolutions/saves-resolution-and-uses-it-for-new-program.js +++ b/tests/baselines/reference/tsbuild/watchMode/persistResolutions/saves-resolution-and-uses-it-for-new-program.js @@ -1,6 +1,11 @@ Input:: //// [/user/username/projects/myproject/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; +import { something2 } from "./fileNotFound"; + +//// [/user/username/projects/myproject/src/anotherFileReusingResolution.ts] +import { something } from "./filePresent"; import { something2 } from "./fileNotFound"; //// [/user/username/projects/myproject/src/filePresent.ts] @@ -25,13 +30,13 @@ interface Array { length: number; [n: number]: T; } /a/lib/tsc.js --b . -w --extendedDiagnostics Output:: -[12:00:25 AM] Starting compilation in watch mode... +[12:00:27 AM] Starting compilation in watch mode... -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. @@ -39,36 +44,52 @@ File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ -[12:00:28 AM] Found 1 error. Watching for file changes. +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +[12:00:30 AM] Found 2 errors. Watching for file changes. FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Config file /user/username/projects/myproject/tsconfig.json DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/anotherFileReusingResolution.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/filePresent.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts Semantic diagnostics in builder refreshed for:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -96,10 +117,15 @@ exitCode:: ExitStatus.undefined "signature": "-13601649692-export declare function something(): number;\n", "affectsGlobalScope": false }, - "./src/main.ts": { + "./src/anotherfilereusingresolution.ts": { "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "signature": "-3531856636-export {};\n", "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", + "affectsGlobalScope": false } }, "options": { @@ -112,6 +138,9 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -119,13 +148,26 @@ exitCode:: ExitStatus.undefined "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filepresent.ts", [ "./src/main.ts", [ { "file": "./src/main.ts", - "start": 70, + "start": 127, "length": 16, "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", "category": 1, @@ -135,6 +177,10 @@ exitCode:: ExitStatus.undefined ] ], "affectedFilesPendingEmit": [ + [ + "./src/anotherfilereusingresolution.ts", + 1 + ], [ "./src/filepresent.ts", 1 @@ -154,19 +200,20 @@ Change:: Modify main file Input:: //// [/user/username/projects/myproject/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); Output:: FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -[12:00:31 AM] File change detected. Starting incremental compilation... +[12:00:33 AM] File change detected. Starting incremental compilation... -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. @@ -174,21 +221,33 @@ File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -[12:00:35 AM] Found 1 error. Watching for file changes. +[12:00:37 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts Semantic diagnostics in builder refreshed for:: @@ -197,6 +256,8 @@ Semantic diagnostics in builder refreshed for:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -224,8 +285,13 @@ exitCode:: ExitStatus.undefined "signature": "-13601649692-export declare function something(): number;\n", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", + "affectsGlobalScope": false + }, "./src/main.ts": { - "version": "-22084070133-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "signature": "-3531856636-export {};\n", "affectsGlobalScope": false } @@ -240,6 +306,9 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -247,13 +316,26 @@ exitCode:: ExitStatus.undefined "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filepresent.ts", [ "./src/main.ts", [ { "file": "./src/main.ts", - "start": 70, + "start": 127, "length": 16, "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", "category": 1, @@ -263,6 +345,10 @@ exitCode:: ExitStatus.undefined ] ], "affectedFilesPendingEmit": [ + [ + "./src/anotherfilereusingresolution.ts", + 1 + ], [ "./src/filepresent.ts", 1 @@ -282,6 +368,7 @@ Change:: Add new module and update main file Input:: //// [/user/username/projects/myproject/src/main.ts] import { foo } from "./newFile";import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); //// [/user/username/projects/myproject/src/newFile.ts] @@ -293,18 +380,14 @@ DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile. Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -[12:00:40 AM] File change detected. Starting incremental compilation... +[12:00:42 AM] File change detected. Starting incremental compilation... FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/newFile.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json -======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. -======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. @@ -312,21 +395,37 @@ File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. +======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ -2 import { something2 } from "./fileNotFound";something(); +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -[12:00:44 AM] Found 1 error. Watching for file changes. +[12:00:46 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts @@ -337,6 +436,8 @@ Semantic diagnostics in builder refreshed for:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -366,13 +467,18 @@ exitCode:: ExitStatus.undefined "signature": "-13601649692-export declare function something(): number;\n", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "signature": "-4788605446-export declare function foo(): number;\n", "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "signature": "-3531856636-export {};\n", "affectsGlobalScope": false } @@ -387,6 +493,9 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts", "./src/newfile.ts" @@ -395,13 +504,26 @@ exitCode:: ExitStatus.undefined "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filepresent.ts", [ "./src/main.ts", [ { "file": "./src/main.ts", - "start": 102, + "start": 159, "length": 16, "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", "category": 1, @@ -412,6 +534,10 @@ exitCode:: ExitStatus.undefined "./src/newfile.ts" ], "affectedFilesPendingEmit": [ + [ + "./src/anotherfilereusingresolution.ts", + 1 + ], [ "./src/filepresent.ts", 1 @@ -440,20 +566,26 @@ export function something2() { return 20; } Output:: DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -[12:00:47 AM] File change detected. Starting incremental compilation... +[12:00:49 AM] File change detected. Starting incremental compilation... FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileNotFound.ts 250 undefined Source file /user/username/projects/myproject/tsconfig.json +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/user/username/projects/myproject/src/fileNotFound.ts' exist - use it as a name resolution result. +======== Module name './fileNotFound' was successfully resolved to '/user/username/projects/myproject/src/fileNotFound.ts'. ======== ======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== ======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== ======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/user/username/projects/myproject/src/fileNotFound.ts' exist - use it as a name resolution result. +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. ======== Module name './fileNotFound' was successfully resolved to '/user/username/projects/myproject/src/fileNotFound.ts'. ======== DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/filePresent.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/src/filePresent.js @@ -461,6 +593,12 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/filePresent.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/filePresent.d.ts Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/filePresent.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/anotherFileReusingResolution.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json +Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/src/anotherFileReusingResolution.js +Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/anotherFileReusingResolution.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/anotherFileReusingResolution.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json +Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/anotherFileReusingResolution.d.ts +Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/anotherFileReusingResolution.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/main.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/src/main.js Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/main.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json @@ -479,27 +617,31 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/fileNotFound.d.ts Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory /user/username/projects/myproject/tsconfig.json -[12:01:07 AM] Found 0 errors. Watching for file changes. +[12:01:13 AM] Found 0 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts -/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/fileNotFound.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts Semantic diagnostics in builder refreshed for:: /user/username/projects/myproject/src/fileNotFound.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -526,14 +668,19 @@ exitCode:: ExitStatus.undefined "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", "affectsGlobalScope": true }, + "./src/filepresent.ts": { + "version": "11598859296-export function something() { return 10; }", + "signature": "-13601649692-export declare function something(): number;\n", + "affectsGlobalScope": false + }, "./src/filenotfound.ts": { "version": "-497034637-export function something2() { return 20; }", "signature": "-14992185226-export declare function something2(): number;\n", "affectsGlobalScope": false }, - "./src/filepresent.ts": { - "version": "11598859296-export function something() { return 10; }", - "signature": "-13601649692-export declare function something(): number;\n", + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", "affectsGlobalScope": false }, "./src/newfile.ts": { @@ -542,7 +689,7 @@ exitCode:: ExitStatus.undefined "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "signature": "-3531856636-export {};\n", "affectsGlobalScope": false } @@ -557,6 +704,10 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filenotfound.ts", + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filenotfound.ts", "./src/filepresent.ts", @@ -566,6 +717,7 @@ exitCode:: ExitStatus.undefined "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", + "./src/anotherfilereusingresolution.ts", "./src/filenotfound.ts", "./src/filepresent.ts", "./src/main.ts", @@ -589,6 +741,17 @@ define(["require", "exports"], function (require, exports) { export declare function something(): number; +//// [/user/username/projects/myproject/src/anotherFileReusingResolution.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); + + +//// [/user/username/projects/myproject/src/anotherFileReusingResolution.d.ts] +export {}; + + //// [/user/username/projects/myproject/src/main.js] define(["require", "exports", "./filePresent"], function (require, exports, filePresent_1) { "use strict"; diff --git a/tests/baselines/reference/tsc/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program-with-outFile.js b/tests/baselines/reference/tsc/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program-with-outFile.js index 9cbc4d291fda8..553668e90d075 100644 --- a/tests/baselines/reference/tsc/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program-with-outFile.js +++ b/tests/baselines/reference/tsc/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program-with-outFile.js @@ -14,11 +14,16 @@ interface Array { length: number; [n: number]: T; } interface ReadonlyArray {} declare const console: { log(msg: any): void; }; +//// [/src/project/src/anotherFileReusingResolution.ts] +import { something } from "./filePresent"; +import { something2 } from "./fileNotFound"; + //// [/src/project/src/filePresent.ts] export function something() { return 10; } //// [/src/project/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound"; //// [/src/project/tsconfig.json] @@ -28,11 +33,11 @@ import { something2 } from "./fileNotFound"; Output:: /lib/tsc --p src/project -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/fileNotFound.ts' does not exist. File '/src/project/src/fileNotFound.tsx' does not exist. @@ -40,21 +45,33 @@ File '/src/project/src/fileNotFound.d.ts' does not exist. File '/src/project/src/fileNotFound.js' does not exist. File '/src/project/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/project/src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/src/project/src'. +======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ +src/project/src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + -Found 1 error. +Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated -Program root files: ["/src/project/src/filePresent.ts","/src/project/src/main.ts"] +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/src/project/outFile.js","project":"/src/project","configFilePath":"/src/project/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/main.ts No cached semantic diagnostics in the builder:: @@ -64,6 +81,7 @@ No cached semantic diagnostics in the builder:: declare module "src/filePresent" { export function something(): number; } +declare module "src/anotherFileReusingResolution" { } declare module "src/main" { } @@ -75,6 +93,10 @@ define("src/filePresent", ["require", "exports"], function (require, exports) { function something() { return 10; } exports.something = something; }); +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); define("src/main", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -87,13 +109,14 @@ define("src/main", ["require", "exports"], function (require, exports) { "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", "./src/main.ts" ], "js": { "sections": [ { "pos": 0, - "end": 377, + "end": 531, "kind": "text" } ] @@ -102,7 +125,7 @@ define("src/main", ["require", "exports"], function (require, exports) { "sections": [ { "pos": 0, - "end": 112, + "end": 167, "kind": "text" } ] @@ -118,9 +141,13 @@ define("src/main", ["require", "exports"], function (require, exports) { "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, - "./src/main.ts": { + "./src/anotherfilereusingresolution.ts": { "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false } }, "options": { @@ -133,6 +160,9 @@ define("src/main", ["require", "exports"], function (require, exports) { "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -146,7 +176,7 @@ define("src/main", ["require", "exports"], function (require, exports) { ====================================================================== File:: /src/project/outFile.js ---------------------------------------------------------------------- -text: (0-377) +text: (0-531) define("src/filePresent", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -154,6 +184,10 @@ define("src/filePresent", ["require", "exports"], function (require, exports) { function something() { return 10; } exports.something = something; }); +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); define("src/main", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -163,10 +197,11 @@ define("src/main", ["require", "exports"], function (require, exports) { ====================================================================== File:: /src/project/outFile.d.ts ---------------------------------------------------------------------- -text: (0-112) +text: (0-167) declare module "src/filePresent" { export function something(): number; } +declare module "src/anotherFileReusingResolution" { } declare module "src/main" { } ====================================================================== @@ -179,11 +214,11 @@ Input:: Output:: /lib/tsc --p src/project -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/fileNotFound.ts' does not exist. File '/src/project/src/fileNotFound.tsx' does not exist. @@ -191,21 +226,33 @@ File '/src/project/src/fileNotFound.d.ts' does not exist. File '/src/project/src/fileNotFound.js' does not exist. File '/src/project/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/project/src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/src/project/src'. +======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ +src/project/src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + -Found 1 error. +Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated -Program root files: ["/src/project/src/filePresent.ts","/src/project/src/main.ts"] +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/src/project/outFile.js","project":"/src/project","configFilePath":"/src/project/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/main.ts No cached semantic diagnostics in the builder:: @@ -221,17 +268,18 @@ Change:: Modify main file Input:: //// [/src/project/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); Output:: /lib/tsc --p src/project -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/fileNotFound.ts' does not exist. File '/src/project/src/fileNotFound.tsx' does not exist. @@ -239,21 +287,33 @@ File '/src/project/src/fileNotFound.d.ts' does not exist. File '/src/project/src/fileNotFound.js' does not exist. File '/src/project/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/project/src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/src/project/src'. +======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +src/project/src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -Found 1 error. +Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated -Program root files: ["/src/project/src/filePresent.ts","/src/project/src/main.ts"] +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/src/project/outFile.js","project":"/src/project","configFilePath":"/src/project/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/main.ts No cached semantic diagnostics in the builder:: @@ -268,6 +328,10 @@ define("src/filePresent", ["require", "exports"], function (require, exports) { function something() { return 10; } exports.something = something; }); +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); define("src/main", ["require", "exports", "src/filePresent"], function (require, exports, filePresent_1) { "use strict"; exports.__esModule = true; @@ -281,13 +345,14 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", "./src/main.ts" ], "js": { "sections": [ { "pos": 0, - "end": 443, + "end": 597, "kind": "text" } ] @@ -296,7 +361,7 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "sections": [ { "pos": 0, - "end": 112, + "end": 167, "kind": "text" } ] @@ -312,8 +377,12 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false + }, "./src/main.ts": { - "version": "-22084070133-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "affectsGlobalScope": false } }, @@ -327,6 +396,9 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -340,7 +412,7 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, ====================================================================== File:: /src/project/outFile.js ---------------------------------------------------------------------- -text: (0-443) +text: (0-597) define("src/filePresent", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -348,6 +420,10 @@ define("src/filePresent", ["require", "exports"], function (require, exports) { function something() { return 10; } exports.something = something; }); +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); define("src/main", ["require", "exports", "src/filePresent"], function (require, exports, filePresent_1) { "use strict"; exports.__esModule = true; @@ -358,10 +434,11 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, ====================================================================== File:: /src/project/outFile.d.ts ---------------------------------------------------------------------- -text: (0-112) +text: (0-167) declare module "src/filePresent" { export function something(): number; } +declare module "src/anotherFileReusingResolution" { } declare module "src/main" { } ====================================================================== @@ -372,6 +449,7 @@ Change:: Add new module and update main file Input:: //// [/src/project/src/main.ts] import { foo } from "./newFile";import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); //// [/src/project/src/newFile.ts] @@ -381,15 +459,11 @@ export function foo() { return 20; } Output:: /lib/tsc --p src/project -======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/newFile.ts' exist - use it as a name resolution result. -======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/fileNotFound.ts' does not exist. File '/src/project/src/fileNotFound.tsx' does not exist. @@ -397,21 +471,37 @@ File '/src/project/src/fileNotFound.d.ts' does not exist. File '/src/project/src/fileNotFound.js' does not exist. File '/src/project/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/project/src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/src/project/src/newFile.ts' exist - use it as a name resolution result. +======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== +======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/src/project/src'. +======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ -2 import { something2 } from "./fileNotFound";something(); +src/project/src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -Found 1 error. +Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated -Program root files: ["/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/src/project/outFile.js","project":"/src/project","configFilePath":"/src/project/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/newFile.ts /src/project/src/main.ts @@ -422,6 +512,7 @@ No cached semantic diagnostics in the builder:: declare module "src/filePresent" { export function something(): number; } +declare module "src/anotherFileReusingResolution" { } declare module "src/newFile" { export function foo(): number; } @@ -436,6 +527,10 @@ define("src/filePresent", ["require", "exports"], function (require, exports) { function something() { return 10; } exports.something = something; }); +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); define("src/newFile", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -456,6 +551,7 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", "./src/newFile.ts", "./src/main.ts" ], @@ -463,7 +559,7 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "sections": [ { "pos": 0, - "end": 662, + "end": 816, "kind": "text" } ] @@ -472,7 +568,7 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "sections": [ { "pos": 0, - "end": 183, + "end": 238, "kind": "text" } ] @@ -488,12 +584,16 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "affectsGlobalScope": false } }, @@ -507,6 +607,9 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts", "./src/newfile.ts" @@ -521,7 +624,7 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, ====================================================================== File:: /src/project/outFile.js ---------------------------------------------------------------------- -text: (0-662) +text: (0-816) define("src/filePresent", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -529,6 +632,10 @@ define("src/filePresent", ["require", "exports"], function (require, exports) { function something() { return 10; } exports.something = something; }); +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); define("src/newFile", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -546,10 +653,11 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, ====================================================================== File:: /src/project/outFile.d.ts ---------------------------------------------------------------------- -text: (0-183) +text: (0-238) declare module "src/filePresent" { export function something(): number; } +declare module "src/anotherFileReusingResolution" { } declare module "src/newFile" { export function foo(): number; } @@ -568,26 +676,33 @@ export function something2() { return 20; } Output:: /lib/tsc --p src/project +======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. +======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/src/project/src/fileNotFound.ts' exist - use it as a name resolution result. +======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== ======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== ======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. +Resolution for module './filePresent' was found in cache from location '/src/project/src'. ======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== ======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' exist - use it as a name resolution result. +Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. ======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== exitCode:: ExitStatus.Success -Program root files: ["/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/src/project/outFile.js","project":"/src/project","configFilePath":"/src/project/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts -/src/project/src/fileNotFound.ts /src/project/src/filePresent.ts +/src/project/src/fileNotFound.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/newFile.ts /src/project/src/main.ts @@ -595,12 +710,13 @@ No cached semantic diagnostics in the builder:: //// [/src/project/outFile.d.ts] -declare module "src/fileNotFound" { - export function something2(): number; -} declare module "src/filePresent" { export function something(): number; } +declare module "src/fileNotFound" { + export function something2(): number; +} +declare module "src/anotherFileReusingResolution" { } declare module "src/newFile" { export function foo(): number; } @@ -608,6 +724,13 @@ declare module "src/main" { } //// [/src/project/outFile.js] +define("src/filePresent", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.something = void 0; + function something() { return 10; } + exports.something = something; +}); define("src/fileNotFound", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -615,12 +738,9 @@ define("src/fileNotFound", ["require", "exports"], function (require, exports) { function something2() { return 20; } exports.something2 = something2; }); -define("src/filePresent", ["require", "exports"], function (require, exports) { +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; - exports.something = void 0; - function something() { return 10; } - exports.something = something; }); define("src/newFile", ["require", "exports"], function (require, exports) { "use strict"; @@ -641,8 +761,9 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "bundle": { "commonSourceDirectory": "./", "sourceFiles": [ - "./src/fileNotFound.ts", "./src/filePresent.ts", + "./src/fileNotFound.ts", + "./src/anotherFileReusingResolution.ts", "./src/newFile.ts", "./src/main.ts" ], @@ -650,7 +771,7 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "sections": [ { "pos": 0, - "end": 914, + "end": 1068, "kind": "text" } ] @@ -659,7 +780,7 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "sections": [ { "pos": 0, - "end": 266, + "end": 321, "kind": "text" } ] @@ -671,12 +792,16 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", "affectsGlobalScope": true }, + "./src/filepresent.ts": { + "version": "11598859296-export function something() { return 10; }", + "affectsGlobalScope": false + }, "./src/filenotfound.ts": { "version": "-497034637-export function something2() { return 20; }", "affectsGlobalScope": false }, - "./src/filepresent.ts": { - "version": "11598859296-export function something() { return 10; }", + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "affectsGlobalScope": false }, "./src/newfile.ts": { @@ -684,7 +809,7 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "affectsGlobalScope": false } }, @@ -698,6 +823,10 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filenotfound.ts", + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filenotfound.ts", "./src/filepresent.ts", @@ -713,7 +842,14 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, ====================================================================== File:: /src/project/outFile.js ---------------------------------------------------------------------- -text: (0-914) +text: (0-1068) +define("src/filePresent", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.something = void 0; + function something() { return 10; } + exports.something = something; +}); define("src/fileNotFound", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -721,12 +857,9 @@ define("src/fileNotFound", ["require", "exports"], function (require, exports) { function something2() { return 20; } exports.something2 = something2; }); -define("src/filePresent", ["require", "exports"], function (require, exports) { +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; - exports.something = void 0; - function something() { return 10; } - exports.something = something; }); define("src/newFile", ["require", "exports"], function (require, exports) { "use strict"; @@ -745,13 +878,14 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, ====================================================================== File:: /src/project/outFile.d.ts ---------------------------------------------------------------------- -text: (0-266) -declare module "src/fileNotFound" { - export function something2(): number; -} +text: (0-321) declare module "src/filePresent" { export function something(): number; } +declare module "src/fileNotFound" { + export function something2(): number; +} +declare module "src/anotherFileReusingResolution" { } declare module "src/newFile" { export function foo(): number; } @@ -779,26 +913,33 @@ Input:: Output:: /lib/tsc --p src/project +======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. +======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/src/project/src/fileNotFound.ts' exist - use it as a name resolution result. +======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== ======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== ======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. +Resolution for module './filePresent' was found in cache from location '/src/project/src'. ======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== ======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' exist - use it as a name resolution result. +Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. ======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== exitCode:: ExitStatus.Success -Program root files: ["/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/src/project/outFile.js","project":"/src/project","configFilePath":"/src/project/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts -/src/project/src/fileNotFound.ts /src/project/src/filePresent.ts +/src/project/src/fileNotFound.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/newFile.ts /src/project/src/main.ts @@ -815,32 +956,40 @@ Change:: Modify main file Input:: //// [/src/project/src/main.ts] import { foo } from "./newFile";import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something();something(); Output:: /lib/tsc --p src/project +======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. +======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/src/project/src/fileNotFound.ts' exist - use it as a name resolution result. +======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== ======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== ======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. +Resolution for module './filePresent' was found in cache from location '/src/project/src'. ======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== ======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' exist - use it as a name resolution result. +Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. ======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== exitCode:: ExitStatus.Success -Program root files: ["/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/src/project/outFile.js","project":"/src/project","configFilePath":"/src/project/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts -/src/project/src/fileNotFound.ts /src/project/src/filePresent.ts +/src/project/src/fileNotFound.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/newFile.ts /src/project/src/main.ts @@ -849,6 +998,13 @@ No cached semantic diagnostics in the builder:: //// [/src/project/outFile.d.ts] file written with same contents //// [/src/project/outFile.js] +define("src/filePresent", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.something = void 0; + function something() { return 10; } + exports.something = something; +}); define("src/fileNotFound", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -856,12 +1012,9 @@ define("src/fileNotFound", ["require", "exports"], function (require, exports) { function something2() { return 20; } exports.something2 = something2; }); -define("src/filePresent", ["require", "exports"], function (require, exports) { +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; - exports.something = void 0; - function something() { return 10; } - exports.something = something; }); define("src/newFile", ["require", "exports"], function (require, exports) { "use strict"; @@ -883,8 +1036,9 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "bundle": { "commonSourceDirectory": "./", "sourceFiles": [ - "./src/fileNotFound.ts", "./src/filePresent.ts", + "./src/fileNotFound.ts", + "./src/anotherFileReusingResolution.ts", "./src/newFile.ts", "./src/main.ts" ], @@ -892,7 +1046,7 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "sections": [ { "pos": 0, - "end": 946, + "end": 1100, "kind": "text" } ] @@ -901,7 +1055,7 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "sections": [ { "pos": 0, - "end": 266, + "end": 321, "kind": "text" } ] @@ -913,12 +1067,16 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", "affectsGlobalScope": true }, + "./src/filepresent.ts": { + "version": "11598859296-export function something() { return 10; }", + "affectsGlobalScope": false + }, "./src/filenotfound.ts": { "version": "-497034637-export function something2() { return 20; }", "affectsGlobalScope": false }, - "./src/filepresent.ts": { - "version": "11598859296-export function something() { return 10; }", + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "affectsGlobalScope": false }, "./src/newfile.ts": { @@ -926,7 +1084,7 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "affectsGlobalScope": false }, "./src/main.ts": { - "version": "992573078-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();something();", + "version": "26360741061-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();something();", "affectsGlobalScope": false } }, @@ -940,6 +1098,10 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filenotfound.ts", + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filenotfound.ts", "./src/filepresent.ts", @@ -955,7 +1117,14 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, ====================================================================== File:: /src/project/outFile.js ---------------------------------------------------------------------- -text: (0-946) +text: (0-1100) +define("src/filePresent", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.something = void 0; + function something() { return 10; } + exports.something = something; +}); define("src/fileNotFound", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -963,12 +1132,9 @@ define("src/fileNotFound", ["require", "exports"], function (require, exports) { function something2() { return 20; } exports.something2 = something2; }); -define("src/filePresent", ["require", "exports"], function (require, exports) { +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; - exports.something = void 0; - function something() { return 10; } - exports.something = something; }); define("src/newFile", ["require", "exports"], function (require, exports) { "use strict"; @@ -988,13 +1154,14 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, ====================================================================== File:: /src/project/outFile.d.ts ---------------------------------------------------------------------- -text: (0-266) -declare module "src/fileNotFound" { - export function something2(): number; -} +text: (0-321) declare module "src/filePresent" { export function something(): number; } +declare module "src/fileNotFound" { + export function something2(): number; +} +declare module "src/anotherFileReusingResolution" { } declare module "src/newFile" { export function foo(): number; } diff --git a/tests/baselines/reference/tsc/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program.js b/tests/baselines/reference/tsc/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program.js index 0c8f27b15c5e4..6c341e45dbc53 100644 --- a/tests/baselines/reference/tsc/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program.js +++ b/tests/baselines/reference/tsc/persistResolutions/initial-build/saves-resolution-and-uses-it-for-new-program.js @@ -14,11 +14,16 @@ interface Array { length: number; [n: number]: T; } interface ReadonlyArray {} declare const console: { log(msg: any): void; }; +//// [/src/project/src/anotherFileReusingResolution.ts] +import { something } from "./filePresent"; +import { something2 } from "./fileNotFound"; + //// [/src/project/src/filePresent.ts] export function something() { return 10; } //// [/src/project/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound"; //// [/src/project/tsconfig.json] @@ -28,11 +33,11 @@ import { something2 } from "./fileNotFound"; Output:: /lib/tsc --p src/project -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/fileNotFound.ts' does not exist. File '/src/project/src/fileNotFound.tsx' does not exist. @@ -40,29 +45,53 @@ File '/src/project/src/fileNotFound.d.ts' does not exist. File '/src/project/src/fileNotFound.js' does not exist. File '/src/project/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/project/src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/src/project/src'. +======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ +src/project/src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + -Found 1 error. +Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated -Program root files: ["/src/project/src/filePresent.ts","/src/project/src/main.ts"] +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/src/project","configFilePath":"/src/project/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/main.ts Semantic diagnostics in builder refreshed for:: /lib/lib.d.ts /src/project/src/filePresent.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/main.ts +//// [/src/project/src/anotherFileReusingResolution.d.ts] +export {}; + + +//// [/src/project/src/anotherFileReusingResolution.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); + + //// [/src/project/src/filePresent.d.ts] export declare function something(): number; @@ -102,10 +131,15 @@ define(["require", "exports"], function (require, exports) { "signature": "-15062742831-export declare function something(): number;\r\n", "affectsGlobalScope": false }, - "./src/main.ts": { + "./src/anotherfilereusingresolution.ts": { "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "signature": "-4882119183-export {};\r\n", "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false } }, "options": { @@ -117,6 +151,9 @@ define(["require", "exports"], function (require, exports) { "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -124,13 +161,26 @@ define(["require", "exports"], function (require, exports) { "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filepresent.ts", [ "./src/main.ts", [ { "file": "./src/main.ts", - "start": 70, + "start": 127, "length": 16, "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", "category": 1, @@ -151,11 +201,11 @@ Input:: Output:: /lib/tsc --p src/project -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/fileNotFound.ts' does not exist. File '/src/project/src/fileNotFound.tsx' does not exist. @@ -163,21 +213,33 @@ File '/src/project/src/fileNotFound.d.ts' does not exist. File '/src/project/src/fileNotFound.js' does not exist. File '/src/project/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/project/src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/src/project/src'. +======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ +src/project/src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + -Found 1 error. +Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated -Program root files: ["/src/project/src/filePresent.ts","/src/project/src/main.ts"] +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/src/project","configFilePath":"/src/project/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/main.ts Semantic diagnostics in builder refreshed for:: @@ -189,17 +251,18 @@ Change:: Modify main file Input:: //// [/src/project/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); Output:: /lib/tsc --p src/project -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/fileNotFound.ts' does not exist. File '/src/project/src/fileNotFound.tsx' does not exist. @@ -207,21 +270,33 @@ File '/src/project/src/fileNotFound.d.ts' does not exist. File '/src/project/src/fileNotFound.js' does not exist. File '/src/project/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/project/src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/src/project/src'. +======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +src/project/src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -Found 1 error. +Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated -Program root files: ["/src/project/src/filePresent.ts","/src/project/src/main.ts"] +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/src/project","configFilePath":"/src/project/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/main.ts Semantic diagnostics in builder refreshed for:: @@ -251,8 +326,13 @@ define(["require", "exports", "./filePresent"], function (require, exports, file "signature": "-15062742831-export declare function something(): number;\r\n", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, "./src/main.ts": { - "version": "-22084070133-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "signature": "-4882119183-export {};\r\n", "affectsGlobalScope": false } @@ -266,6 +346,9 @@ define(["require", "exports", "./filePresent"], function (require, exports, file "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -273,13 +356,26 @@ define(["require", "exports", "./filePresent"], function (require, exports, file "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filepresent.ts", [ "./src/main.ts", [ { "file": "./src/main.ts", - "start": 70, + "start": 127, "length": 16, "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", "category": 1, @@ -298,6 +394,7 @@ Change:: Add new module and update main file Input:: //// [/src/project/src/main.ts] import { foo } from "./newFile";import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); //// [/src/project/src/newFile.ts] @@ -307,15 +404,11 @@ export function foo() { return 20; } Output:: /lib/tsc --p src/project -======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/newFile.ts' exist - use it as a name resolution result. -======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== -======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/fileNotFound.ts' does not exist. File '/src/project/src/fileNotFound.tsx' does not exist. @@ -323,21 +416,37 @@ File '/src/project/src/fileNotFound.d.ts' does not exist. File '/src/project/src/fileNotFound.js' does not exist. File '/src/project/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== -src/project/src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/src/project/src/newFile.ts' exist - use it as a name resolution result. +======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== +======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/src/project/src'. +======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. +======== Module name './fileNotFound' was not resolved. ======== +src/project/src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ +src/project/src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -Found 1 error. +3 import { something2 } from "./fileNotFound";something(); +   ~~~~~~~~~~~~~~~~ + + +Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated -Program root files: ["/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/src/project","configFilePath":"/src/project/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts /src/project/src/filePresent.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/newFile.ts /src/project/src/main.ts @@ -376,13 +485,18 @@ define(["require", "exports"], function (require, exports) { "signature": "-15062742831-export declare function something(): number;\r\n", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "signature": "-3405156953-export declare function foo(): number;\r\n", "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "signature": "-4882119183-export {};\r\n", "affectsGlobalScope": false } @@ -396,6 +510,9 @@ define(["require", "exports"], function (require, exports) { "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts", "./src/newfile.ts" @@ -404,13 +521,26 @@ define(["require", "exports"], function (require, exports) { "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filepresent.ts", [ "./src/main.ts", [ { "file": "./src/main.ts", - "start": 102, + "start": 159, "length": 16, "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", "category": 1, @@ -435,34 +565,44 @@ export function something2() { return 20; } Output:: /lib/tsc --p src/project +======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. +======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/src/project/src/fileNotFound.ts' exist - use it as a name resolution result. +======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== ======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== ======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. +Resolution for module './filePresent' was found in cache from location '/src/project/src'. ======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== ======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' exist - use it as a name resolution result. +Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. ======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== exitCode:: ExitStatus.Success -Program root files: ["/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/src/project","configFilePath":"/src/project/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts -/src/project/src/fileNotFound.ts /src/project/src/filePresent.ts +/src/project/src/fileNotFound.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/newFile.ts /src/project/src/main.ts Semantic diagnostics in builder refreshed for:: /src/project/src/fileNotFound.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/main.ts +//// [/src/project/src/anotherFileReusingResolution.d.ts] file written with same contents +//// [/src/project/src/anotherFileReusingResolution.js] file written with same contents //// [/src/project/src/fileNotFound.d.ts] export declare function something2(): number; @@ -488,14 +628,19 @@ define(["require", "exports"], function (require, exports) { "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", "affectsGlobalScope": true }, + "./src/filepresent.ts": { + "version": "11598859296-export function something() { return 10; }", + "signature": "-15062742831-export declare function something(): number;\r\n", + "affectsGlobalScope": false + }, "./src/filenotfound.ts": { "version": "-497034637-export function something2() { return 20; }", "signature": "-13705775197-export declare function something2(): number;\r\n", "affectsGlobalScope": false }, - "./src/filepresent.ts": { - "version": "11598859296-export function something() { return 10; }", - "signature": "-15062742831-export declare function something(): number;\r\n", + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-4882119183-export {};\r\n", "affectsGlobalScope": false }, "./src/newfile.ts": { @@ -504,7 +649,7 @@ define(["require", "exports"], function (require, exports) { "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "signature": "-4882119183-export {};\r\n", "affectsGlobalScope": false } @@ -518,6 +663,10 @@ define(["require", "exports"], function (require, exports) { "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filenotfound.ts", + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filenotfound.ts", "./src/filepresent.ts", @@ -527,6 +676,7 @@ define(["require", "exports"], function (require, exports) { "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../lib/lib.d.ts", + "./src/anotherfilereusingresolution.ts", "./src/filenotfound.ts", "./src/filepresent.ts", "./src/main.ts", @@ -556,26 +706,33 @@ Input:: Output:: /lib/tsc --p src/project +======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. +======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/src/project/src/fileNotFound.ts' exist - use it as a name resolution result. +======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== ======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== ======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. +Resolution for module './filePresent' was found in cache from location '/src/project/src'. ======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== ======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' exist - use it as a name resolution result. +Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. ======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== exitCode:: ExitStatus.Success -Program root files: ["/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/src/project","configFilePath":"/src/project/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts -/src/project/src/fileNotFound.ts /src/project/src/filePresent.ts +/src/project/src/fileNotFound.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/newFile.ts /src/project/src/main.ts @@ -588,32 +745,40 @@ Change:: Modify main file Input:: //// [/src/project/src/main.ts] import { foo } from "./newFile";import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something();something(); Output:: /lib/tsc --p src/project +======== Resolving module './filePresent' from '/src/project/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. +======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/src/project/src/anotherFileReusingResolution.ts'. ======== +Module resolution kind is not specified, using 'Classic'. +File '/src/project/src/fileNotFound.ts' exist - use it as a name resolution result. +======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== ======== Resolving module './newFile' from '/src/project/src/main.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/src/project/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/src/project/src/newFile.ts'. ======== ======== Resolving module './filePresent' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/filePresent.ts' exist - use it as a name resolution result. +Resolution for module './filePresent' was found in cache from location '/src/project/src'. ======== Module name './filePresent' was successfully resolved to '/src/project/src/filePresent.ts'. ======== ======== Resolving module './fileNotFound' from '/src/project/src/main.ts'. ======== -Module resolution kind is not specified, using 'Classic'. -File '/src/project/src/fileNotFound.ts' exist - use it as a name resolution result. +Resolution for module './fileNotFound' was found in cache from location '/src/project/src'. ======== Module name './fileNotFound' was successfully resolved to '/src/project/src/fileNotFound.ts'. ======== exitCode:: ExitStatus.Success -Program root files: ["/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] +Program root files: ["/src/project/src/anotherFileReusingResolution.ts","/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/src/project","configFilePath":"/src/project/tsconfig.json"} Program structureReused: Not Program files:: /lib/lib.d.ts -/src/project/src/fileNotFound.ts /src/project/src/filePresent.ts +/src/project/src/fileNotFound.ts +/src/project/src/anotherFileReusingResolution.ts /src/project/src/newFile.ts /src/project/src/main.ts @@ -640,14 +805,19 @@ define(["require", "exports", "./filePresent"], function (require, exports, file "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", "affectsGlobalScope": true }, + "./src/filepresent.ts": { + "version": "11598859296-export function something() { return 10; }", + "signature": "-15062742831-export declare function something(): number;\r\n", + "affectsGlobalScope": false + }, "./src/filenotfound.ts": { "version": "-497034637-export function something2() { return 20; }", "signature": "-13705775197-export declare function something2(): number;\r\n", "affectsGlobalScope": false }, - "./src/filepresent.ts": { - "version": "11598859296-export function something() { return 10; }", - "signature": "-15062742831-export declare function something(): number;\r\n", + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-4882119183-export {};\r\n", "affectsGlobalScope": false }, "./src/newfile.ts": { @@ -656,7 +826,7 @@ define(["require", "exports", "./filePresent"], function (require, exports, file "affectsGlobalScope": false }, "./src/main.ts": { - "version": "992573078-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();something();", + "version": "26360741061-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();something();", "signature": "-4882119183-export {};\r\n", "affectsGlobalScope": false } @@ -670,6 +840,10 @@ define(["require", "exports", "./filePresent"], function (require, exports, file "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filenotfound.ts", + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filenotfound.ts", "./src/filepresent.ts", @@ -679,6 +853,7 @@ define(["require", "exports", "./filePresent"], function (require, exports, file "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../lib/lib.d.ts", + "./src/anotherfilereusingresolution.ts", "./src/filenotfound.ts", "./src/filepresent.ts", "./src/main.ts", diff --git a/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-are-cleaned-with-outFile.js b/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-are-cleaned-with-outFile.js index ade89e086808b..aca62567e856c 100644 --- a/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-are-cleaned-with-outFile.js +++ b/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-are-cleaned-with-outFile.js @@ -1,6 +1,11 @@ Input:: //// [/user/username/projects/myproject/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; +import { something2 } from "./fileNotFound"; + +//// [/user/username/projects/myproject/src/anotherFileReusingResolution.ts] +import { something } from "./filePresent"; import { something2 } from "./fileNotFound"; //// [/user/username/projects/myproject/src/filePresent.ts] @@ -30,6 +35,10 @@ define("src/filePresent", ["require", "exports"], function (require, exports) { function something() { return 10; } exports.something = something; }); +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); define("src/main", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -40,6 +49,7 @@ define("src/main", ["require", "exports"], function (require, exports) { declare module "src/filePresent" { export function something(): number; } +declare module "src/anotherFileReusingResolution" { } declare module "src/main" { } @@ -49,13 +59,14 @@ declare module "src/main" { } "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", "./src/main.ts" ], "js": { "sections": [ { "pos": 0, - "end": 366, + "end": 516, "kind": "text" } ] @@ -64,7 +75,7 @@ declare module "src/main" { } "sections": [ { "pos": 0, - "end": 108, + "end": 162, "kind": "text" } ] @@ -80,9 +91,13 @@ declare module "src/main" { } "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, - "./src/main.ts": { + "./src/anotherfilereusingresolution.ts": { "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false } }, "options": { @@ -95,6 +110,9 @@ declare module "src/main" { } "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -107,21 +125,20 @@ declare module "src/main" { } /a/lib/tsc.js --p . -w --extendedDiagnostics Output:: -[12:00:34 AM] Starting compilation in watch mode... +[12:00:36 AM] Starting compilation in watch mode... Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Config file Synchronizing program CreatingProgramWith:: - roots: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] + roots: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/filePresent.ts 250 undefined Source file -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/anotherFileReusingResolution.ts 250 undefined Source file +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. @@ -129,26 +146,43 @@ File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/filePresent.ts 250 undefined Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './fileNotFound' was not resolved. ======== FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 undefined Source file DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ -[12:00:44 AM] Found 1 error. Watching for file changes. +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +[12:00:46 AM] Found 2 errors. Watching for file changes. DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts No cached semantic diagnostics in the builder:: @@ -156,6 +190,8 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -181,13 +217,14 @@ exitCode:: ExitStatus.undefined "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", "./src/main.ts" ], "js": { "sections": [ { "pos": 0, - "end": 366, + "end": 516, "kind": "text" } ] @@ -196,7 +233,7 @@ exitCode:: ExitStatus.undefined "sections": [ { "pos": 0, - "end": 108, + "end": 162, "kind": "text" } ] @@ -212,9 +249,13 @@ exitCode:: ExitStatus.undefined "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, - "./src/main.ts": { + "./src/anotherfilereusingresolution.ts": { "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false } }, "options": { @@ -229,6 +270,9 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -244,6 +288,7 @@ Change:: Modify main file Input:: //// [/user/username/projects/myproject/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); @@ -251,29 +296,36 @@ Output:: FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file Scheduling update Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file -[12:00:47 AM] File change detected. Starting incremental compilation... +[12:00:49 AM] File change detected. Starting incremental compilation... Synchronizing program CreatingProgramWith:: - roots: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] + roots: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -[12:00:57 AM] Found 1 error. Watching for file changes. +[12:00:59 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Completely Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts No cached semantic diagnostics in the builder:: @@ -281,6 +333,8 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -306,6 +360,10 @@ define("src/filePresent", ["require", "exports"], function (require, exports) { function something() { return 10; } exports.something = something; }); +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); define("src/main", ["require", "exports", "src/filePresent"], function (require, exports, filePresent_1) { "use strict"; exports.__esModule = true; @@ -320,13 +378,14 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", "./src/main.ts" ], "js": { "sections": [ { "pos": 0, - "end": 431, + "end": 581, "kind": "text" } ] @@ -335,7 +394,7 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "sections": [ { "pos": 0, - "end": 108, + "end": 162, "kind": "text" } ] @@ -351,8 +410,12 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false + }, "./src/main.ts": { - "version": "-22084070133-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "affectsGlobalScope": false } }, @@ -368,6 +431,9 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -383,6 +449,7 @@ Change:: Add new module and update main file Input:: //// [/user/username/projects/myproject/src/main.ts] import { foo } from "./newFile";import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); //// [/user/username/projects/myproject/src/newFile.ts] @@ -396,13 +463,16 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file Scheduling update Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file -[12:01:02 AM] File change detected. Starting incremental compilation... +[12:01:04 AM] File change detected. Starting incremental compilation... Reloading new file names and options Synchronizing program CreatingProgramWith:: - roots: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] + roots: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was not resolved. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. ======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== @@ -410,21 +480,27 @@ Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/newFile.ts 250 undefined Source file -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -[12:01:12 AM] Found 1 error. Watching for file changes. +[12:01:14 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: SafeModules Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts @@ -433,6 +509,8 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -460,6 +538,10 @@ define("src/filePresent", ["require", "exports"], function (require, exports) { function something() { return 10; } exports.something = something; }); +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); define("src/newFile", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -478,6 +560,7 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, declare module "src/filePresent" { export function something(): number; } +declare module "src/anotherFileReusingResolution" { } declare module "src/newFile" { export function foo(): number; } @@ -490,6 +573,7 @@ declare module "src/main" { } "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", "./src/newFile.ts", "./src/main.ts" ], @@ -497,7 +581,7 @@ declare module "src/main" { } "sections": [ { "pos": 0, - "end": 643, + "end": 793, "kind": "text" } ] @@ -506,7 +590,7 @@ declare module "src/main" { } "sections": [ { "pos": 0, - "end": 176, + "end": 230, "kind": "text" } ] @@ -522,12 +606,16 @@ declare module "src/main" { } "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "affectsGlobalScope": false } }, @@ -543,6 +631,9 @@ declare module "src/main" { } "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts", "./src/newfile.ts" @@ -565,33 +656,42 @@ Output:: DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory Scheduling update Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory -[12:01:15 AM] File change detected. Starting incremental compilation... +[12:01:17 AM] File change detected. Starting incremental compilation... Reloading new file names and options Synchronizing program CreatingProgramWith:: - roots: ["/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] + roots: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was not resolved. FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileNotFound.ts 250 undefined Source file Reusing resolution of module './newFile' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ -[12:01:25 AM] Found 1 error. Watching for file changes. +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something(); +   ~~~~~~~~~~~~~~~~ + +[12:01:27 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: SafeModules Program files:: /a/lib/lib.d.ts -/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts +/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts @@ -600,6 +700,8 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -622,13 +724,6 @@ FsWatchesRecursive:: exitCode:: ExitStatus.undefined //// [/user/username/projects/myproject/outFile.js] -define("src/fileNotFound", ["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; - exports.something2 = void 0; - function something2() { return 20; } - exports.something2 = something2; -}); define("src/filePresent", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -636,6 +731,17 @@ define("src/filePresent", ["require", "exports"], function (require, exports) { function something() { return 10; } exports.something = something; }); +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); +define("src/fileNotFound", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.something2 = void 0; + function something2() { return 20; } + exports.something2 = something2; +}); define("src/newFile", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -651,12 +757,13 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, //// [/user/username/projects/myproject/outFile.d.ts] -declare module "src/fileNotFound" { - export function something2(): number; -} declare module "src/filePresent" { export function something(): number; } +declare module "src/anotherFileReusingResolution" { } +declare module "src/fileNotFound" { + export function something2(): number; +} declare module "src/newFile" { export function foo(): number; } @@ -668,8 +775,9 @@ declare module "src/main" { } "bundle": { "commonSourceDirectory": "./", "sourceFiles": [ - "./src/fileNotFound.ts", "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", "./src/newFile.ts", "./src/main.ts" ], @@ -677,7 +785,7 @@ declare module "src/main" { } "sections": [ { "pos": 0, - "end": 888, + "end": 1038, "kind": "text" } ] @@ -686,7 +794,7 @@ declare module "src/main" { } "sections": [ { "pos": 0, - "end": 256, + "end": 310, "kind": "text" } ] @@ -698,20 +806,24 @@ declare module "src/main" { } "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", "affectsGlobalScope": true }, - "./src/filenotfound.ts": { - "version": "-497034637-export function something2() { return 20; }", - "affectsGlobalScope": false - }, "./src/filepresent.ts": { "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false + }, + "./src/filenotfound.ts": { + "version": "-497034637-export function something2() { return 20; }", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "affectsGlobalScope": false } }, @@ -727,6 +839,9 @@ declare module "src/main" { } "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts", "./src/newfile.ts" diff --git a/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-are-cleaned.js b/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-are-cleaned.js index 7138bd2b755e6..8455ce6b50d03 100644 --- a/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-are-cleaned.js +++ b/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-are-cleaned.js @@ -1,6 +1,11 @@ Input:: //// [/user/username/projects/myproject/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; +import { something2 } from "./fileNotFound"; + +//// [/user/username/projects/myproject/src/anotherFileReusingResolution.ts] +import { something } from "./filePresent"; import { something2 } from "./fileNotFound"; //// [/user/username/projects/myproject/src/filePresent.ts] @@ -36,6 +41,17 @@ define(["require", "exports"], function (require, exports) { export declare function something(): number; +//// [/user/username/projects/myproject/src/anotherFileReusingResolution.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); + + +//// [/user/username/projects/myproject/src/anotherFileReusingResolution.d.ts] +export {}; + + //// [/user/username/projects/myproject/src/main.js] define(["require", "exports"], function (require, exports) { "use strict"; @@ -61,10 +77,15 @@ export {}; "signature": "-13601649692-export declare function something(): number;\n", "affectsGlobalScope": false }, - "./src/main.ts": { + "./src/anotherfilereusingresolution.ts": { "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "signature": "-3531856636-export {};\n", "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", + "affectsGlobalScope": false } }, "options": { @@ -76,6 +97,9 @@ export {}; "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -83,13 +107,26 @@ export {}; "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filepresent.ts", [ "./src/main.ts", [ { "file": "./src/main.ts", - "start": 70, + "start": 127, "length": 16, "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", "category": 1, @@ -105,21 +142,20 @@ export {}; /a/lib/tsc.js --p . -w --extendedDiagnostics Output:: -[12:00:38 AM] Starting compilation in watch mode... +[12:00:44 AM] Starting compilation in watch mode... Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Config file Synchronizing program CreatingProgramWith:: - roots: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] + roots: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/filePresent.ts 250 undefined Source file -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/anotherFileReusingResolution.ts 250 undefined Source file +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. @@ -127,26 +163,43 @@ File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/filePresent.ts 250 undefined Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './fileNotFound' was not resolved. ======== FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 undefined Source file DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ -[12:00:39 AM] Found 1 error. Watching for file changes. +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +[12:00:45 AM] Found 2 errors. Watching for file changes. DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts Semantic diagnostics in builder refreshed for:: @@ -154,6 +207,8 @@ Semantic diagnostics in builder refreshed for:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -177,6 +232,7 @@ Change:: Modify main file Input:: //// [/user/username/projects/myproject/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); @@ -184,29 +240,36 @@ Output:: FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file Scheduling update Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file -[12:00:42 AM] File change detected. Starting incremental compilation... +[12:00:48 AM] File change detected. Starting incremental compilation... Synchronizing program CreatingProgramWith:: - roots: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] + roots: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ -[12:00:52 AM] Found 1 error. Watching for file changes. +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something(); +   ~~~~~~~~~~~~~~~~ + +[12:00:58 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Completely Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts Semantic diagnostics in builder refreshed for:: @@ -215,6 +278,8 @@ Semantic diagnostics in builder refreshed for:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -255,8 +320,13 @@ define(["require", "exports", "./filePresent"], function (require, exports, file "signature": "-13601649692-export declare function something(): number;\n", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", + "affectsGlobalScope": false + }, "./src/main.ts": { - "version": "-22084070133-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "signature": "-3531856636-export {};\n", "affectsGlobalScope": false } @@ -272,6 +342,9 @@ define(["require", "exports", "./filePresent"], function (require, exports, file "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -279,13 +352,26 @@ define(["require", "exports", "./filePresent"], function (require, exports, file "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filepresent.ts", [ "./src/main.ts", [ { "file": "./src/main.ts", - "start": 70, + "start": 127, "length": 16, "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", "category": 1, @@ -304,6 +390,7 @@ Change:: Add new module and update main file Input:: //// [/user/username/projects/myproject/src/main.ts] import { foo } from "./newFile";import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); //// [/user/username/projects/myproject/src/newFile.ts] @@ -317,13 +404,16 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file Scheduling update Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file -[12:00:57 AM] File change detected. Starting incremental compilation... +[12:01:03 AM] File change detected. Starting incremental compilation... Reloading new file names and options Synchronizing program CreatingProgramWith:: - roots: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] + roots: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was not resolved. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. ======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== @@ -337,21 +427,27 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/newFile.d.ts Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ -2 import { something2 } from "./fileNotFound";something(); +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -[12:01:11 AM] Found 1 error. Watching for file changes. +[12:01:17 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: SafeModules Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts @@ -362,6 +458,8 @@ Semantic diagnostics in builder refreshed for:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -397,13 +495,18 @@ exitCode:: ExitStatus.undefined "signature": "-13601649692-export declare function something(): number;\n", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "signature": "-4788605446-export declare function foo(): number;\n", "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "signature": "-3531856636-export {};\n", "affectsGlobalScope": false } @@ -419,6 +522,9 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts", "./src/newfile.ts" @@ -427,13 +533,26 @@ exitCode:: ExitStatus.undefined "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filepresent.ts", [ "./src/main.ts", [ { "file": "./src/main.ts", - "start": 102, + "start": 159, "length": 16, "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", "category": 1, @@ -473,16 +592,19 @@ Output:: DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory Scheduling update Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory -[12:01:14 AM] File change detected. Starting incremental compilation... +[12:01:20 AM] File change detected. Starting incremental compilation... Reloading new file names and options Synchronizing program CreatingProgramWith:: - roots: ["/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] + roots: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was not resolved. FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileNotFound.ts 250 undefined Source file Reusing resolution of module './newFile' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/src/fileNotFound.js @@ -490,22 +612,28 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/fileNotFound.d.ts Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -[12:01:22 AM] Found 1 error. Watching for file changes. +[12:01:28 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: SafeModules Program files:: /a/lib/lib.d.ts -/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts +/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts @@ -515,6 +643,8 @@ Semantic diagnostics in builder refreshed for:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -545,23 +675,28 @@ exitCode:: ExitStatus.undefined "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", "affectsGlobalScope": true }, - "./src/filenotfound.ts": { - "version": "-497034637-export function something2() { return 20; }", - "signature": "-14992185226-export declare function something2(): number;\n", - "affectsGlobalScope": false - }, "./src/filepresent.ts": { "version": "11598859296-export function something() { return 10; }", "signature": "-13601649692-export declare function something(): number;\n", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", + "affectsGlobalScope": false + }, + "./src/filenotfound.ts": { + "version": "-497034637-export function something2() { return 20; }", + "signature": "-14992185226-export declare function something2(): number;\n", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "signature": "-4788605446-export declare function foo(): number;\n", "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "signature": "-3531856636-export {};\n", "affectsGlobalScope": false } @@ -577,6 +712,9 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts", "./src/newfile.ts" @@ -585,6 +723,19 @@ exitCode:: ExitStatus.undefined "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filenotfound.ts", "./src/filepresent.ts", [ @@ -592,7 +743,7 @@ exitCode:: ExitStatus.undefined [ { "file": "./src/main.ts", - "start": 102, + "start": 159, "length": 16, "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", "category": 1, diff --git a/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file-with-outFile.js b/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file-with-outFile.js index 421933a4aa024..e17094c1e3167 100644 --- a/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file-with-outFile.js +++ b/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file-with-outFile.js @@ -1,6 +1,11 @@ Input:: //// [/user/username/projects/myproject/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; +import { something2 } from "./fileNotFound"; + +//// [/user/username/projects/myproject/src/anotherFileReusingResolution.ts] +import { something } from "./filePresent"; import { something2 } from "./fileNotFound"; //// [/user/username/projects/myproject/src/filePresent.ts] @@ -30,6 +35,10 @@ define("src/filePresent", ["require", "exports"], function (require, exports) { function something() { return 10; } exports.something = something; }); +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); define("src/main", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -40,6 +49,7 @@ define("src/main", ["require", "exports"], function (require, exports) { declare module "src/filePresent" { export function something(): number; } +declare module "src/anotherFileReusingResolution" { } declare module "src/main" { } @@ -49,13 +59,14 @@ declare module "src/main" { } "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", "./src/main.ts" ], "js": { "sections": [ { "pos": 0, - "end": 366, + "end": 516, "kind": "text" } ] @@ -64,7 +75,7 @@ declare module "src/main" { } "sections": [ { "pos": 0, - "end": 108, + "end": 162, "kind": "text" } ] @@ -80,9 +91,13 @@ declare module "src/main" { } "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, - "./src/main.ts": { + "./src/anotherfilereusingresolution.ts": { "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false } }, "options": { @@ -95,6 +110,9 @@ declare module "src/main" { } "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -107,21 +125,20 @@ declare module "src/main" { } /a/lib/tsc.js --p . -w --extendedDiagnostics Output:: -[12:00:31 AM] Starting compilation in watch mode... +[12:00:33 AM] Starting compilation in watch mode... Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Config file Synchronizing program CreatingProgramWith:: - roots: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] + roots: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/filePresent.ts 250 undefined Source file -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/anotherFileReusingResolution.ts 250 undefined Source file +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. @@ -129,26 +146,43 @@ File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/filePresent.ts 250 undefined Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './fileNotFound' was not resolved. ======== FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 undefined Source file DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ -[12:00:41 AM] Found 1 error. Watching for file changes. +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +[12:00:43 AM] Found 2 errors. Watching for file changes. DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts No cached semantic diagnostics in the builder:: @@ -156,6 +190,8 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -181,13 +217,14 @@ exitCode:: ExitStatus.undefined "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", "./src/main.ts" ], "js": { "sections": [ { "pos": 0, - "end": 366, + "end": 516, "kind": "text" } ] @@ -196,7 +233,7 @@ exitCode:: ExitStatus.undefined "sections": [ { "pos": 0, - "end": 108, + "end": 162, "kind": "text" } ] @@ -212,9 +249,13 @@ exitCode:: ExitStatus.undefined "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, - "./src/main.ts": { + "./src/anotherfilereusingresolution.ts": { "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false } }, "options": { @@ -229,6 +270,9 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -244,6 +288,7 @@ Change:: Modify main file Input:: //// [/user/username/projects/myproject/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); @@ -251,29 +296,36 @@ Output:: FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file Scheduling update Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file -[12:00:44 AM] File change detected. Starting incremental compilation... +[12:00:46 AM] File change detected. Starting incremental compilation... Synchronizing program CreatingProgramWith:: - roots: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] + roots: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -[12:00:54 AM] Found 1 error. Watching for file changes. +[12:00:56 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Completely Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts No cached semantic diagnostics in the builder:: @@ -281,6 +333,8 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -306,6 +360,10 @@ define("src/filePresent", ["require", "exports"], function (require, exports) { function something() { return 10; } exports.something = something; }); +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); define("src/main", ["require", "exports", "src/filePresent"], function (require, exports, filePresent_1) { "use strict"; exports.__esModule = true; @@ -320,13 +378,14 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", "./src/main.ts" ], "js": { "sections": [ { "pos": 0, - "end": 431, + "end": 581, "kind": "text" } ] @@ -335,7 +394,7 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "sections": [ { "pos": 0, - "end": 108, + "end": 162, "kind": "text" } ] @@ -351,8 +410,12 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false + }, "./src/main.ts": { - "version": "-22084070133-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "affectsGlobalScope": false } }, @@ -368,6 +431,9 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -383,6 +449,7 @@ Change:: Add new module and update main file Input:: //// [/user/username/projects/myproject/src/main.ts] import { foo } from "./newFile";import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); //// [/user/username/projects/myproject/src/newFile.ts] @@ -396,13 +463,16 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file Scheduling update Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file -[12:00:59 AM] File change detected. Starting incremental compilation... +[12:01:01 AM] File change detected. Starting incremental compilation... Reloading new file names and options Synchronizing program CreatingProgramWith:: - roots: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] + roots: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was not resolved. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. ======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== @@ -410,21 +480,27 @@ Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/newFile.ts 250 undefined Source file -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -[12:01:09 AM] Found 1 error. Watching for file changes. +[12:01:11 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: SafeModules Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts @@ -433,6 +509,8 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -460,6 +538,10 @@ define("src/filePresent", ["require", "exports"], function (require, exports) { function something() { return 10; } exports.something = something; }); +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); define("src/newFile", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -478,6 +560,7 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, declare module "src/filePresent" { export function something(): number; } +declare module "src/anotherFileReusingResolution" { } declare module "src/newFile" { export function foo(): number; } @@ -490,6 +573,7 @@ declare module "src/main" { } "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", "./src/newFile.ts", "./src/main.ts" ], @@ -497,7 +581,7 @@ declare module "src/main" { } "sections": [ { "pos": 0, - "end": 643, + "end": 793, "kind": "text" } ] @@ -506,7 +590,7 @@ declare module "src/main" { } "sections": [ { "pos": 0, - "end": 176, + "end": 230, "kind": "text" } ] @@ -522,12 +606,16 @@ declare module "src/main" { } "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "affectsGlobalScope": false } }, @@ -543,6 +631,9 @@ declare module "src/main" { } "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts", "./src/newfile.ts" @@ -565,33 +656,42 @@ Output:: DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory Scheduling update Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory -[12:01:12 AM] File change detected. Starting incremental compilation... +[12:01:14 AM] File change detected. Starting incremental compilation... Reloading new file names and options Synchronizing program CreatingProgramWith:: - roots: ["/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] + roots: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was not resolved. FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileNotFound.ts 250 undefined Source file Reusing resolution of module './newFile' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ -[12:01:22 AM] Found 1 error. Watching for file changes. +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something(); +   ~~~~~~~~~~~~~~~~ + +[12:01:24 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: SafeModules Program files:: /a/lib/lib.d.ts -/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts +/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts @@ -600,6 +700,8 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -622,13 +724,6 @@ FsWatchesRecursive:: exitCode:: ExitStatus.undefined //// [/user/username/projects/myproject/outFile.js] -define("src/fileNotFound", ["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; - exports.something2 = void 0; - function something2() { return 20; } - exports.something2 = something2; -}); define("src/filePresent", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -636,6 +731,17 @@ define("src/filePresent", ["require", "exports"], function (require, exports) { function something() { return 10; } exports.something = something; }); +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); +define("src/fileNotFound", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.something2 = void 0; + function something2() { return 20; } + exports.something2 = something2; +}); define("src/newFile", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -651,12 +757,13 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, //// [/user/username/projects/myproject/outFile.d.ts] -declare module "src/fileNotFound" { - export function something2(): number; -} declare module "src/filePresent" { export function something(): number; } +declare module "src/anotherFileReusingResolution" { } +declare module "src/fileNotFound" { + export function something2(): number; +} declare module "src/newFile" { export function foo(): number; } @@ -668,8 +775,9 @@ declare module "src/main" { } "bundle": { "commonSourceDirectory": "./", "sourceFiles": [ - "./src/fileNotFound.ts", "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", "./src/newFile.ts", "./src/main.ts" ], @@ -677,7 +785,7 @@ declare module "src/main" { } "sections": [ { "pos": 0, - "end": 888, + "end": 1038, "kind": "text" } ] @@ -686,7 +794,7 @@ declare module "src/main" { } "sections": [ { "pos": 0, - "end": 256, + "end": 310, "kind": "text" } ] @@ -698,20 +806,24 @@ declare module "src/main" { } "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", "affectsGlobalScope": true }, - "./src/filenotfound.ts": { - "version": "-497034637-export function something2() { return 20; }", - "affectsGlobalScope": false - }, "./src/filepresent.ts": { "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false + }, + "./src/filenotfound.ts": { + "version": "-497034637-export function something2() { return 20; }", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "affectsGlobalScope": false } }, @@ -727,6 +839,9 @@ declare module "src/main" { } "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts", "./src/newfile.ts" diff --git a/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file.js b/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file.js index 8dca804d97b34..77806acaa1af9 100644 --- a/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file.js +++ b/tests/baselines/reference/tscWatch/persistResolutions/can-build-after-resolutions-have-been-saved-in-tsbuildinfo-file.js @@ -1,6 +1,11 @@ Input:: //// [/user/username/projects/myproject/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; +import { something2 } from "./fileNotFound"; + +//// [/user/username/projects/myproject/src/anotherFileReusingResolution.ts] +import { something } from "./filePresent"; import { something2 } from "./fileNotFound"; //// [/user/username/projects/myproject/src/filePresent.ts] @@ -36,6 +41,17 @@ define(["require", "exports"], function (require, exports) { export declare function something(): number; +//// [/user/username/projects/myproject/src/anotherFileReusingResolution.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); + + +//// [/user/username/projects/myproject/src/anotherFileReusingResolution.d.ts] +export {}; + + //// [/user/username/projects/myproject/src/main.js] define(["require", "exports"], function (require, exports) { "use strict"; @@ -61,10 +77,15 @@ export {}; "signature": "-13601649692-export declare function something(): number;\n", "affectsGlobalScope": false }, - "./src/main.ts": { + "./src/anotherfilereusingresolution.ts": { "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "signature": "-3531856636-export {};\n", "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", + "affectsGlobalScope": false } }, "options": { @@ -76,6 +97,9 @@ export {}; "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -83,13 +107,26 @@ export {}; "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filepresent.ts", [ "./src/main.ts", [ { "file": "./src/main.ts", - "start": 70, + "start": 127, "length": 16, "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", "category": 1, @@ -105,21 +142,20 @@ export {}; /a/lib/tsc.js --p . -w --extendedDiagnostics Output:: -[12:00:35 AM] Starting compilation in watch mode... +[12:00:41 AM] Starting compilation in watch mode... Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Config file Synchronizing program CreatingProgramWith:: - roots: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] + roots: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/filePresent.ts 250 undefined Source file -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/anotherFileReusingResolution.ts 250 undefined Source file +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. @@ -127,26 +163,43 @@ File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/filePresent.ts 250 undefined Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './fileNotFound' was not resolved. ======== FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 undefined Source file DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ -[12:00:36 AM] Found 1 error. Watching for file changes. +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +[12:00:42 AM] Found 2 errors. Watching for file changes. DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts Semantic diagnostics in builder refreshed for:: @@ -154,6 +207,8 @@ Semantic diagnostics in builder refreshed for:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -177,6 +232,7 @@ Change:: Modify main file Input:: //// [/user/username/projects/myproject/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); @@ -184,29 +240,36 @@ Output:: FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file Scheduling update Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file -[12:00:39 AM] File change detected. Starting incremental compilation... +[12:00:45 AM] File change detected. Starting incremental compilation... Synchronizing program CreatingProgramWith:: - roots: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] + roots: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ -[12:00:49 AM] Found 1 error. Watching for file changes. +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something(); +   ~~~~~~~~~~~~~~~~ + +[12:00:55 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Completely Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts Semantic diagnostics in builder refreshed for:: @@ -215,6 +278,8 @@ Semantic diagnostics in builder refreshed for:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -255,8 +320,13 @@ define(["require", "exports", "./filePresent"], function (require, exports, file "signature": "-13601649692-export declare function something(): number;\n", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", + "affectsGlobalScope": false + }, "./src/main.ts": { - "version": "-22084070133-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "signature": "-3531856636-export {};\n", "affectsGlobalScope": false } @@ -272,6 +342,9 @@ define(["require", "exports", "./filePresent"], function (require, exports, file "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -279,13 +352,26 @@ define(["require", "exports", "./filePresent"], function (require, exports, file "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filepresent.ts", [ "./src/main.ts", [ { "file": "./src/main.ts", - "start": 70, + "start": 127, "length": 16, "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", "category": 1, @@ -304,6 +390,7 @@ Change:: Add new module and update main file Input:: //// [/user/username/projects/myproject/src/main.ts] import { foo } from "./newFile";import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); //// [/user/username/projects/myproject/src/newFile.ts] @@ -317,13 +404,16 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file Scheduling update Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file -[12:00:54 AM] File change detected. Starting incremental compilation... +[12:01:00 AM] File change detected. Starting incremental compilation... Reloading new file names and options Synchronizing program CreatingProgramWith:: - roots: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] + roots: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was not resolved. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. ======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== @@ -337,21 +427,27 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/newFile.d.ts Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ -2 import { something2 } from "./fileNotFound";something(); +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -[12:01:08 AM] Found 1 error. Watching for file changes. +[12:01:14 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: SafeModules Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts @@ -362,6 +458,8 @@ Semantic diagnostics in builder refreshed for:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -397,13 +495,18 @@ exitCode:: ExitStatus.undefined "signature": "-13601649692-export declare function something(): number;\n", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "signature": "-4788605446-export declare function foo(): number;\n", "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "signature": "-3531856636-export {};\n", "affectsGlobalScope": false } @@ -419,6 +522,9 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts", "./src/newfile.ts" @@ -427,13 +533,26 @@ exitCode:: ExitStatus.undefined "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filepresent.ts", [ "./src/main.ts", [ { "file": "./src/main.ts", - "start": 102, + "start": 159, "length": 16, "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", "category": 1, @@ -473,16 +592,19 @@ Output:: DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory Scheduling update Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory -[12:01:11 AM] File change detected. Starting incremental compilation... +[12:01:17 AM] File change detected. Starting incremental compilation... Reloading new file names and options Synchronizing program CreatingProgramWith:: - roots: ["/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] + roots: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was not resolved. FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileNotFound.ts 250 undefined Source file Reusing resolution of module './newFile' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/src/fileNotFound.js @@ -490,22 +612,28 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/fileNotFound.d.ts Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -[12:01:19 AM] Found 1 error. Watching for file changes. +[12:01:25 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: SafeModules Program files:: /a/lib/lib.d.ts -/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts +/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts @@ -515,6 +643,8 @@ Semantic diagnostics in builder refreshed for:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -545,23 +675,28 @@ exitCode:: ExitStatus.undefined "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", "affectsGlobalScope": true }, - "./src/filenotfound.ts": { - "version": "-497034637-export function something2() { return 20; }", - "signature": "-14992185226-export declare function something2(): number;\n", - "affectsGlobalScope": false - }, "./src/filepresent.ts": { "version": "11598859296-export function something() { return 10; }", "signature": "-13601649692-export declare function something(): number;\n", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", + "affectsGlobalScope": false + }, + "./src/filenotfound.ts": { + "version": "-497034637-export function something2() { return 20; }", + "signature": "-14992185226-export declare function something2(): number;\n", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "signature": "-4788605446-export declare function foo(): number;\n", "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "signature": "-3531856636-export {};\n", "affectsGlobalScope": false } @@ -577,6 +712,9 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts", "./src/newfile.ts" @@ -585,6 +723,19 @@ exitCode:: ExitStatus.undefined "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filenotfound.ts", "./src/filepresent.ts", [ @@ -592,7 +743,7 @@ exitCode:: ExitStatus.undefined [ { "file": "./src/main.ts", - "start": 102, + "start": 159, "length": 16, "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", "category": 1, diff --git a/tests/baselines/reference/tscWatch/persistResolutions/saves-resolution-and-uses-it-for-new-program-with-outFile.js b/tests/baselines/reference/tscWatch/persistResolutions/saves-resolution-and-uses-it-for-new-program-with-outFile.js index 6369c611e17b9..f5d6072914d3f 100644 --- a/tests/baselines/reference/tscWatch/persistResolutions/saves-resolution-and-uses-it-for-new-program-with-outFile.js +++ b/tests/baselines/reference/tscWatch/persistResolutions/saves-resolution-and-uses-it-for-new-program-with-outFile.js @@ -1,6 +1,11 @@ Input:: //// [/user/username/projects/myproject/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; +import { something2 } from "./fileNotFound"; + +//// [/user/username/projects/myproject/src/anotherFileReusingResolution.ts] +import { something } from "./filePresent"; import { something2 } from "./fileNotFound"; //// [/user/username/projects/myproject/src/filePresent.ts] @@ -25,21 +30,20 @@ interface Array { length: number; [n: number]: T; } /a/lib/tsc.js --p . -w --extendedDiagnostics Output:: -[12:00:25 AM] Starting compilation in watch mode... +[12:00:27 AM] Starting compilation in watch mode... Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Config file Synchronizing program CreatingProgramWith:: - roots: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] + roots: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/filePresent.ts 250 undefined Source file -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/anotherFileReusingResolution.ts 250 undefined Source file +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. @@ -47,26 +51,43 @@ File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/filePresent.ts 250 undefined Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './fileNotFound' was not resolved. ======== FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 undefined Source file DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ -[12:00:32 AM] Found 1 error. Watching for file changes. +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +[12:00:34 AM] Found 2 errors. Watching for file changes. DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts No cached semantic diagnostics in the builder:: @@ -74,6 +95,8 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -99,6 +122,10 @@ define("src/filePresent", ["require", "exports"], function (require, exports) { function something() { return 10; } exports.something = something; }); +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); define("src/main", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -109,6 +136,7 @@ define("src/main", ["require", "exports"], function (require, exports) { declare module "src/filePresent" { export function something(): number; } +declare module "src/anotherFileReusingResolution" { } declare module "src/main" { } @@ -118,13 +146,14 @@ declare module "src/main" { } "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", "./src/main.ts" ], "js": { "sections": [ { "pos": 0, - "end": 366, + "end": 516, "kind": "text" } ] @@ -133,7 +162,7 @@ declare module "src/main" { } "sections": [ { "pos": 0, - "end": 108, + "end": 162, "kind": "text" } ] @@ -149,9 +178,13 @@ declare module "src/main" { } "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, - "./src/main.ts": { + "./src/anotherfilereusingresolution.ts": { "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false } }, "options": { @@ -166,6 +199,9 @@ declare module "src/main" { } "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -181,6 +217,7 @@ Change:: Modify main file Input:: //// [/user/username/projects/myproject/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); @@ -188,29 +225,36 @@ Output:: FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file Scheduling update Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file -[12:00:35 AM] File change detected. Starting incremental compilation... +[12:00:37 AM] File change detected. Starting incremental compilation... Synchronizing program CreatingProgramWith:: - roots: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] + roots: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ -2 import { something2 } from "./fileNotFound";something(); +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -[12:00:45 AM] Found 1 error. Watching for file changes. +[12:00:47 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Completely Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts No cached semantic diagnostics in the builder:: @@ -218,6 +262,8 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -243,6 +289,10 @@ define("src/filePresent", ["require", "exports"], function (require, exports) { function something() { return 10; } exports.something = something; }); +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); define("src/main", ["require", "exports", "src/filePresent"], function (require, exports, filePresent_1) { "use strict"; exports.__esModule = true; @@ -257,13 +307,14 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", "./src/main.ts" ], "js": { "sections": [ { "pos": 0, - "end": 431, + "end": 581, "kind": "text" } ] @@ -272,7 +323,7 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "sections": [ { "pos": 0, - "end": 108, + "end": 162, "kind": "text" } ] @@ -288,8 +339,12 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false + }, "./src/main.ts": { - "version": "-22084070133-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "affectsGlobalScope": false } }, @@ -305,6 +360,9 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -320,6 +378,7 @@ Change:: Add new module and update main file Input:: //// [/user/username/projects/myproject/src/main.ts] import { foo } from "./newFile";import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); //// [/user/username/projects/myproject/src/newFile.ts] @@ -333,13 +392,16 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file Scheduling update Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file -[12:00:50 AM] File change detected. Starting incremental compilation... +[12:00:52 AM] File change detected. Starting incremental compilation... Reloading new file names and options Synchronizing program CreatingProgramWith:: - roots: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] + roots: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was not resolved. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. ======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== @@ -347,21 +409,27 @@ Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/newFile.ts' exist - use it as a name resolution result. ======== Module name './newFile' was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. ======== FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/newFile.ts 250 undefined Source file -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ -[12:01:00 AM] Found 1 error. Watching for file changes. +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something(); +   ~~~~~~~~~~~~~~~~ + +[12:01:02 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: SafeModules Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts @@ -370,6 +438,8 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -397,6 +467,10 @@ define("src/filePresent", ["require", "exports"], function (require, exports) { function something() { return 10; } exports.something = something; }); +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); define("src/newFile", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -415,6 +489,7 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, declare module "src/filePresent" { export function something(): number; } +declare module "src/anotherFileReusingResolution" { } declare module "src/newFile" { export function foo(): number; } @@ -427,6 +502,7 @@ declare module "src/main" { } "commonSourceDirectory": "./", "sourceFiles": [ "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", "./src/newFile.ts", "./src/main.ts" ], @@ -434,7 +510,7 @@ declare module "src/main" { } "sections": [ { "pos": 0, - "end": 643, + "end": 793, "kind": "text" } ] @@ -443,7 +519,7 @@ declare module "src/main" { } "sections": [ { "pos": 0, - "end": 176, + "end": 230, "kind": "text" } ] @@ -459,12 +535,16 @@ declare module "src/main" { } "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "affectsGlobalScope": false } }, @@ -480,6 +560,9 @@ declare module "src/main" { } "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts", "./src/newfile.ts" @@ -502,33 +585,42 @@ Output:: DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory Scheduling update Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory -[12:01:03 AM] File change detected. Starting incremental compilation... +[12:01:05 AM] File change detected. Starting incremental compilation... Reloading new file names and options Synchronizing program CreatingProgramWith:: - roots: ["/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] + roots: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was not resolved. FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileNotFound.ts 250 undefined Source file Reusing resolution of module './newFile' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -[12:01:13 AM] Found 1 error. Watching for file changes. +[12:01:15 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"outFile":"/user/username/projects/myproject/outFile.js","project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: SafeModules Program files:: /a/lib/lib.d.ts -/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts +/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts @@ -537,6 +629,8 @@ No cached semantic diagnostics in the builder:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -559,13 +653,6 @@ FsWatchesRecursive:: exitCode:: ExitStatus.undefined //// [/user/username/projects/myproject/outFile.js] -define("src/fileNotFound", ["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; - exports.something2 = void 0; - function something2() { return 20; } - exports.something2 = something2; -}); define("src/filePresent", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -573,6 +660,17 @@ define("src/filePresent", ["require", "exports"], function (require, exports) { function something() { return 10; } exports.something = something; }); +define("src/anotherFileReusingResolution", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); +define("src/fileNotFound", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.something2 = void 0; + function something2() { return 20; } + exports.something2 = something2; +}); define("src/newFile", ["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; @@ -588,12 +686,13 @@ define("src/main", ["require", "exports", "src/filePresent"], function (require, //// [/user/username/projects/myproject/outFile.d.ts] -declare module "src/fileNotFound" { - export function something2(): number; -} declare module "src/filePresent" { export function something(): number; } +declare module "src/anotherFileReusingResolution" { } +declare module "src/fileNotFound" { + export function something2(): number; +} declare module "src/newFile" { export function foo(): number; } @@ -605,8 +704,9 @@ declare module "src/main" { } "bundle": { "commonSourceDirectory": "./", "sourceFiles": [ - "./src/fileNotFound.ts", "./src/filePresent.ts", + "./src/anotherFileReusingResolution.ts", + "./src/fileNotFound.ts", "./src/newFile.ts", "./src/main.ts" ], @@ -614,7 +714,7 @@ declare module "src/main" { } "sections": [ { "pos": 0, - "end": 888, + "end": 1038, "kind": "text" } ] @@ -623,7 +723,7 @@ declare module "src/main" { } "sections": [ { "pos": 0, - "end": 256, + "end": 310, "kind": "text" } ] @@ -635,20 +735,24 @@ declare module "src/main" { } "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", "affectsGlobalScope": true }, - "./src/filenotfound.ts": { - "version": "-497034637-export function something2() { return 20; }", - "affectsGlobalScope": false - }, "./src/filepresent.ts": { "version": "11598859296-export function something() { return 10; }", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "affectsGlobalScope": false + }, + "./src/filenotfound.ts": { + "version": "-497034637-export function something2() { return 20; }", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "affectsGlobalScope": false } }, @@ -664,6 +768,9 @@ declare module "src/main" { } "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts", "./src/newfile.ts" diff --git a/tests/baselines/reference/tscWatch/persistResolutions/saves-resolution-and-uses-it-for-new-program.js b/tests/baselines/reference/tscWatch/persistResolutions/saves-resolution-and-uses-it-for-new-program.js index 92ce97d0a2ea1..2e0178c5270fe 100644 --- a/tests/baselines/reference/tscWatch/persistResolutions/saves-resolution-and-uses-it-for-new-program.js +++ b/tests/baselines/reference/tscWatch/persistResolutions/saves-resolution-and-uses-it-for-new-program.js @@ -1,6 +1,11 @@ Input:: //// [/user/username/projects/myproject/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; +import { something2 } from "./fileNotFound"; + +//// [/user/username/projects/myproject/src/anotherFileReusingResolution.ts] +import { something } from "./filePresent"; import { something2 } from "./fileNotFound"; //// [/user/username/projects/myproject/src/filePresent.ts] @@ -25,21 +30,20 @@ interface Array { length: number; [n: number]: T; } /a/lib/tsc.js --p . -w --extendedDiagnostics Output:: -[12:00:25 AM] Starting compilation in watch mode... +[12:00:27 AM] Starting compilation in watch mode... Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Config file Synchronizing program CreatingProgramWith:: - roots: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] + roots: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/filePresent.ts 250 undefined Source file -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file -======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/anotherFileReusingResolution.ts 250 undefined Source file +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/filePresent.ts' exist - use it as a name resolution result. ======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== -======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts'. ======== Module resolution kind is not specified, using 'Classic'. File '/user/username/projects/myproject/src/fileNotFound.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.tsx' does not exist. @@ -47,36 +51,56 @@ File '/user/username/projects/myproject/src/fileNotFound.d.ts' does not exist. File '/user/username/projects/myproject/src/fileNotFound.js' does not exist. File '/user/username/projects/myproject/src/fileNotFound.jsx' does not exist. ======== Module name './fileNotFound' was not resolved. ======== +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/filePresent.ts 250 undefined Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './filePresent' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './filePresent' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './filePresent' was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. ======== +======== Resolving module './fileNotFound' from '/user/username/projects/myproject/src/main.ts'. ======== +Resolution for module './fileNotFound' was found in cache from location '/user/username/projects/myproject/src'. +======== Module name './fileNotFound' was not resolved. ======== FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 undefined Source file DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? 2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ -[12:00:36 AM] Found 1 error. Watching for file changes. +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +[12:00:42 AM] Found 2 errors. Watching for file changes. DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts Semantic diagnostics in builder refreshed for:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -108,6 +132,17 @@ define(["require", "exports"], function (require, exports) { export declare function something(): number; +//// [/user/username/projects/myproject/src/anotherFileReusingResolution.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; +}); + + +//// [/user/username/projects/myproject/src/anotherFileReusingResolution.d.ts] +export {}; + + //// [/user/username/projects/myproject/src/main.js] define(["require", "exports"], function (require, exports) { "use strict"; @@ -133,10 +168,15 @@ export {}; "signature": "-13601649692-export declare function something(): number;\n", "affectsGlobalScope": false }, - "./src/main.ts": { + "./src/anotherfilereusingresolution.ts": { "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", "signature": "-3531856636-export {};\n", "affectsGlobalScope": false + }, + "./src/main.ts": { + "version": "-9387417376-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", + "affectsGlobalScope": false } }, "options": { @@ -150,6 +190,9 @@ export {}; "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -157,13 +200,26 @@ export {}; "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filepresent.ts", [ "./src/main.ts", [ { "file": "./src/main.ts", - "start": 70, + "start": 127, "length": 16, "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", "category": 1, @@ -182,6 +238,7 @@ Change:: Modify main file Input:: //// [/user/username/projects/myproject/src/main.ts] import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); @@ -189,29 +246,36 @@ Output:: FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file Scheduling update Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file -[12:00:39 AM] File change detected. Starting incremental compilation... +[12:00:45 AM] File change detected. Starting incremental compilation... Synchronizing program CreatingProgramWith:: - roots: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] + roots: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +2 import { something2 } from "./fileNotFound";    ~~~~~~~~~~~~~~~~ -[12:00:49 AM] Found 1 error. Watching for file changes. +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something(); +   ~~~~~~~~~~~~~~~~ + +[12:00:55 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Completely Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/main.ts Semantic diagnostics in builder refreshed for:: @@ -220,6 +284,8 @@ Semantic diagnostics in builder refreshed for:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -260,8 +326,13 @@ define(["require", "exports", "./filePresent"], function (require, exports, file "signature": "-13601649692-export declare function something(): number;\n", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", + "affectsGlobalScope": false + }, "./src/main.ts": { - "version": "-22084070133-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "-12344353894-import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "signature": "-3531856636-export {};\n", "affectsGlobalScope": false } @@ -277,6 +348,9 @@ define(["require", "exports", "./filePresent"], function (require, exports, file "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts" ] @@ -284,13 +358,26 @@ define(["require", "exports", "./filePresent"], function (require, exports, file "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filepresent.ts", [ "./src/main.ts", [ { "file": "./src/main.ts", - "start": 70, + "start": 127, "length": 16, "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", "category": 1, @@ -309,6 +396,7 @@ Change:: Add new module and update main file Input:: //// [/user/username/projects/myproject/src/main.ts] import { foo } from "./newFile";import { something } from "./filePresent"; +import { something as something1 } from "./filePresent"; import { something2 } from "./fileNotFound";something(); //// [/user/username/projects/myproject/src/newFile.ts] @@ -322,13 +410,16 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file Scheduling update Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/src/main.ts 1:: WatchInfo: /user/username/projects/myproject/src/main.ts 250 undefined Source file -[12:00:54 AM] File change detected. Starting incremental compilation... +[12:01:00 AM] File change detected. Starting incremental compilation... Reloading new file names and options Synchronizing program CreatingProgramWith:: - roots: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] + roots: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was not resolved. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. ======== Resolving module './newFile' from '/user/username/projects/myproject/src/main.ts'. ======== @@ -342,21 +433,27 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/newFile.d.ts Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/newFile.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ -2 import { something2 } from "./fileNotFound";something(); +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -[12:01:08 AM] Found 1 error. Watching for file changes. +[12:01:14 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: SafeModules Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts @@ -367,6 +464,8 @@ Semantic diagnostics in builder refreshed for:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -402,13 +501,18 @@ exitCode:: ExitStatus.undefined "signature": "-13601649692-export declare function something(): number;\n", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "signature": "-4788605446-export declare function foo(): number;\n", "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "signature": "-3531856636-export {};\n", "affectsGlobalScope": false } @@ -424,6 +528,9 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts", "./src/newfile.ts" @@ -432,13 +539,26 @@ exitCode:: ExitStatus.undefined "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filepresent.ts", [ "./src/main.ts", [ { "file": "./src/main.ts", - "start": 102, + "start": 159, "length": 16, "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", "category": 1, @@ -478,16 +598,19 @@ Output:: DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory Scheduling update Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory -[12:01:11 AM] File change detected. Starting incremental compilation... +[12:01:17 AM] File change detected. Starting incremental compilation... Reloading new file names and options Synchronizing program CreatingProgramWith:: - roots: ["/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] + roots: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/anotherFileReusingResolution.ts' of old program, it was not resolved. FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileNotFound.ts 250 undefined Source file Reusing resolution of module './newFile' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/newFile.ts'. Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. +Reusing resolution of module './filePresent' from '/user/username/projects/myproject/src/main.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/filePresent.ts'. Reusing resolution of module './fileNotFound' from '/user/username/projects/myproject/src/main.ts' of old program, it was not resolved. DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.js :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/src/fileNotFound.js @@ -495,22 +618,28 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/src/fileNotFound.d.ts Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/src/fileNotFound.d.ts :: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory -src/main.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +src/anotherFileReusingResolution.ts:2:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { something2 } from "./fileNotFound"; +   ~~~~~~~~~~~~~~~~ + +src/main.ts:3:28 - error TS2792: Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -2 import { something2 } from "./fileNotFound";something(); +3 import { something2 } from "./fileNotFound";something();    ~~~~~~~~~~~~~~~~ -[12:01:19 AM] Found 1 error. Watching for file changes. +[12:01:25 AM] Found 2 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] +Program root files: ["/user/username/projects/myproject/src/anotherFileReusingResolution.ts","/user/username/projects/myproject/src/fileNotFound.ts","/user/username/projects/myproject/src/filePresent.ts","/user/username/projects/myproject/src/main.ts","/user/username/projects/myproject/src/newFile.ts"] Program options: {"module":2,"composite":true,"persistResolutions":true,"traceResolution":true,"project":"/user/username/projects/myproject","watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: SafeModules Program files:: /a/lib/lib.d.ts -/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/filePresent.ts +/user/username/projects/myproject/src/anotherFileReusingResolution.ts +/user/username/projects/myproject/src/fileNotFound.ts /user/username/projects/myproject/src/newFile.ts /user/username/projects/myproject/src/main.ts @@ -520,6 +649,8 @@ Semantic diagnostics in builder refreshed for:: WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/src/anotherfilereusingresolution.ts: + {"fileName":"/user/username/projects/myproject/src/anotherFileReusingResolution.ts","pollingInterval":250} /user/username/projects/myproject/src/filepresent.ts: {"fileName":"/user/username/projects/myproject/src/filePresent.ts","pollingInterval":250} /user/username/projects/myproject/src/main.ts: @@ -550,23 +681,28 @@ exitCode:: ExitStatus.undefined "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", "affectsGlobalScope": true }, - "./src/filenotfound.ts": { - "version": "-497034637-export function something2() { return 20; }", - "signature": "-14992185226-export declare function something2(): number;\n", - "affectsGlobalScope": false - }, "./src/filepresent.ts": { "version": "11598859296-export function something() { return 10; }", "signature": "-13601649692-export declare function something(): number;\n", "affectsGlobalScope": false }, + "./src/anotherfilereusingresolution.ts": { + "version": "-18180953903-import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";", + "signature": "-3531856636-export {};\n", + "affectsGlobalScope": false + }, + "./src/filenotfound.ts": { + "version": "-497034637-export function something2() { return 20; }", + "signature": "-14992185226-export declare function something2(): number;\n", + "affectsGlobalScope": false + }, "./src/newfile.ts": { "version": "4428918903-export function foo() { return 20; }", "signature": "-4788605446-export declare function foo(): number;\n", "affectsGlobalScope": false }, "./src/main.ts": { - "version": "-1814339108-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", + "version": "28260231563-import { foo } from \"./newFile\";import { something } from \"./filePresent\";\nimport { something as something1 } from \"./filePresent\";\nimport { something2 } from \"./fileNotFound\";something();", "signature": "-3531856636-export {};\n", "affectsGlobalScope": false } @@ -582,6 +718,9 @@ exitCode:: ExitStatus.undefined "configFilePath": "./tsconfig.json" }, "referencedMap": { + "./src/anotherfilereusingresolution.ts": [ + "./src/filepresent.ts" + ], "./src/main.ts": [ "./src/filepresent.ts", "./src/newfile.ts" @@ -590,6 +729,19 @@ exitCode:: ExitStatus.undefined "exportedModulesMap": {}, "semanticDiagnosticsPerFile": [ "../../../../a/lib/lib.d.ts", + [ + "./src/anotherfilereusingresolution.ts", + [ + { + "file": "./src/anotherfilereusingresolution.ts", + "start": 70, + "length": 16, + "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", + "category": 1, + "code": 2792 + } + ] + ], "./src/filenotfound.ts", "./src/filepresent.ts", [ @@ -597,7 +749,7 @@ exitCode:: ExitStatus.undefined [ { "file": "./src/main.ts", - "start": 102, + "start": 159, "length": 16, "messageText": "Cannot find module './fileNotFound'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?", "category": 1,