Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always resolve package.json exports in type reference directives #58638

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update missing baselines
  • Loading branch information
andrewbranch committed May 23, 2024
commit 3b2c8682d1eae17ff1477372fed0f795d5547ade
2 changes: 1 addition & 1 deletion src/harness/fourslashImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2352,7 2352,7 @@ export class TestState {
}

public baselineSyntacticAndSemanticDiagnostics() {
const files = ts.filter(this.getCompilerTestFiles(), f => !ts.endsWith(f.unitName, ".json") && !!this.languageService.getProgram()!.getSourceFile(f.unitName));
const files = ts.filter(this.getCompilerTestFiles(), f => !ts.endsWith(f.unitName, ".json") && (this.testType === FourSlashTestType.Server || !!this.languageService.getProgram()!.getSourceFile(f.unitName)));
const result = this.getSyntacticDiagnosticBaselineText(files)
Harness.IO.newLine()
Harness.IO.newLine()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 13,7 @@ export const a = <div></div>;
"main": "",
"types": "index.d.ts",
"exports": {
".": "./index.d.ts",
"./*.js": "./*.js",
"./*": "./*.js"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 154,15 @@ Info seq [hh:mm:ss:mss] event:
}
Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/inferredProject1*
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /node_modules/@types/dependency/package.json 2000 undefined Project: /dev/null/inferredProject1* WatchType: File location affecting resolution
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /node_modules/@types/dependency/lib/package.json 2000 undefined Project: /dev/null/inferredProject1* WatchType: File location affecting resolution
Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* projectStateVersion: 1 projectProgramVersion: 0 structureChanged: true structureIsReused:: Not Elapsed:: *ms
Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred)
Info seq [hh:mm:ss:mss] Files (4)
Info seq [hh:mm:ss:mss] Files (5)
/lib.d.ts Text-1 lib.d.ts-Text
/lib.decorators.d.ts Text-1 lib.decorators.d.ts-Text
/lib.decorators.legacy.d.ts Text-1 lib.decorators.legacy.d.ts-Text
/tsconfig.json SVC-1-0 "{\n \"compilerOptions\": {\n \"module\": \"nodenext\"\n }\n}"
/node_modules/@types/dependency/lib/index.d.ts Text-1 "export declare function fooFromIndex(): void;"


lib.d.ts
Expand All @@ -171,6 173,9 @@ Info seq [hh:mm:ss:mss] Files (4)
Library referenced via 'decorators.legacy' from file 'lib.d.ts'
tsconfig.json
Root file specified for compilation
node_modules/@types/dependency/lib/index.d.ts
Entry point for implicit type library 'dependency' with packageId '@types/dependency/lib/[email protected]'
File is ECMAScript module because 'node_modules/@types/dependency/package.json' has field "type" with value "module"

Info seq [hh:mm:ss:mss] -----------------------------------------------
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /package.json 250 undefined WatchType: package.json file
Expand All @@ -179,7 184,7 @@ Info seq [hh:mm:ss:mss] Files (5)

Info seq [hh:mm:ss:mss] -----------------------------------------------
Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred)
Info seq [hh:mm:ss:mss] Files (4)
Info seq [hh:mm:ss:mss] Files (5)

Info seq [hh:mm:ss:mss] -----------------------------------------------
Info seq [hh:mm:ss:mss] Open files:
Expand All @@ -197,6 202,7 @@ watchedFiles::
{"pollingInterval":500}
/node_modules/@types/dependency/lib/package.json: *new*
{"pollingInterval":2000}
{"pollingInterval":2000}
/node_modules/@types/dependency/package.json: *new*
{"pollingInterval":2000}
{"pollingInterval":2000}
Expand Down Expand Up @@ -238,8 244,9 @@ ScriptInfos::
/dev/null/inferredProject1*
/node_modules/@types/dependency/lib/index.d.ts *new*
version: Text-1
containingProjects: 1
containingProjects: 2
/tsconfig.json
/dev/null/inferredProject1*
/src/foo.ts *new*
version: Text-1
containingProjects: 1
Expand All @@ -265,7 272,7 @@ Info seq [hh:mm:ss:mss] Files (5)

Info seq [hh:mm:ss:mss] -----------------------------------------------
Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred)
Info seq [hh:mm:ss:mss] Files (4)
Info seq [hh:mm:ss:mss] Files (5)

Info seq [hh:mm:ss:mss] -----------------------------------------------
Info seq [hh:mm:ss:mss] Open files:
Expand All @@ -285,6 292,7 @@ watchedFiles::
{"pollingInterval":500}
/node_modules/@types/dependency/lib/package.json:
{"pollingInterval":2000}
{"pollingInterval":2000}
/node_modules/@types/dependency/package.json:
{"pollingInterval":2000}
{"pollingInterval":2000}
Expand Down Expand Up @@ -328,8 336,9 @@ ScriptInfos::
/dev/null/inferredProject1*
/node_modules/@types/dependency/lib/index.d.ts
version: Text-1
containingProjects: 1
containingProjects: 2
/tsconfig.json
/dev/null/inferredProject1*
/src/foo.ts (Open) *changed*
open: true *changed*
version: Text-1
Expand Down Expand Up @@ -1140,6 1149,7 @@ watchedFiles::
/node_modules/@types/dependency/lib/lol.d.ts: *new*
{"pollingInterval":500}
/node_modules/@types/dependency/lib/package.json:
{"pollingInterval":2000}
{"pollingInterval":2000}
{"pollingInterval":2000} *new*
/node_modules/@types/dependency/package.json:
Expand Down Expand Up @@ -1187,8 1197,9 @@ ScriptInfos::
/dev/null/inferredProject1*
/node_modules/@types/dependency/lib/index.d.ts
version: Text-1
containingProjects: 1
containingProjects: 2
/tsconfig.json
/dev/null/inferredProject1*
/node_modules/@types/dependency/lib/lol.d.ts *new*
version: Text-1
containingProjects: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 66,8 @@ fooFrom
//// [/tsconfig.json]
{
"compilerOptions": {
"module": "nodenext"
"module": "nodenext",
"types": []
}
}

Expand Down Expand Up @@ -102,6 103,7 @@ Info seq [hh:mm:ss:mss] Config: /tsconfig.json : {
],
"options": {
"module": 199,
"types": [],
"configFilePath": "/tsconfig.json"
}
}
Expand All @@ -112,17 114,13 @@ Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /lib.decorators.d.ts 5
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /lib.decorators.legacy.d.ts 500 undefined WatchType: Closed Script info
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /src/foo.ts 500 undefined WatchType: Closed Script info
Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /tsconfig.json
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /node_modules/@types/dependency/package.json 2000 undefined Project: /tsconfig.json WatchType: File location affecting resolution
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /node_modules/@types/dependency/lib/index.d.ts 500 undefined WatchType: Closed Script info
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /node_modules/@types/dependency/lib/package.json 2000 undefined Project: /tsconfig.json WatchType: File location affecting resolution
Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /tsconfig.json projectStateVersion: 1 projectProgramVersion: 0 structureChanged: true structureIsReused:: Not Elapsed:: *ms
Info seq [hh:mm:ss:mss] Project '/tsconfig.json' (Configured)
Info seq [hh:mm:ss:mss] Files (5)
Info seq [hh:mm:ss:mss] Files (4)
/lib.decorators.d.ts Text-1 lib.decorators.d.ts-Text
/lib.decorators.legacy.d.ts Text-1 lib.decorators.legacy.d.ts-Text
/lib.d.ts Text-1 lib.d.ts-Text
/src/foo.ts Text-1 "fooFrom"
/node_modules/@types/dependency/lib/index.d.ts Text-1 "export declare function fooFromAtTypesIndex(): void;"


lib.decorators.d.ts
Expand All @@ -136,9 134,6 @@ Info seq [hh:mm:ss:mss] Files (5)
src/foo.ts
Matched by default include pattern '**/*'
File is ECMAScript module because 'package.json' has field "type" with value "module"
node_modules/@types/dependency/lib/index.d.ts
Entry point for implicit type library 'dependency' with packageId '@types/dependency/lib/[email protected]'
File is ECMAScript module because 'node_modules/@types/dependency/package.json' has field "type" with value "module"

Info seq [hh:mm:ss:mss] -----------------------------------------------
Info seq [hh:mm:ss:mss] event:
Expand All @@ -163,14 158,15 @@ Info seq [hh:mm:ss:mss] event:
}
Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/inferredProject1*
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /node_modules/@types/dependency/package.json 2000 undefined Project: /dev/null/inferredProject1* WatchType: File location affecting resolution
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /node_modules/@types/dependency/lib/index.d.ts 500 undefined WatchType: Closed Script info
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /node_modules/@types/dependency/lib/package.json 2000 undefined Project: /dev/null/inferredProject1* WatchType: File location affecting resolution
Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* projectStateVersion: 1 projectProgramVersion: 0 structureChanged: true structureIsReused:: Not Elapsed:: *ms
Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred)
Info seq [hh:mm:ss:mss] Files (5)
/lib.d.ts Text-1 lib.d.ts-Text
/lib.decorators.d.ts Text-1 lib.decorators.d.ts-Text
/lib.decorators.legacy.d.ts Text-1 lib.decorators.legacy.d.ts-Text
/tsconfig.json SVC-1-0 "{\n \"compilerOptions\": {\n \"module\": \"nodenext\"\n }\n}"
/tsconfig.json SVC-1-0 "{\n \"compilerOptions\": {\n \"module\": \"nodenext\",\n \"types\": []\n }\n}"
/node_modules/@types/dependency/lib/index.d.ts Text-1 "export declare function fooFromAtTypesIndex(): void;"


Expand All @@ -189,7 185,7 @@ Info seq [hh:mm:ss:mss] Files (5)
Info seq [hh:mm:ss:mss] -----------------------------------------------
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /package.json 250 undefined WatchType: package.json file
Info seq [hh:mm:ss:mss] Project '/tsconfig.json' (Configured)
Info seq [hh:mm:ss:mss] Files (5)
Info seq [hh:mm:ss:mss] Files (4)

Info seq [hh:mm:ss:mss] -----------------------------------------------
Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred)
Expand All @@ -211,10 207,8 @@ watchedFiles::
{"pollingInterval":500}
/node_modules/@types/dependency/lib/package.json: *new*
{"pollingInterval":2000}
{"pollingInterval":2000}
/node_modules/@types/dependency/package.json: *new*
{"pollingInterval":2000}
{"pollingInterval":2000}
/package.json: *new*
{"pollingInterval":250}
/src/foo.ts: *new*
Expand Down Expand Up @@ -253,8 247,7 @@ ScriptInfos::
/dev/null/inferredProject1*
/node_modules/@types/dependency/lib/index.d.ts *new*
version: Text-1
containingProjects: 2
/tsconfig.json
containingProjects: 1
/dev/null/inferredProject1*
/src/foo.ts *new*
version: Text-1
Expand All @@ -277,7 270,7 @@ Info seq [hh:mm:ss:mss] request:
Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /src/foo.ts 500 undefined WatchType: Closed Script info
Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /src/foo.ts ProjectRootPath: undefined:: Result: /tsconfig.json
Info seq [hh:mm:ss:mss] Project '/tsconfig.json' (Configured)
Info seq [hh:mm:ss:mss] Files (5)
Info seq [hh:mm:ss:mss] Files (4)

Info seq [hh:mm:ss:mss] -----------------------------------------------
Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred)
Expand All @@ -301,10 294,8 @@ watchedFiles::
{"pollingInterval":500}
/node_modules/@types/dependency/lib/package.json:
{"pollingInterval":2000}
{"pollingInterval":2000}
/node_modules/@types/dependency/package.json:
{"pollingInterval":2000}
{"pollingInterval":2000}
/package.json:
{"pollingInterval":250}
/tsconfig.json:
Expand Down Expand Up @@ -345,8 336,7 @@ ScriptInfos::
/dev/null/inferredProject1*
/node_modules/@types/dependency/lib/index.d.ts
version: Text-1
containingProjects: 2
/tsconfig.json
containingProjects: 1
/dev/null/inferredProject1*
/src/foo.ts (Open) *changed*
open: true *changed*
Expand Down Expand Up @@ -418,7 408,7 @@ Info seq [hh:mm:ss:mss] forEachExternalModuleToImportFrom autoImportProvider: *
Info seq [hh:mm:ss:mss] getExportInfoMap: done in * ms
Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /node_modules 1 undefined WatchType: node_modules for closed script infos and package.jsons affecting module specifier cache
Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /node_modules 1 undefined WatchType: node_modules for closed script infos and package.jsons affecting module specifier cache
Info seq [hh:mm:ss:mss] collectAutoImports: resolved 3 module specifiers, plus 0 ambient and 0 from cache
Info seq [hh:mm:ss:mss] collectAutoImports: resolved 2 module specifiers, plus 0 ambient and 0 from cache
Info seq [hh:mm:ss:mss] collectAutoImports: response is complete
Info seq [hh:mm:ss:mss] collectAutoImports: *
Info seq [hh:mm:ss:mss] getCompletionData: Semantic work: *
Expand Down Expand Up @@ -1092,26 1082,6 @@ Info seq [hh:mm:ss:mss] response:
"kindModifiers": "",
"sortText": "15"
},
{
"name": "fooFromAtTypesIndex",
"kind": "function",
"kindModifiers": "export,declare",
"sortText": "16",
"hasAction": true,
"source": "dependency",
"sourceDisplay": [
{
"text": "dependency",
"kind": "text"
}
],
"data": {
"exportName": "fooFromAtTypesIndex",
"exportMapKey": "19 * fooFromAtTypesIndex ",
"moduleSpecifier": "dependency",
"fileName": "/node_modules/@types/dependency/lib/index.d.ts"
}
},
{
"name": "fooFromIndex",
"kind": "function",
Expand Down Expand Up @@ -1183,10 1153,8 @@ watchedFiles::
{"pollingInterval":500}
/node_modules/@types/dependency/lib/package.json:
{"pollingInterval":2000}
{"pollingInterval":2000}
/node_modules/@types/dependency/package.json:
{"pollingInterval":2000}
{"pollingInterval":2000}
/node_modules/dependency/lib/index.d.ts: *new*
{"pollingInterval":500}
/node_modules/dependency/lib/lol.d.ts: *new*
Expand Down Expand Up @@ -1234,8 1202,7 @@ ScriptInfos::
/dev/null/inferredProject1*
/node_modules/@types/dependency/lib/index.d.ts
version: Text-1
containingProjects: 2
/tsconfig.json
containingProjects: 1
/dev/null/inferredProject1*
/node_modules/dependency/lib/index.d.ts *new*
version: Text-1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 5,8 @@
// @Filename: /tsconfig.json
//// {
//// "compilerOptions": {
//// "module": "nodenext"
//// "module": "nodenext",
//// "types": []
//// }
//// }

Expand Down
Loading