From a646122f5e9188ac220a89f72df42611569a7cde Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Mon, 25 Mar 2024 10:04:39 -0700 Subject: [PATCH 1/2] Test --- .../helpers/sampleProjectReferences.ts | 16 +- .../tscWatch/projectsWithReferences.ts | 100 +- .../on-sample-project-with-nodenext.js | 1641 +++++++++++++++++ 3 files changed, 1707 insertions(+), 50 deletions(-) create mode 100644 tests/baselines/reference/tscWatch/projectsWithReferences/on-sample-project-with-nodenext.js diff --git a/src/testRunner/unittests/helpers/sampleProjectReferences.ts b/src/testRunner/unittests/helpers/sampleProjectReferences.ts index c4a1623f9fd54..55cb4db4dc212 100644 --- a/src/testRunner/unittests/helpers/sampleProjectReferences.ts +++ b/src/testRunner/unittests/helpers/sampleProjectReferences.ts @@ -16,9 +16,13 @@ import { libFile, } from "./virtualFileSystemWithWatch"; -export function getFsContentsForSampleProjectReferencesLogicConfig() { +export function getSampleProjectConfigWithNodeNext(withNodeNext: boolean | undefined) { + return withNodeNext ? { module: "nodenext", target: "es5" } : undefined; +} +export function getFsContentsForSampleProjectReferencesLogicConfig(withNodeNext?: boolean) { return jsonToReadableText({ compilerOptions: { + ...getSampleProjectConfigWithNodeNext(withNodeNext), composite: true, declaration: true, sourceMap: true, @@ -30,11 +34,12 @@ export function getFsContentsForSampleProjectReferencesLogicConfig() { ], }); } -export function getFsContentsForSampleProjectReferences(): FsContents { +export function getFsContentsForSampleProjectReferences(withNodeNext?: boolean): FsContents { return { [libFile.path]: libFile.content, "/user/username/projects/sample1/core/tsconfig.json": jsonToReadableText({ compilerOptions: { + ...getSampleProjectConfigWithNodeNext(withNodeNext), composite: true, declaration: true, declarationMap: true, @@ -48,7 +53,7 @@ export function getFsContentsForSampleProjectReferences(): FsContents { `, "/user/username/projects/sample1/core/some_decl.d.ts": `declare const dts: any;`, "/user/username/projects/sample1/core/anotherModule.ts": `export const World = "hello";`, - "/user/username/projects/sample1/logic/tsconfig.json": getFsContentsForSampleProjectReferencesLogicConfig(), + "/user/username/projects/sample1/logic/tsconfig.json": getFsContentsForSampleProjectReferencesLogicConfig(withNodeNext), "/user/username/projects/sample1/logic/index.ts": dedent` import * as c from '../core/index'; export function getSecondsInDay() { @@ -64,6 +69,7 @@ export function getFsContentsForSampleProjectReferences(): FsContents { ], files: ["index.ts"], compilerOptions: { + ...getSampleProjectConfigWithNodeNext(withNodeNext), composite: true, declaration: true, forceConsistentCasingInFileNames: true, @@ -93,9 +99,9 @@ export function getFsForSampleProjectReferences() { ); } -export function getSysForSampleProjectReferences() { +export function getSysForSampleProjectReferences(withNodeNext?: boolean) { return createWatchedSystem( - getFsContentsForSampleProjectReferences(), + getFsContentsForSampleProjectReferences(withNodeNext), { currentDirectory: "/user/username/projects/sample1", }, diff --git a/src/testRunner/unittests/tscWatch/projectsWithReferences.ts b/src/testRunner/unittests/tscWatch/projectsWithReferences.ts index 333a0629dadca..da20c7d2d8a0f 100644 --- a/src/testRunner/unittests/tscWatch/projectsWithReferences.ts +++ b/src/testRunner/unittests/tscWatch/projectsWithReferences.ts @@ -5,6 +5,7 @@ import { jsonToReadableText, } from "../helpers"; import { + getSampleProjectConfigWithNodeNext, getSysForSampleProjectReferences, } from "../helpers/sampleProjectReferences"; import { @@ -27,54 +28,63 @@ import { } from "../helpers/virtualFileSystemWithWatch"; describe("unittests:: tsc-watch:: projects with references: invoking when references are already built", () => { - verifyTscWatch({ - scenario: "projectsWithReferences", - subScenario: "on sample project", - sys: () => - solutionBuildWithBaseline( - getSysForSampleProjectReferences(), - ["tests"], - ), - commandLineArgs: ["-w", "-p", "tests", "--traceResolution", "--explainFiles"], - edits: [ - { - caption: "local edit in logic ts, and build logic", - edit: sys => { - sys.appendFile("/user/username/projects/sample1/logic/index.ts", `function foo() { }`); - const solutionBuilder = createSolutionBuilder(sys, ["logic"]); - solutionBuilder.build(); + function verify(withNodeNext: boolean) { + verifyTscWatch({ + scenario: "projectsWithReferences", + subScenario: `on sample project${withNodeNext ? " with nodenext" : ""}`, + sys: () => + solutionBuildWithBaseline( + getSysForSampleProjectReferences(withNodeNext), + ["tests"], + ), + commandLineArgs: ["-w", "-p", "tests", "--traceResolution", "--explainFiles"], + edits: [ + { + caption: "local edit in logic ts, and build logic", + edit: sys => { + sys.appendFile("/user/username/projects/sample1/logic/index.ts", `function foo() { }`); + const solutionBuilder = createSolutionBuilder(sys, ["logic"]); + solutionBuilder.build(); + }, + // not ideal, but currently because of d.ts but no new file is written + // There will be timeout queued even though file contents are same + timeouts: noop, }, - // not ideal, but currently because of d.ts but no new file is written - // There will be timeout queued even though file contents are same - timeouts: noop, - }, - { - caption: "non local edit in logic ts, and build logic", - edit: sys => { - sys.appendFile("/user/username/projects/sample1/logic/index.ts", `export function gfoo() { }`); - const solutionBuilder = createSolutionBuilder(sys, ["logic"]); - solutionBuilder.build(); + { + caption: "non local edit in logic ts, and build logic", + edit: sys => { + sys.appendFile("/user/username/projects/sample1/logic/index.ts", `export function gfoo() { }`); + const solutionBuilder = createSolutionBuilder(sys, ["logic"]); + solutionBuilder.build(); + }, + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, - timeouts: sys => sys.runQueuedTimeoutCallbacks(), - }, - { - caption: "change in project reference config file builds correctly", - edit: sys => { - sys.writeFile( - "/user/username/projects/sample1/logic/tsconfig.json", - jsonToReadableText({ - compilerOptions: { composite: true, declaration: true, declarationDir: "decls" }, - references: [{ path: "../core" }], - }), - ); - const solutionBuilder = createSolutionBuilder(sys, ["logic"]); - solutionBuilder.build(); + { + caption: "change in project reference config file builds correctly", + edit: sys => { + sys.writeFile( + "/user/username/projects/sample1/logic/tsconfig.json", + jsonToReadableText({ + compilerOptions: { + ...getSampleProjectConfigWithNodeNext(withNodeNext), + composite: true, + declaration: true, + declarationDir: "decls", + }, + references: [{ path: "../core" }], + }), + ); + const solutionBuilder = createSolutionBuilder(sys, ["logic"]); + solutionBuilder.build(); + }, + timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, - timeouts: sys => sys.runQueuedTimeoutCallbacks(), - }, - ], - baselineDependencies: true, - }); + ], + baselineDependencies: true, + }); + } + verify(/*withNodeNext*/ false); + verify(/*withNodeNext*/ true); function changeCompilerOpitonsPaths(sys: TestServerHost, config: string, newPaths: object) { const configJson = JSON.parse(sys.readFile(config)!); diff --git a/tests/baselines/reference/tscWatch/projectsWithReferences/on-sample-project-with-nodenext.js b/tests/baselines/reference/tscWatch/projectsWithReferences/on-sample-project-with-nodenext.js new file mode 100644 index 0000000000000..c8bf44787d7c4 --- /dev/null +++ b/tests/baselines/reference/tscWatch/projectsWithReferences/on-sample-project-with-nodenext.js @@ -0,0 +1,1641 @@ +currentDirectory:: /user/username/projects/sample1 useCaseSensitiveFileNames: false +Input:: +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/sample1/core/tsconfig.json] +{ + "compilerOptions": { + "module": "nodenext", + "target": "es5", + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true + } +} + +//// [/user/username/projects/sample1/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + + +//// [/user/username/projects/sample1/core/some_decl.d.ts] +declare const dts: any; + +//// [/user/username/projects/sample1/core/anotherModule.ts] +export const World = "hello"; + +//// [/user/username/projects/sample1/logic/tsconfig.json] +{ + "compilerOptions": { + "module": "nodenext", + "target": "es5", + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + }, + "references": [ + { + "path": "../core" + } + ] +} + +//// [/user/username/projects/sample1/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.multiply(10, 15); +} +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/sample1/tests/tsconfig.json] +{ + "references": [ + { + "path": "../core" + }, + { + "path": "../logic" + } + ], + "files": [ + "index.ts" + ], + "compilerOptions": { + "module": "nodenext", + "target": "es5", + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + } +} + +//// [/user/username/projects/sample1/tests/index.ts] +import * as c from '../core/index'; +import * as logic from '../logic/index'; + +c.leftPad("", 10); +logic.getSecondsInDay(); + +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/sample1/core/anotherModule.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.World = void 0; +exports.World = "hello"; + + +//// [/user/username/projects/sample1/core/anotherModule.d.ts.map] +{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"} + +//// [/user/username/projects/sample1/core/anotherModule.d.ts] +export declare const World = "hello"; +//# sourceMappingURL=anotherModule.d.ts.map + +//// [/user/username/projects/sample1/core/index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.someString = void 0; +exports.leftPad = leftPad; +exports.multiply = multiply; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +function multiply(a, b) { return a * b; } + + +//// [/user/username/projects/sample1/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} + +//// [/user/username/projects/sample1/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; +//# sourceMappingURL=index.d.ts.map + +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../a/lib/lib.d.ts","./anothermodule.ts","./index.ts","./some_decl.d.ts"],"fileInfos":[{"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,"impliedFormat":1},{"version":"-3090574810-export const World = \"hello\";","signature":"-9234818176-export declare const World = \"hello\";\n","impliedFormat":1},{"version":"-15745098553-export const someString: string = \"HELLO WORLD\";\nexport function leftPad(s: string, n: number) { return s + n; }\nexport function multiply(a: number, b: number) { return a * b; }\n","signature":"-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n","impliedFormat":1},{"version":"-7959511260-declare const dts: any;","affectsGlobalScope":true,"impliedFormat":1}],"root":[[2,4]],"options":{"composite":true,"declaration":true,"declarationMap":true,"module":199,"skipDefaultLibCheck":true,"target":1},"referencedMap":[],"semanticDiagnosticsPerFile":[1,2,3,4],"latestChangedDtsFile":"./index.d.ts"},"version":"FakeTSVersion"} + +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts", + "./some_decl.d.ts" + ], + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "original": { + "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, + "impliedFormat": 1 + }, + "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; }", + "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, + "impliedFormat": "commonjs" + }, + "./anothermodule.ts": { + "original": { + "version": "-3090574810-export const World = \"hello\";", + "signature": "-9234818176-export declare const World = \"hello\";\n", + "impliedFormat": 1 + }, + "version": "-3090574810-export const World = \"hello\";", + "signature": "-9234818176-export declare const World = \"hello\";\n", + "impliedFormat": "commonjs" + }, + "./index.ts": { + "original": { + "version": "-15745098553-export const someString: string = \"HELLO WORLD\";\nexport function leftPad(s: string, n: number) { return s + n; }\nexport function multiply(a: number, b: number) { return a * b; }\n", + "signature": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "impliedFormat": 1 + }, + "version": "-15745098553-export const someString: string = \"HELLO WORLD\";\nexport function leftPad(s: string, n: number) { return s + n; }\nexport function multiply(a: number, b: number) { return a * b; }\n", + "signature": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "impliedFormat": "commonjs" + }, + "./some_decl.d.ts": { + "original": { + "version": "-7959511260-declare const dts: any;", + "affectsGlobalScope": true, + "impliedFormat": 1 + }, + "version": "-7959511260-declare const dts: any;", + "signature": "-7959511260-declare const dts: any;", + "affectsGlobalScope": true, + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + [ + 2, + 4 + ], + [ + "./anothermodule.ts", + "./index.ts", + "./some_decl.d.ts" + ] + ] + ], + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "module": 199, + "skipDefaultLibCheck": true, + "target": 1 + }, + "referencedMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts", + "./some_decl.d.ts" + ], + "latestChangedDtsFile": "./index.d.ts" + }, + "version": "FakeTSVersion", + "size": 1466 +} + +//// [/user/username/projects/sample1/logic/index.js.map] +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,0CAEC;AAHD,+CAAmC;AACnC,SAAgB,eAAe;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AACD,yDAA6C;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} + +//// [/user/username/projects/sample1/logic/index.js] +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.m = void 0; +exports.getSecondsInDay = getSecondsInDay; +var c = __importStar(require("../core/index")); +function getSecondsInDay() { + return c.multiply(10, 15); +} +var mod = __importStar(require("../core/anotherModule")); +exports.m = mod; +//# sourceMappingURL=index.js.map + +//// [/user/username/projects/sample1/logic/index.d.ts] +export declare function getSecondsInDay(): number; +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../a/lib/lib.d.ts","../core/index.d.ts","../core/anothermodule.d.ts","./index.ts"],"fileInfos":[{"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,"impliedFormat":1},{"version":"-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n","impliedFormat":1},{"version":"-9234818176-export declare const World = \"hello\";\n","impliedFormat":1},{"version":"-9623801128-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;\n","signature":"-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedFormat":1}],"root":[4],"options":{"composite":true,"declaration":true,"module":199,"skipDefaultLibCheck":true,"sourceMap":true,"target":1},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"semanticDiagnosticsPerFile":[1,3,2,4],"latestChangedDtsFile":"./index.d.ts"},"version":"FakeTSVersion"} + +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../a/lib/lib.d.ts", + "../core/index.d.ts", + "../core/anothermodule.d.ts", + "./index.ts" + ], + "fileNamesList": [ + [ + "../core/index.d.ts", + "../core/anothermodule.d.ts" + ] + ], + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "original": { + "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, + "impliedFormat": 1 + }, + "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; }", + "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, + "impliedFormat": "commonjs" + }, + "../core/index.d.ts": { + "original": { + "version": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "impliedFormat": 1 + }, + "version": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "signature": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "impliedFormat": "commonjs" + }, + "../core/anothermodule.d.ts": { + "original": { + "version": "-9234818176-export declare const World = \"hello\";\n", + "impliedFormat": 1 + }, + "version": "-9234818176-export declare const World = \"hello\";\n", + "signature": "-9234818176-export declare const World = \"hello\";\n", + "impliedFormat": "commonjs" + }, + "./index.ts": { + "original": { + "version": "-9623801128-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "impliedFormat": 1 + }, + "version": "-9623801128-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 4, + "./index.ts" + ] + ], + "options": { + "composite": true, + "declaration": true, + "module": 199, + "skipDefaultLibCheck": true, + "sourceMap": true, + "target": 1 + }, + "referencedMap": { + "./index.ts": [ + "../core/index.d.ts", + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "./index.ts" + ], + "latestChangedDtsFile": "./index.d.ts" + }, + "version": "FakeTSVersion", + "size": 1518 +} + +//// [/user/username/projects/sample1/tests/index.js] +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.m = void 0; +var c = __importStar(require("../core/index")); +var logic = __importStar(require("../logic/index")); +c.leftPad("", 10); +logic.getSecondsInDay(); +var mod = __importStar(require("../core/anotherModule")); +exports.m = mod; + + +//// [/user/username/projects/sample1/tests/index.d.ts] +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../a/lib/lib.d.ts","../core/index.d.ts","../core/anothermodule.d.ts","../logic/index.d.ts","./index.ts"],"fileInfos":[{"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,"impliedFormat":1},{"version":"-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n","impliedFormat":1},{"version":"-9234818176-export declare const World = \"hello\";\n","impliedFormat":1},{"version":"-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedFormat":1},{"version":"-11950676699-import * as c from '../core/index';\nimport * as logic from '../logic/index';\n\nc.leftPad(\"\", 10);\nlogic.getSecondsInDay();\n\nimport * as mod from '../core/anotherModule';\nexport const m = mod;\n","signature":"2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedFormat":1}],"root":[5],"options":{"composite":true,"declaration":true,"module":199,"skipDefaultLibCheck":true,"target":1},"fileIdsList":[[3],[2,3,4]],"referencedMap":[[4,1],[5,2]],"semanticDiagnosticsPerFile":[1,3,2,4,5],"latestChangedDtsFile":"./index.d.ts"},"version":"FakeTSVersion"} + +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../a/lib/lib.d.ts", + "../core/index.d.ts", + "../core/anothermodule.d.ts", + "../logic/index.d.ts", + "./index.ts" + ], + "fileNamesList": [ + [ + "../core/anothermodule.d.ts" + ], + [ + "../core/index.d.ts", + "../core/anothermodule.d.ts", + "../logic/index.d.ts" + ] + ], + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "original": { + "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, + "impliedFormat": 1 + }, + "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; }", + "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, + "impliedFormat": "commonjs" + }, + "../core/index.d.ts": { + "original": { + "version": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "impliedFormat": 1 + }, + "version": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "signature": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "impliedFormat": "commonjs" + }, + "../core/anothermodule.d.ts": { + "original": { + "version": "-9234818176-export declare const World = \"hello\";\n", + "impliedFormat": 1 + }, + "version": "-9234818176-export declare const World = \"hello\";\n", + "signature": "-9234818176-export declare const World = \"hello\";\n", + "impliedFormat": "commonjs" + }, + "../logic/index.d.ts": { + "original": { + "version": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "impliedFormat": 1 + }, + "version": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "impliedFormat": "commonjs" + }, + "./index.ts": { + "original": { + "version": "-11950676699-import * as c from '../core/index';\nimport * as logic from '../logic/index';\n\nc.leftPad(\"\", 10);\nlogic.getSecondsInDay();\n\nimport * as mod from '../core/anotherModule';\nexport const m = mod;\n", + "signature": "2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "impliedFormat": 1 + }, + "version": "-11950676699-import * as c from '../core/index';\nimport * as logic from '../logic/index';\n\nc.leftPad(\"\", 10);\nlogic.getSecondsInDay();\n\nimport * as mod from '../core/anotherModule';\nexport const m = mod;\n", + "signature": "2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 5, + "./index.ts" + ] + ], + "options": { + "composite": true, + "declaration": true, + "module": 199, + "skipDefaultLibCheck": true, + "target": 1 + }, + "referencedMap": { + "../logic/index.d.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/index.d.ts", + "../core/anothermodule.d.ts", + "../logic/index.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts", + "./index.ts" + ], + "latestChangedDtsFile": "./index.d.ts" + }, + "version": "FakeTSVersion", + "size": 1688 +} + + +/a/lib/tsc.js -w -p tests --traceResolution --explainFiles +Output:: +>> Screen clear +[12:01:16 AM] Starting compilation in watch mode... + +File '/user/username/projects/sample1/tests/package.json' does not exist. +File '/user/username/projects/sample1/package.json' does not exist. +File '/user/username/projects/package.json' does not exist. +File '/user/username/package.json' does not exist. +File '/user/package.json' does not exist. +File '/package.json' does not exist. +======== Resolving module '../core/index' from '/user/username/projects/sample1/tests/index.ts'. ======== +Module resolution kind is not specified, using 'NodeNext'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +Loading module as file / folder, candidate module location '/user/username/projects/sample1/core/index', target file types: TypeScript, JavaScript, Declaration. +File '/user/username/projects/sample1/core/index.ts' exists - use it as a name resolution result. +======== Module name '../core/index' was successfully resolved to '/user/username/projects/sample1/core/index.ts'. ======== +======== Resolving module '../logic/index' from '/user/username/projects/sample1/tests/index.ts'. ======== +Module resolution kind is not specified, using 'NodeNext'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +Loading module as file / folder, candidate module location '/user/username/projects/sample1/logic/index', target file types: TypeScript, JavaScript, Declaration. +File '/user/username/projects/sample1/logic/index.ts' exists - use it as a name resolution result. +======== Module name '../logic/index' was successfully resolved to '/user/username/projects/sample1/logic/index.ts'. ======== +======== Resolving module '../core/anotherModule' from '/user/username/projects/sample1/tests/index.ts'. ======== +Module resolution kind is not specified, using 'NodeNext'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +Loading module as file / folder, candidate module location '/user/username/projects/sample1/core/anotherModule', target file types: TypeScript, JavaScript, Declaration. +File '/user/username/projects/sample1/core/anotherModule.ts' exists - use it as a name resolution result. +======== Module name '../core/anotherModule' was successfully resolved to '/user/username/projects/sample1/core/anotherModule.ts'. ======== +File '/user/username/projects/sample1/core/package.json' does not exist. +File '/user/username/projects/sample1/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/package.json' does not exist according to earlier cached lookups. +File '/user/username/package.json' does not exist according to earlier cached lookups. +File '/user/package.json' does not exist according to earlier cached lookups. +File '/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/sample1/logic/package.json' does not exist. +File '/user/username/projects/sample1/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/package.json' does not exist according to earlier cached lookups. +File '/user/username/package.json' does not exist according to earlier cached lookups. +File '/user/package.json' does not exist according to earlier cached lookups. +File '/package.json' does not exist according to earlier cached lookups. +======== Resolving module '../core/anotherModule' from '/user/username/projects/sample1/logic/index.ts'. ======== +Using compiler options of project reference redirect '/user/username/projects/sample1/logic/tsconfig.json'. +Module resolution kind is not specified, using 'NodeNext'. +======== Module name '../core/anotherModule' was successfully resolved to '/user/username/projects/sample1/core/anotherModule.ts'. ======== +File '/user/username/projects/sample1/core/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/sample1/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/package.json' does not exist according to earlier cached lookups. +File '/user/username/package.json' does not exist according to earlier cached lookups. +File '/user/package.json' does not exist according to earlier cached lookups. +File '/package.json' does not exist according to earlier cached lookups. +File '/a/lib/package.json' does not exist. +File '/a/package.json' does not exist. +File '/package.json' does not exist according to earlier cached lookups. +../../../../a/lib/lib.d.ts + Default library for target 'es5' +core/index.d.ts + Imported via '../core/index' from file 'tests/index.ts' + File is output of project reference source 'core/index.ts' + File is CommonJS module because 'package.json' was not found +core/anotherModule.d.ts + Imported via '../core/anotherModule' from file 'logic/index.d.ts' + Imported via '../core/anotherModule' from file 'tests/index.ts' + File is output of project reference source 'core/anotherModule.ts' + File is CommonJS module because 'package.json' was not found +logic/index.d.ts + Imported via '../logic/index' from file 'tests/index.ts' + File is output of project reference source 'logic/index.ts' + File is CommonJS module because 'package.json' was not found +tests/index.ts + Part of 'files' list in tsconfig.json + File is CommonJS module because 'package.json' was not found +[12:01:17 AM] Found 0 errors. Watching for file changes. + + + + +PolledWatches:: +/user/username/projects/node_modules/@types: *new* + {"pollingInterval":500} +/user/username/projects/package.json: *new* + {"pollingInterval":2000} +/user/username/projects/sample1/core/package.json: *new* + {"pollingInterval":2000} +/user/username/projects/sample1/logic/package.json: *new* + {"pollingInterval":2000} +/user/username/projects/sample1/node_modules/@types: *new* + {"pollingInterval":500} +/user/username/projects/sample1/package.json: *new* + {"pollingInterval":2000} +/user/username/projects/sample1/tests/node_modules/@types: *new* + {"pollingInterval":500} +/user/username/projects/sample1/tests/package.json: *new* + {"pollingInterval":2000} + +FsWatches:: +/a/lib/lib.d.ts: *new* + {} +/user/username/projects/sample1/core/anotherModule.d.ts: *new* + {} +/user/username/projects/sample1/core/index.d.ts: *new* + {} +/user/username/projects/sample1/core/tsconfig.json: *new* + {} +/user/username/projects/sample1/logic/index.d.ts: *new* + {} +/user/username/projects/sample1/logic/tsconfig.json: *new* + {} +/user/username/projects/sample1/tests/index.ts: *new* + {} +/user/username/projects/sample1/tests/tsconfig.json: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/sample1/core: *new* + {} +/user/username/projects/sample1/logic: *new* + {} + +Program root files: [ + "/user/username/projects/sample1/tests/index.ts" +] +Program options: { + "module": 199, + "target": 1, + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "project": "/user/username/projects/sample1/tests", + "traceResolution": true, + "explainFiles": true, + "configFilePath": "/user/username/projects/sample1/tests/tsconfig.json" +} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +Semantic diagnostics in builder refreshed for:: + +No shapes updated in the builder:: + +Dependencies for:: +/a/lib/lib.d.ts: + /a/lib/lib.d.ts + /user/username/projects/sample1/core/index.d.ts + /user/username/projects/sample1/core/anotherModule.d.ts + /user/username/projects/sample1/logic/index.d.ts + /user/username/projects/sample1/tests/index.ts +/user/username/projects/sample1/core/index.d.ts: + /user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts: + /user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts: + /user/username/projects/sample1/logic/index.d.ts + /user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/tests/index.ts: + /user/username/projects/sample1/tests/index.ts + /user/username/projects/sample1/core/anotherModule.d.ts + /user/username/projects/sample1/logic/index.d.ts + /user/username/projects/sample1/core/index.d.ts + +exitCode:: ExitStatus.undefined + +Change:: local edit in logic ts, and build logic + +Input:: +//// [/user/username/projects/sample1/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.multiply(10, 15); +} +import * as mod from '../core/anotherModule'; +export const m = mod; +function foo() { } + +//// [/user/username/projects/sample1/logic/index.js.map] +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,0CAEC;AAHD,+CAAmC;AACnC,SAAgB,eAAe;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AACD,yDAA6C;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC;AACrB,SAAS,GAAG,KAAK,CAAC"} + +//// [/user/username/projects/sample1/logic/index.js] +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.m = void 0; +exports.getSecondsInDay = getSecondsInDay; +var c = __importStar(require("../core/index")); +function getSecondsInDay() { + return c.multiply(10, 15); +} +var mod = __importStar(require("../core/anotherModule")); +exports.m = mod; +function foo() { } +//# sourceMappingURL=index.js.map + +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../a/lib/lib.d.ts","../core/index.d.ts","../core/anothermodule.d.ts","./index.ts"],"fileInfos":[{"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,"impliedFormat":1},{"version":"-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n","impliedFormat":1},{"version":"-9234818176-export declare const World = \"hello\";\n","impliedFormat":1},{"version":"-6497638357-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;\nfunction foo() { }","signature":"-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedFormat":1}],"root":[4],"options":{"composite":true,"declaration":true,"module":199,"skipDefaultLibCheck":true,"sourceMap":true,"target":1},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"semanticDiagnosticsPerFile":[1,3,2,4],"latestChangedDtsFile":"./index.d.ts"},"version":"FakeTSVersion"} + +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../a/lib/lib.d.ts", + "../core/index.d.ts", + "../core/anothermodule.d.ts", + "./index.ts" + ], + "fileNamesList": [ + [ + "../core/index.d.ts", + "../core/anothermodule.d.ts" + ] + ], + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "original": { + "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, + "impliedFormat": 1 + }, + "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; }", + "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, + "impliedFormat": "commonjs" + }, + "../core/index.d.ts": { + "original": { + "version": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "impliedFormat": 1 + }, + "version": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "signature": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "impliedFormat": "commonjs" + }, + "../core/anothermodule.d.ts": { + "original": { + "version": "-9234818176-export declare const World = \"hello\";\n", + "impliedFormat": 1 + }, + "version": "-9234818176-export declare const World = \"hello\";\n", + "signature": "-9234818176-export declare const World = \"hello\";\n", + "impliedFormat": "commonjs" + }, + "./index.ts": { + "original": { + "version": "-6497638357-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;\nfunction foo() { }", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "impliedFormat": 1 + }, + "version": "-6497638357-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;\nfunction foo() { }", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 4, + "./index.ts" + ] + ], + "options": { + "composite": true, + "declaration": true, + "module": 199, + "skipDefaultLibCheck": true, + "sourceMap": true, + "target": 1 + }, + "referencedMap": { + "./index.ts": [ + "../core/index.d.ts", + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "./index.ts" + ], + "latestChangedDtsFile": "./index.d.ts" + }, + "version": "FakeTSVersion", + "size": 1536 +} + + + +exitCode:: ExitStatus.undefined + +Change:: non local edit in logic ts, and build logic + +Input:: +//// [/user/username/projects/sample1/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.multiply(10, 15); +} +import * as mod from '../core/anotherModule'; +export const m = mod; +function foo() { }export function gfoo() { } + +//// [/user/username/projects/sample1/logic/index.js.map] +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,0CAEC;AAGiB,oBAA0B;AAN5C,+CAAmC;AACnC,SAAgB,eAAe;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AACD,yDAA6C;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC;AACrB,SAAS,GAAG,KAAK,CAAC;AAAA,SAAgB,IAAI,KAAK,CAAC"} + +//// [/user/username/projects/sample1/logic/index.js] +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.m = void 0; +exports.getSecondsInDay = getSecondsInDay; +exports.gfoo = gfoo; +var c = __importStar(require("../core/index")); +function getSecondsInDay() { + return c.multiply(10, 15); +} +var mod = __importStar(require("../core/anotherModule")); +exports.m = mod; +function foo() { } +function gfoo() { } +//# sourceMappingURL=index.js.map + +//// [/user/username/projects/sample1/logic/index.d.ts] +export declare function getSecondsInDay(): number; +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; +export declare function gfoo(): void; + + +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../a/lib/lib.d.ts","../core/index.d.ts","../core/anothermodule.d.ts","./index.ts"],"fileInfos":[{"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,"impliedFormat":1},{"version":"-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n","impliedFormat":1},{"version":"-9234818176-export declare const World = \"hello\";\n","impliedFormat":1},{"version":"-1796860121-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;\nfunction foo() { }export function gfoo() { }","signature":"-11367551051-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\nexport declare function gfoo(): void;\n","impliedFormat":1}],"root":[4],"options":{"composite":true,"declaration":true,"module":199,"skipDefaultLibCheck":true,"sourceMap":true,"target":1},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"semanticDiagnosticsPerFile":[1,3,2,4],"latestChangedDtsFile":"./index.d.ts"},"version":"FakeTSVersion"} + +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../a/lib/lib.d.ts", + "../core/index.d.ts", + "../core/anothermodule.d.ts", + "./index.ts" + ], + "fileNamesList": [ + [ + "../core/index.d.ts", + "../core/anothermodule.d.ts" + ] + ], + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "original": { + "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, + "impliedFormat": 1 + }, + "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; }", + "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, + "impliedFormat": "commonjs" + }, + "../core/index.d.ts": { + "original": { + "version": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "impliedFormat": 1 + }, + "version": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "signature": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "impliedFormat": "commonjs" + }, + "../core/anothermodule.d.ts": { + "original": { + "version": "-9234818176-export declare const World = \"hello\";\n", + "impliedFormat": 1 + }, + "version": "-9234818176-export declare const World = \"hello\";\n", + "signature": "-9234818176-export declare const World = \"hello\";\n", + "impliedFormat": "commonjs" + }, + "./index.ts": { + "original": { + "version": "-1796860121-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;\nfunction foo() { }export function gfoo() { }", + "signature": "-11367551051-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\nexport declare function gfoo(): void;\n", + "impliedFormat": 1 + }, + "version": "-1796860121-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;\nfunction foo() { }export function gfoo() { }", + "signature": "-11367551051-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\nexport declare function gfoo(): void;\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 4, + "./index.ts" + ] + ], + "options": { + "composite": true, + "declaration": true, + "module": 199, + "skipDefaultLibCheck": true, + "sourceMap": true, + "target": 1 + }, + "referencedMap": { + "./index.ts": [ + "../core/index.d.ts", + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "./index.ts" + ], + "latestChangedDtsFile": "./index.d.ts" + }, + "version": "FakeTSVersion", + "size": 1602 +} + + +Timeout callback:: count: 1 +1: timerToUpdateProgram *new* + +Before running Timeout callback:: count: 1 +1: timerToUpdateProgram + +After running Timeout callback:: count: 0 +Output:: +>> Screen clear +[12:01:51 AM] File change detected. Starting incremental compilation... + +File '/a/lib/package.json' does not exist according to earlier cached lookups. +File '/a/package.json' does not exist according to earlier cached lookups. +File '/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/sample1/core/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/sample1/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/package.json' does not exist according to earlier cached lookups. +File '/user/username/package.json' does not exist according to earlier cached lookups. +File '/user/package.json' does not exist according to earlier cached lookups. +File '/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/sample1/core/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/sample1/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/package.json' does not exist according to earlier cached lookups. +File '/user/username/package.json' does not exist according to earlier cached lookups. +File '/user/package.json' does not exist according to earlier cached lookups. +File '/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/sample1/logic/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/sample1/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/package.json' does not exist according to earlier cached lookups. +File '/user/username/package.json' does not exist according to earlier cached lookups. +File '/user/package.json' does not exist according to earlier cached lookups. +File '/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/sample1/tests/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/sample1/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/package.json' does not exist according to earlier cached lookups. +File '/user/username/package.json' does not exist according to earlier cached lookups. +File '/user/package.json' does not exist according to earlier cached lookups. +File '/package.json' does not exist according to earlier cached lookups. +Reusing resolution of module '../core/anotherModule' from '/user/username/projects/sample1/logic/index.ts' of old program, it was successfully resolved to '/user/username/projects/sample1/core/anotherModule.ts'. +../../../../a/lib/lib.d.ts + Default library for target 'es5' +core/index.d.ts + Imported via '../core/index' from file 'tests/index.ts' + File is output of project reference source 'core/index.ts' + File is CommonJS module because 'package.json' was not found +core/anotherModule.d.ts + Imported via '../core/anotherModule' from file 'logic/index.d.ts' + Imported via '../core/anotherModule' from file 'tests/index.ts' + File is output of project reference source 'core/anotherModule.ts' + File is CommonJS module because 'package.json' was not found +logic/index.d.ts + Imported via '../logic/index' from file 'tests/index.ts' + File is output of project reference source 'logic/index.ts' + File is CommonJS module because 'package.json' was not found +tests/index.ts + Part of 'files' list in tsconfig.json + File is CommonJS module because 'package.json' was not found +[12:01:58 AM] Found 0 errors. Watching for file changes. + + + +//// [/user/username/projects/sample1/tests/index.js] file written with same contents +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../a/lib/lib.d.ts","../core/index.d.ts","../core/anothermodule.d.ts","../logic/index.d.ts","./index.ts"],"fileInfos":[{"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,"impliedFormat":1},{"version":"-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n","impliedFormat":1},{"version":"-9234818176-export declare const World = \"hello\";\n","impliedFormat":1},{"version":"-11367551051-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\nexport declare function gfoo(): void;\n","impliedFormat":1},{"version":"-11950676699-import * as c from '../core/index';\nimport * as logic from '../logic/index';\n\nc.leftPad(\"\", 10);\nlogic.getSecondsInDay();\n\nimport * as mod from '../core/anotherModule';\nexport const m = mod;\n","signature":"2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedFormat":1}],"root":[5],"options":{"composite":true,"declaration":true,"module":199,"skipDefaultLibCheck":true,"target":1},"fileIdsList":[[3],[2,3,4]],"referencedMap":[[4,1],[5,2]],"semanticDiagnosticsPerFile":[1,3,2,4,5],"latestChangedDtsFile":"./index.d.ts"},"version":"FakeTSVersion"} + +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../a/lib/lib.d.ts", + "../core/index.d.ts", + "../core/anothermodule.d.ts", + "../logic/index.d.ts", + "./index.ts" + ], + "fileNamesList": [ + [ + "../core/anothermodule.d.ts" + ], + [ + "../core/index.d.ts", + "../core/anothermodule.d.ts", + "../logic/index.d.ts" + ] + ], + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "original": { + "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, + "impliedFormat": 1 + }, + "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; }", + "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, + "impliedFormat": "commonjs" + }, + "../core/index.d.ts": { + "original": { + "version": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "impliedFormat": 1 + }, + "version": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "signature": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "impliedFormat": "commonjs" + }, + "../core/anothermodule.d.ts": { + "original": { + "version": "-9234818176-export declare const World = \"hello\";\n", + "impliedFormat": 1 + }, + "version": "-9234818176-export declare const World = \"hello\";\n", + "signature": "-9234818176-export declare const World = \"hello\";\n", + "impliedFormat": "commonjs" + }, + "../logic/index.d.ts": { + "original": { + "version": "-11367551051-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\nexport declare function gfoo(): void;\n", + "impliedFormat": 1 + }, + "version": "-11367551051-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\nexport declare function gfoo(): void;\n", + "signature": "-11367551051-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\nexport declare function gfoo(): void;\n", + "impliedFormat": "commonjs" + }, + "./index.ts": { + "original": { + "version": "-11950676699-import * as c from '../core/index';\nimport * as logic from '../logic/index';\n\nc.leftPad(\"\", 10);\nlogic.getSecondsInDay();\n\nimport * as mod from '../core/anotherModule';\nexport const m = mod;\n", + "signature": "2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "impliedFormat": 1 + }, + "version": "-11950676699-import * as c from '../core/index';\nimport * as logic from '../logic/index';\n\nc.leftPad(\"\", 10);\nlogic.getSecondsInDay();\n\nimport * as mod from '../core/anotherModule';\nexport const m = mod;\n", + "signature": "2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 5, + "./index.ts" + ] + ], + "options": { + "composite": true, + "declaration": true, + "module": 199, + "skipDefaultLibCheck": true, + "target": 1 + }, + "referencedMap": { + "../logic/index.d.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/index.d.ts", + "../core/anothermodule.d.ts", + "../logic/index.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts", + "./index.ts" + ], + "latestChangedDtsFile": "./index.d.ts" + }, + "version": "FakeTSVersion", + "size": 1728 +} + + + +Program root files: [ + "/user/username/projects/sample1/tests/index.ts" +] +Program options: { + "module": 199, + "target": 1, + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "project": "/user/username/projects/sample1/tests", + "traceResolution": true, + "explainFiles": true, + "configFilePath": "/user/username/projects/sample1/tests/tsconfig.json" +} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/sample1/logic/index.d.ts (used version) +/user/username/projects/sample1/tests/index.ts (computed .d.ts) + +Dependencies for:: +/a/lib/lib.d.ts: + /a/lib/lib.d.ts + /user/username/projects/sample1/core/index.d.ts + /user/username/projects/sample1/core/anotherModule.d.ts + /user/username/projects/sample1/logic/index.d.ts + /user/username/projects/sample1/tests/index.ts +/user/username/projects/sample1/core/index.d.ts: + /user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts: + /user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts: + /user/username/projects/sample1/logic/index.d.ts + /user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/tests/index.ts: + /user/username/projects/sample1/tests/index.ts + /user/username/projects/sample1/core/anotherModule.d.ts + /user/username/projects/sample1/logic/index.d.ts + /user/username/projects/sample1/core/index.d.ts + +exitCode:: ExitStatus.undefined + +Change:: change in project reference config file builds correctly + +Input:: +//// [/user/username/projects/sample1/logic/tsconfig.json] +{ + "compilerOptions": { + "module": "nodenext", + "target": "es5", + "composite": true, + "declaration": true, + "declarationDir": "decls" + }, + "references": [ + { + "path": "../core" + } + ] +} + +//// [/user/username/projects/sample1/logic/index.js] +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.m = void 0; +exports.getSecondsInDay = getSecondsInDay; +exports.gfoo = gfoo; +var c = __importStar(require("../core/index")); +function getSecondsInDay() { + return c.multiply(10, 15); +} +var mod = __importStar(require("../core/anotherModule")); +exports.m = mod; +function foo() { } +function gfoo() { } + + +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../a/lib/lib.d.ts","../core/index.d.ts","../core/anothermodule.d.ts","./index.ts"],"fileInfos":[{"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,"impliedFormat":1},{"version":"-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n","impliedFormat":1},{"version":"-9234818176-export declare const World = \"hello\";\n","impliedFormat":1},{"version":"-1796860121-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;\nfunction foo() { }export function gfoo() { }","signature":"-11367551051-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\nexport declare function gfoo(): void;\n","impliedFormat":1}],"root":[4],"options":{"composite":true,"declaration":true,"declarationDir":"./decls","module":199,"target":1},"fileIdsList":[[2,3]],"referencedMap":[[4,1]],"semanticDiagnosticsPerFile":[1,3,2,4],"latestChangedDtsFile":"./decls/index.d.ts"},"version":"FakeTSVersion"} + +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../a/lib/lib.d.ts", + "../core/index.d.ts", + "../core/anothermodule.d.ts", + "./index.ts" + ], + "fileNamesList": [ + [ + "../core/index.d.ts", + "../core/anothermodule.d.ts" + ] + ], + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "original": { + "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, + "impliedFormat": 1 + }, + "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; }", + "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, + "impliedFormat": "commonjs" + }, + "../core/index.d.ts": { + "original": { + "version": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "impliedFormat": 1 + }, + "version": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "signature": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "impliedFormat": "commonjs" + }, + "../core/anothermodule.d.ts": { + "original": { + "version": "-9234818176-export declare const World = \"hello\";\n", + "impliedFormat": 1 + }, + "version": "-9234818176-export declare const World = \"hello\";\n", + "signature": "-9234818176-export declare const World = \"hello\";\n", + "impliedFormat": "commonjs" + }, + "./index.ts": { + "original": { + "version": "-1796860121-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;\nfunction foo() { }export function gfoo() { }", + "signature": "-11367551051-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\nexport declare function gfoo(): void;\n", + "impliedFormat": 1 + }, + "version": "-1796860121-import * as c from '../core/index';\nexport function getSecondsInDay() {\n return c.multiply(10, 15);\n}\nimport * as mod from '../core/anotherModule';\nexport const m = mod;\nfunction foo() { }export function gfoo() { }", + "signature": "-11367551051-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\nexport declare function gfoo(): void;\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 4, + "./index.ts" + ] + ], + "options": { + "composite": true, + "declaration": true, + "declarationDir": "./decls", + "module": 199, + "target": 1 + }, + "referencedMap": { + "./index.ts": [ + "../core/index.d.ts", + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "./index.ts" + ], + "latestChangedDtsFile": "./decls/index.d.ts" + }, + "version": "FakeTSVersion", + "size": 1591 +} + +//// [/user/username/projects/sample1/logic/decls/index.d.ts] +export declare function getSecondsInDay(): number; +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; +export declare function gfoo(): void; + + + +Timeout callback:: count: 1 +2: timerToUpdateProgram *new* + +Before running Timeout callback:: count: 1 +2: timerToUpdateProgram + +After running Timeout callback:: count: 0 +Output:: +>> Screen clear +[12:02:20 AM] File change detected. Starting incremental compilation... + +File '/user/username/projects/sample1/tests/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/sample1/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/package.json' does not exist according to earlier cached lookups. +File '/user/username/package.json' does not exist according to earlier cached lookups. +File '/user/package.json' does not exist according to earlier cached lookups. +File '/package.json' does not exist according to earlier cached lookups. +Reusing resolution of module '../core/index' from '/user/username/projects/sample1/tests/index.ts' of old program, it was successfully resolved to '/user/username/projects/sample1/core/index.ts'. +Reusing resolution of module '../logic/index' from '/user/username/projects/sample1/tests/index.ts' of old program, it was successfully resolved to '/user/username/projects/sample1/logic/index.ts'. +Reusing resolution of module '../core/anotherModule' from '/user/username/projects/sample1/tests/index.ts' of old program, it was successfully resolved to '/user/username/projects/sample1/core/anotherModule.ts'. +File '/user/username/projects/sample1/core/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/sample1/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/package.json' does not exist according to earlier cached lookups. +File '/user/username/package.json' does not exist according to earlier cached lookups. +File '/user/package.json' does not exist according to earlier cached lookups. +File '/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/sample1/logic/decls/package.json' does not exist. +File '/user/username/projects/sample1/logic/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/sample1/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/package.json' does not exist according to earlier cached lookups. +File '/user/username/package.json' does not exist according to earlier cached lookups. +File '/user/package.json' does not exist according to earlier cached lookups. +File '/package.json' does not exist according to earlier cached lookups. +======== Resolving module '../core/anotherModule' from '/user/username/projects/sample1/logic/index.ts'. ======== +Using compiler options of project reference redirect '/user/username/projects/sample1/logic/tsconfig.json'. +Module resolution kind is not specified, using 'NodeNext'. +======== Module name '../core/anotherModule' was successfully resolved to '/user/username/projects/sample1/core/anotherModule.ts'. ======== +File '/user/username/projects/sample1/core/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/sample1/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/package.json' does not exist according to earlier cached lookups. +File '/user/username/package.json' does not exist according to earlier cached lookups. +File '/user/package.json' does not exist according to earlier cached lookups. +File '/package.json' does not exist according to earlier cached lookups. +File '/a/lib/package.json' does not exist according to earlier cached lookups. +File '/a/package.json' does not exist according to earlier cached lookups. +File '/package.json' does not exist according to earlier cached lookups. +../../../../a/lib/lib.d.ts + Default library for target 'es5' +core/index.d.ts + Imported via '../core/index' from file 'tests/index.ts' + File is output of project reference source 'core/index.ts' + File is CommonJS module because 'package.json' was not found +core/anotherModule.d.ts + Imported via '../core/anotherModule' from file 'logic/decls/index.d.ts' + Imported via '../core/anotherModule' from file 'tests/index.ts' + File is output of project reference source 'core/anotherModule.ts' + File is CommonJS module because 'package.json' was not found +logic/decls/index.d.ts + Imported via '../logic/index' from file 'tests/index.ts' + File is output of project reference source 'logic/index.ts' + File is CommonJS module because 'package.json' was not found +tests/index.ts + Part of 'files' list in tsconfig.json + File is CommonJS module because 'package.json' was not found +[12:02:27 AM] Found 0 errors. Watching for file changes. + + + +//// [/user/username/projects/sample1/tests/index.js] file written with same contents +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../../a/lib/lib.d.ts","../core/index.d.ts","../core/anothermodule.d.ts","../logic/decls/index.d.ts","./index.ts"],"fileInfos":[{"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,"impliedFormat":1},{"version":"-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n","impliedFormat":1},{"version":"-9234818176-export declare const World = \"hello\";\n","impliedFormat":1},{"version":"-11367551051-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\nexport declare function gfoo(): void;\n","impliedFormat":1},{"version":"-11950676699-import * as c from '../core/index';\nimport * as logic from '../logic/index';\n\nc.leftPad(\"\", 10);\nlogic.getSecondsInDay();\n\nimport * as mod from '../core/anotherModule';\nexport const m = mod;\n","signature":"2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedFormat":1}],"root":[5],"options":{"composite":true,"declaration":true,"module":199,"skipDefaultLibCheck":true,"target":1},"fileIdsList":[[3],[2,3,4]],"referencedMap":[[4,1],[5,2]],"semanticDiagnosticsPerFile":[1,3,2,4,5],"latestChangedDtsFile":"./index.d.ts"},"version":"FakeTSVersion"} + +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../../a/lib/lib.d.ts", + "../core/index.d.ts", + "../core/anothermodule.d.ts", + "../logic/decls/index.d.ts", + "./index.ts" + ], + "fileNamesList": [ + [ + "../core/anothermodule.d.ts" + ], + [ + "../core/index.d.ts", + "../core/anothermodule.d.ts", + "../logic/decls/index.d.ts" + ] + ], + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "original": { + "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, + "impliedFormat": 1 + }, + "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; }", + "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, + "impliedFormat": "commonjs" + }, + "../core/index.d.ts": { + "original": { + "version": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "impliedFormat": 1 + }, + "version": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "signature": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "impliedFormat": "commonjs" + }, + "../core/anothermodule.d.ts": { + "original": { + "version": "-9234818176-export declare const World = \"hello\";\n", + "impliedFormat": 1 + }, + "version": "-9234818176-export declare const World = \"hello\";\n", + "signature": "-9234818176-export declare const World = \"hello\";\n", + "impliedFormat": "commonjs" + }, + "../logic/decls/index.d.ts": { + "original": { + "version": "-11367551051-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\nexport declare function gfoo(): void;\n", + "impliedFormat": 1 + }, + "version": "-11367551051-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\nexport declare function gfoo(): void;\n", + "signature": "-11367551051-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\nexport declare function gfoo(): void;\n", + "impliedFormat": "commonjs" + }, + "./index.ts": { + "original": { + "version": "-11950676699-import * as c from '../core/index';\nimport * as logic from '../logic/index';\n\nc.leftPad(\"\", 10);\nlogic.getSecondsInDay();\n\nimport * as mod from '../core/anotherModule';\nexport const m = mod;\n", + "signature": "2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "impliedFormat": 1 + }, + "version": "-11950676699-import * as c from '../core/index';\nimport * as logic from '../logic/index';\n\nc.leftPad(\"\", 10);\nlogic.getSecondsInDay();\n\nimport * as mod from '../core/anotherModule';\nexport const m = mod;\n", + "signature": "2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "impliedFormat": "commonjs" + } + }, + "root": [ + [ + 5, + "./index.ts" + ] + ], + "options": { + "composite": true, + "declaration": true, + "module": 199, + "skipDefaultLibCheck": true, + "target": 1 + }, + "referencedMap": { + "../logic/decls/index.d.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/index.d.ts", + "../core/anothermodule.d.ts", + "../logic/decls/index.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/decls/index.d.ts", + "./index.ts" + ], + "latestChangedDtsFile": "./index.d.ts" + }, + "version": "FakeTSVersion", + "size": 1734 +} + + +PolledWatches:: +/user/username/projects/node_modules/@types: + {"pollingInterval":500} +/user/username/projects/package.json: + {"pollingInterval":2000} +/user/username/projects/sample1/core/package.json: + {"pollingInterval":2000} +/user/username/projects/sample1/logic/package.json: + {"pollingInterval":2000} +/user/username/projects/sample1/node_modules/@types: + {"pollingInterval":500} +/user/username/projects/sample1/package.json: + {"pollingInterval":2000} +/user/username/projects/sample1/tests/node_modules/@types: + {"pollingInterval":500} +/user/username/projects/sample1/tests/package.json: + {"pollingInterval":2000} + +FsWatches:: +/a/lib/lib.d.ts: + {} +/user/username/projects/sample1/core/anotherModule.d.ts: + {} +/user/username/projects/sample1/core/index.d.ts: + {} +/user/username/projects/sample1/core/tsconfig.json: + {} +/user/username/projects/sample1/logic/decls/index.d.ts: *new* + {} +/user/username/projects/sample1/logic/tsconfig.json: + {} +/user/username/projects/sample1/tests/index.ts: + {} +/user/username/projects/sample1/tests/tsconfig.json: + {} + +FsWatches *deleted*:: +/user/username/projects/sample1/logic/index.d.ts: + {} + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {} +/user/username/projects/sample1/logic: + {} + + +Program root files: [ + "/user/username/projects/sample1/tests/index.ts" +] +Program options: { + "module": 199, + "target": 1, + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "project": "/user/username/projects/sample1/tests", + "traceResolution": true, + "explainFiles": true, + "configFilePath": "/user/username/projects/sample1/tests/tsconfig.json" +} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/decls/index.d.ts +/user/username/projects/sample1/tests/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/logic/decls/index.d.ts +/user/username/projects/sample1/tests/index.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/sample1/logic/decls/index.d.ts (used version) +/user/username/projects/sample1/tests/index.ts (computed .d.ts) + +Dependencies for:: +/a/lib/lib.d.ts: + /a/lib/lib.d.ts + /user/username/projects/sample1/core/index.d.ts + /user/username/projects/sample1/core/anotherModule.d.ts + /user/username/projects/sample1/logic/decls/index.d.ts + /user/username/projects/sample1/tests/index.ts +/user/username/projects/sample1/core/index.d.ts: + /user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts: + /user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/decls/index.d.ts: + /user/username/projects/sample1/logic/decls/index.d.ts + /user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/tests/index.ts: + /user/username/projects/sample1/tests/index.ts + /user/username/projects/sample1/core/anotherModule.d.ts + /user/username/projects/sample1/logic/decls/index.d.ts + /user/username/projects/sample1/core/index.d.ts + +exitCode:: ExitStatus.undefined From 4c8f1fc5f8d8d833a5b108e2d06bf295ec76de68 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Mon, 25 Mar 2024 10:20:23 -0700 Subject: [PATCH 2/2] Fix incorrect use of "path" instead of "resolvedPath" when watching file's package json lookup locations --- src/compiler/resolutionCache.ts | 6 +++--- .../on-sample-project-with-nodenext.js | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/compiler/resolutionCache.ts b/src/compiler/resolutionCache.ts index 375083077b241..347d3458563d9 100644 --- a/src/compiler/resolutionCache.ts +++ b/src/compiler/resolutionCache.ts @@ -737,7 +737,7 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD cleanupLibResolutionWatching(newProgram); newProgram?.getSourceFiles().forEach(newFile => { const expected = isExternalOrCommonJsModule(newFile) ? newFile.packageJsonLocations?.length ?? 0 : 0; - const existing = impliedFormatPackageJsons.get(newFile.path) ?? emptyArray; + const existing = impliedFormatPackageJsons.get(newFile.resolvedPath) ?? emptyArray; for (let i = existing.length; i < expected; i++) { createFileWatcherOfAffectingLocation(newFile.packageJsonLocations![i], /*forResolution*/ false); } @@ -746,8 +746,8 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD fileWatchesOfAffectingLocations.get(existing[i])!.files--; } } - if (expected) impliedFormatPackageJsons.set(newFile.path, newFile.packageJsonLocations!); - else impliedFormatPackageJsons.delete(newFile.path); + if (expected) impliedFormatPackageJsons.set(newFile.resolvedPath, newFile.packageJsonLocations!); + else impliedFormatPackageJsons.delete(newFile.resolvedPath); }); impliedFormatPackageJsons.forEach((existing, path) => { if (!newProgram?.getSourceFileByPath(path)) { diff --git a/tests/baselines/reference/tscWatch/projectsWithReferences/on-sample-project-with-nodenext.js b/tests/baselines/reference/tscWatch/projectsWithReferences/on-sample-project-with-nodenext.js index c8bf44787d7c4..0c62036ac17c8 100644 --- a/tests/baselines/reference/tscWatch/projectsWithReferences/on-sample-project-with-nodenext.js +++ b/tests/baselines/reference/tscWatch/projectsWithReferences/on-sample-project-with-nodenext.js @@ -1546,6 +1546,8 @@ PolledWatches:: {"pollingInterval":2000} /user/username/projects/sample1/core/package.json: {"pollingInterval":2000} +/user/username/projects/sample1/logic/decls/package.json: *new* + {"pollingInterval":2000} /user/username/projects/sample1/logic/package.json: {"pollingInterval":2000} /user/username/projects/sample1/node_modules/@types: