diff --git a/internal/checker/checker.go b/internal/checker/checker.go
index b15adea095..99716dea97 100644
--- a/internal/checker/checker.go
+++ b/internal/checker/checker.go
@@ -14867,7 +14867,7 @@ func (c *Checker) resolveExternalModule(location *ast.Node, moduleReference stri
return c.getMergedSymbol(sourceFile.Symbol)
}
if errorNode != nil && moduleNotFoundError != nil && !isSideEffectImport(errorNode) {
- c.error(errorNode, diagnostics.File_0_is_not_a_module, sourceFile.FileName())
+ c.error(errorNode, diagnostics.File_0_is_not_a_module, resolvedModule.ResolvedFileName)
}
return nil
}
diff --git a/internal/compiler/fileloader.go b/internal/compiler/fileloader.go
index 6fdbf008ea..0b69107b01 100644
--- a/internal/compiler/fileloader.go
+++ b/internal/compiler/fileloader.go
@@ -68,7 +68,14 @@ type processedFiles struct {
// if file was included using source file and its output is actually part of program
// this contains mapping from output to source file
outputFileToProjectReferenceSource map[tspath.Path]string
- finishedProcessing bool
+ // Maps a source file path to the name of the package it was imported with
+ sourceFileToPackageName map[tspath.Path]string
+ // Key is a file path. Value is the list of files that redirect to it (same package, different install location)
+ redirectTargetsMap map[tspath.Path][]string
+ // Maps any path (canonical or redirect target) to its canonical path.
+ // Canonical paths map to themselves; redirect targets map to their canonical path.
+ deduplicatedPathMap map[tspath.Path]tspath.Path
+ finishedProcessing bool
}
type jsxRuntimeImportSpecifier struct {
diff --git a/internal/compiler/filesparser.go b/internal/compiler/filesparser.go
index 307e6ccd65..ab6a98ee5c 100644
--- a/internal/compiler/filesparser.go
+++ b/internal/compiler/filesparser.go
@@ -283,6 +283,17 @@ func (w *filesParser) getProcessedFiles(loader *fileLoader) processedFiles {
var sourceFilesFoundSearchingNodeModules collections.Set[tspath.Path]
libFilesMap := make(map[tspath.Path]*LibFile, libFileCount)
+ var sourceFileToPackageName map[tspath.Path]string
+ var redirectTargetsMap map[tspath.Path][]string
+ var deduplicatedPathMap map[tspath.Path]tspath.Path
+ var packageIdToCanonicalPath map[module.PackageId]tspath.Path
+ if !loader.opts.Config.CompilerOptions().DisablePackageDeduplication.IsTrue() {
+ sourceFileToPackageName = make(map[tspath.Path]string, totalFileCount)
+ redirectTargetsMap = make(map[tspath.Path][]string)
+ deduplicatedPathMap = make(map[tspath.Path]tspath.Path)
+ packageIdToCanonicalPath = make(map[module.PackageId]tspath.Path)
+ }
+
var collectFiles func(tasks []*parseTask, seen map[*parseTaskData]string)
collectFiles = func(tasks []*parseTask, seen map[*parseTaskData]string) {
for _, task := range tasks {
@@ -331,6 +342,36 @@ func (w *filesParser) getProcessedFiles(loader *fileLoader) processedFiles {
for _, trace := range task.resolutionsTrace {
loader.opts.Host.Trace(trace.Message, trace.Args...)
}
+
+ if packageIdToCanonicalPath != nil {
+ for _, resolution := range task.resolutionsInFile {
+ if !resolution.IsResolved() {
+ continue
+ }
+ pkgId := resolution.PackageId
+ if pkgId.Name == "" {
+ continue
+ }
+ resolvedPath := loader.toPath(resolution.ResolvedFileName)
+ packageName := pkgId.PackageName()
+
+ if canonical, exists := packageIdToCanonicalPath[pkgId]; exists {
+ if _, alreadyRecorded := sourceFileToPackageName[resolvedPath]; !alreadyRecorded {
+ sourceFileToPackageName[resolvedPath] = packageName
+ if resolvedPath != canonical {
+
+ deduplicatedPathMap[resolvedPath] = canonical
+ redirectTargetsMap[canonical] = append(redirectTargetsMap[canonical], resolution.ResolvedFileName)
+ }
+ }
+ } else {
+ packageIdToCanonicalPath[pkgId] = resolvedPath
+ sourceFileToPackageName[resolvedPath] = packageName
+ deduplicatedPathMap[resolvedPath] = resolvedPath
+ }
+ }
+ }
+
if subTasks := task.subTasks; len(subTasks) > 0 {
collectFiles(subTasks, seen)
}
@@ -408,6 +449,22 @@ func (w *filesParser) getProcessedFiles(loader *fileLoader) processedFiles {
}
}
+ if deduplicatedPathMap != nil {
+ for duplicatePath, canonicalPath := range deduplicatedPathMap {
+ if duplicatePath != canonicalPath {
+ if canonicalFile, ok := filesByPath[canonicalPath]; ok {
+ filesByPath[duplicatePath] = canonicalFile
+ }
+ }
+ }
+ allFiles = slices.DeleteFunc(allFiles, func(f *ast.SourceFile) bool {
+ if canonicalPath, ok := deduplicatedPathMap[f.Path()]; ok {
+ return f.Path() != canonicalPath
+ }
+ return false
+ })
+ }
+
return processedFiles{
finishedProcessing: true,
resolver: loader.resolver,
@@ -424,6 +481,9 @@ func (w *filesParser) getProcessedFiles(loader *fileLoader) processedFiles {
missingFiles: missingFiles,
includeProcessor: includeProcessor,
outputFileToProjectReferenceSource: outputFileToProjectReferenceSource,
+ sourceFileToPackageName: sourceFileToPackageName,
+ redirectTargetsMap: redirectTargetsMap,
+ deduplicatedPathMap: deduplicatedPathMap,
}
}
diff --git a/internal/compiler/program.go b/internal/compiler/program.go
index 8527d018cf..4b8f55004f 100644
--- a/internal/compiler/program.go
+++ b/internal/compiler/program.go
@@ -110,9 +110,10 @@ func (p *Program) GetPackageJsonInfo(pkgJsonPath string) *packagejson.InfoCacheE
return nil
}
-// GetRedirectTargets implements checker.Program.
+// GetRedirectTargets returns the list of file paths that redirect to the given path.
+// These are files from the same package (same name@version) installed in different locations.
func (p *Program) GetRedirectTargets(path tspath.Path) []string {
- return nil // !!! TODO: project references support
+ return p.redirectTargetsMap[path]
}
// gets the original file that was included in program
@@ -241,6 +242,14 @@ func (p *Program) UpdateProgram(changedFilePath tspath.Path, newHost CompilerHos
if !canReplaceFileInProgram(oldFile, newFile) {
return NewProgram(newOpts), false
}
+ // If this file is part of a package redirect group (same package installed in multiple
+ // node_modules locations), we need to rebuild the program because the redirect targets
+ // might need recalculation. A file is in a redirect group if it's either a canonical
+ // file that others redirect to, or if it redirects to another file.
+ if _, ok := p.deduplicatedPathMap[changedFilePath]; ok {
+ // File is either a canonical file or a redirect target; either way, need full rebuild
+ return NewProgram(newOpts), false
+ }
// TODO: reverify compiler options when config has changed?
result := &Program{
opts: newOpts,
diff --git a/internal/core/compileroptions.go b/internal/core/compileroptions.go
index ad6a4ceeca..0ba810403c 100644
--- a/internal/core/compileroptions.go
+++ b/internal/core/compileroptions.go
@@ -40,6 +40,7 @@ type CompilerOptions struct {
DisableSourceOfProjectReferenceRedirect Tristate `json:"disableSourceOfProjectReferenceRedirect,omitzero"`
DisableSolutionSearching Tristate `json:"disableSolutionSearching,omitzero"`
DisableReferencedProjectLoad Tristate `json:"disableReferencedProjectLoad,omitzero"`
+ DisablePackageDeduplication Tristate `json:"disablePackageDeduplication,omitzero"`
ErasableSyntaxOnly Tristate `json:"erasableSyntaxOnly,omitzero"`
ESModuleInterop Tristate `json:"esModuleInterop,omitzero"`
ExactOptionalPropertyTypes Tristate `json:"exactOptionalPropertyTypes,omitzero"`
diff --git a/internal/diagnostics/diagnostics_generated.go b/internal/diagnostics/diagnostics_generated.go
index 14c2a9b0f4..a84cb59248 100644
--- a/internal/diagnostics/diagnostics_generated.go
+++ b/internal/diagnostics/diagnostics_generated.go
@@ -4276,6 +4276,8 @@ var Set_the_number_of_projects_to_build_concurrently = &Message{code: 100009, ca
var X_all_unless_singleThreaded_is_passed = &Message{code: 100010, category: CategoryMessage, key: "all_unless_singleThreaded_is_passed_100010", text: "all, unless --singleThreaded is passed."}
+var Disable_deduplication_of_packages_with_the_same_name_and_version = &Message{code: 100011, category: CategoryMessage, key: "Disable_deduplication_of_packages_with_the_same_name_and_version_100011", text: "Disable deduplication of packages with the same name and version."}
+
func keyToMessage(key Key) *Message {
switch key {
case "Unterminated_string_literal_1002":
@@ -8552,6 +8554,8 @@ func keyToMessage(key Key) *Message {
return Set_the_number_of_projects_to_build_concurrently
case "all_unless_singleThreaded_is_passed_100010":
return X_all_unless_singleThreaded_is_passed
+ case "Disable_deduplication_of_packages_with_the_same_name_and_version_100011":
+ return Disable_deduplication_of_packages_with_the_same_name_and_version
default:
return nil
}
diff --git a/internal/diagnostics/extraDiagnosticMessages.json b/internal/diagnostics/extraDiagnosticMessages.json
index 2566d6ff53..4c51b0c450 100644
--- a/internal/diagnostics/extraDiagnosticMessages.json
+++ b/internal/diagnostics/extraDiagnosticMessages.json
@@ -86,5 +86,9 @@
"Option '{0}' requires value to be greater than '{1}'.": {
"category": "Error",
"code": 5002
+ },
+ "Disable deduplication of packages with the same name and version.": {
+ "category": "Message",
+ "code": 100011
}
}
diff --git a/internal/fourslash/_scripts/failingTests.txt b/internal/fourslash/_scripts/failingTests.txt
index be20094672..290e2e66c7 100644
--- a/internal/fourslash/_scripts/failingTests.txt
+++ b/internal/fourslash/_scripts/failingTests.txt
@@ -246,7 +246,6 @@ TestContextuallyTypedFunctionExpressionGeneric1
TestContextualTypingOfGenericCallSignatures2
TestCrossFileQuickInfoExportedTypeDoesNotUseImportType
TestDoubleUnderscoreCompletions
-TestDuplicatePackageServices
TestEditJsdocType
TestErrorsAfterResolvingVariableDeclOfMergedVariableAndClassDecl
TestExportDefaultClass
diff --git a/internal/fourslash/_scripts/manualTests.txt b/internal/fourslash/_scripts/manualTests.txt
index 5373890ae0..cbbe91801b 100644
--- a/internal/fourslash/_scripts/manualTests.txt
+++ b/internal/fourslash/_scripts/manualTests.txt
@@ -2,6 +2,7 @@ completionListInClosedFunction05
completionsAtIncompleteObjectLiteralProperty
completionsSelfDeclaring1
completionsWithDeprecatedTag4
+duplicatePackageServices_fileChanges
navigationBarFunctionPrototype
navigationBarFunctionPrototype2
navigationBarFunctionPrototype3
@@ -26,4 +27,4 @@ jsDocFunctionSignatures12
outliningHintSpansForFunction
getOutliningSpans
outliningForNonCompleteInterfaceDeclaration
-incrementalParsingWithJsDoc
\ No newline at end of file
+incrementalParsingWithJsDoc
diff --git a/internal/fourslash/tests/manual/duplicatePackageServices_fileChanges_test.go b/internal/fourslash/tests/manual/duplicatePackageServices_fileChanges_test.go
new file mode 100644
index 0000000000..a3aed4e54a
--- /dev/null
+++ b/internal/fourslash/tests/manual/duplicatePackageServices_fileChanges_test.go
@@ -0,0 +1,68 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestDuplicatePackageServices_fileChanges(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @noImplicitReferences: true
+// @Filename: /node_modules/a/index.d.ts
+import X from "x";
+export function a(x: X): void;
+// @Filename: /node_modules/a/node_modules/x/index.d.ts
+export default class /*defAX*/X {
+ private x: number;
+}
+// @Filename: /node_modules/a/node_modules/x/package.json
+{ "name": "x", "version": "1.2./*aVersionPatch*/3" }
+// @Filename: /node_modules/b/index.d.ts
+import X from "x";
+export const b: X;
+// @Filename: /node_modules/b/node_modules/x/index.d.ts
+export default class /*defBX*/X {
+ private x: number;
+}
+// @Filename: /node_modules/b/node_modules/x/package.json
+{ "name": "x", "version": "1.2./*bVersionPatch*/3" }
+// @Filename: /src/a.ts
+import { a } from "a";
+import { b } from "b";
+a(/*error*/b);`
+ f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ defer done()
+
+ f.GoToFile(t, "/src/a.ts")
+ f.VerifyNumberOfErrorsInCurrentFile(t, 0)
+
+ testChangeAndChangeBack := func(versionPatch string, def string) {
+ // Insert "4" after the version patch marker, changing version from 1.2.3 to 1.2.43
+ f.GoToMarker(t, versionPatch)
+ f.Insert(t, "4")
+
+ // Insert a space after the definition marker to trigger a recheck
+ f.GoToMarker(t, def)
+ f.Insert(t, " ")
+
+ // No longer have identical packageId, so we get errors.
+ f.VerifyErrorExistsAfterMarker(t, "error")
+
+ // Undo the changes
+ f.GoToMarker(t, versionPatch)
+ f.DeleteAtCaret(t, 1)
+ f.GoToMarker(t, def)
+ f.DeleteAtCaret(t, 1)
+
+ // Back to being identical.
+ f.GoToFile(t, "/src/a.ts")
+ f.VerifyNumberOfErrorsInCurrentFile(t, 0)
+ }
+
+ testChangeAndChangeBack("aVersionPatch", "defAX")
+ testChangeAndChangeBack("bVersionPatch", "defBX")
+}
diff --git a/internal/module/resolver.go b/internal/module/resolver.go
index f5ae94746f..2114f3c564 100644
--- a/internal/module/resolver.go
+++ b/internal/module/resolver.go
@@ -985,7 +985,7 @@ func (r *resolutionState) loadModuleFromSpecificNodeModulesDirectory(ext extensi
}
if fromDirectory := r.loadNodeModuleFromDirectoryWorker(ext, candidate, !nodeModulesDirectoryExists, packageInfo); !fromDirectory.shouldContinueSearching() {
- fromDirectory.packageId = r.getPackageId(packageDirectory, packageInfo)
+ fromDirectory.packageId = r.getPackageId(fromDirectory.path, packageInfo)
return fromDirectory
}
}
@@ -994,12 +994,12 @@ func (r *resolutionState) loadModuleFromSpecificNodeModulesDirectory(ext extensi
loader := func(extensions extensions, candidate string, onlyRecordFailures bool) *resolved {
if rest != "" || !r.esmMode {
if fromFile := r.loadModuleFromFile(extensions, candidate, onlyRecordFailures); !fromFile.shouldContinueSearching() {
- fromFile.packageId = r.getPackageId(packageDirectory, packageInfo)
+ fromFile.packageId = r.getPackageId(fromFile.path, packageInfo)
return fromFile
}
}
if fromDirectory := r.loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, packageInfo); !fromDirectory.shouldContinueSearching() {
- fromDirectory.packageId = r.getPackageId(packageDirectory, packageInfo)
+ fromDirectory.packageId = r.getPackageId(fromDirectory.path, packageInfo)
return fromDirectory
}
// !!! this is ported exactly, but checking for null seems wrong?
@@ -1009,7 +1009,7 @@ func (r *resolutionState) loadModuleFromSpecificNodeModulesDirectory(ext extensi
// EsmMode disables index lookup in `loadNodeModuleFromDirectoryWorker` generally, however non-relative package resolutions still assume
// a default `index.js` entrypoint if no `main` or `exports` are present
if indexResult := r.loadModuleFromFile(extensions, tspath.CombinePaths(candidate, "index.js"), onlyRecordFailures); !indexResult.shouldContinueSearching() {
- indexResult.packageId = r.getPackageId(packageDirectory, packageInfo)
+ indexResult.packageId = r.getPackageId(indexResult.path, packageInfo)
return indexResult
}
}
diff --git a/internal/tsoptions/declscompiler.go b/internal/tsoptions/declscompiler.go
index 1550e1680d..b1a0d3c4a3 100644
--- a/internal/tsoptions/declscompiler.go
+++ b/internal/tsoptions/declscompiler.go
@@ -185,6 +185,14 @@ var commonOptionsWithBuild = []*CommandLineOption{
DefaultValueDescription: false,
// Not setting affectsSemanticDiagnostics or affectsBuildInfo because we dont want all diagnostics to go away, its handled in builder
},
+ {
+ Name: "disablePackageDeduplication",
+ Kind: CommandLineOptionTypeBoolean,
+ Category: diagnostics.Type_Checking,
+ Description: diagnostics.Disable_deduplication_of_packages_with_the_same_name_and_version,
+ DefaultValueDescription: false,
+ AffectsProgramStructure: true,
+ },
{
Name: "noEmit",
Kind: CommandLineOptionTypeBoolean,
diff --git a/internal/tsoptions/parsinghelpers.go b/internal/tsoptions/parsinghelpers.go
index 4a3763168a..3006411d8c 100644
--- a/internal/tsoptions/parsinghelpers.go
+++ b/internal/tsoptions/parsinghelpers.go
@@ -227,6 +227,8 @@ func parseCompilerOptions(key string, value any, allOptions *core.CompilerOption
allOptions.DisableSolutionSearching = ParseTristate(value)
case "disableReferencedProjectLoad":
allOptions.DisableReferencedProjectLoad = ParseTristate(value)
+ case "disablePackageDeduplication":
+ allOptions.DisablePackageDeduplication = ParseTristate(value)
case "declarationMap":
allOptions.DeclarationMap = ParseTristate(value)
case "declaration":
diff --git a/testdata/baselines/reference/compiler/disablePackageDeduplication(disablepackagededuplication=false).errors.txt b/testdata/baselines/reference/compiler/disablePackageDeduplication(disablepackagededuplication=false).errors.txt
new file mode 100644
index 0000000000..99d5a3f29c
--- /dev/null
+++ b/testdata/baselines/reference/compiler/disablePackageDeduplication(disablepackagededuplication=false).errors.txt
@@ -0,0 +1,48 @@
+/src/a.ts(5,3): error TS2345: Argument of type 'import("/node_modules/c/node_modules/x/index").default' is not assignable to parameter of type 'import("/node_modules/a/node_modules/x/index").default'.
+ Types have separate declarations of a private property 'x'.
+
+
+==== /src/a.ts (1 errors) ====
+ import { a } from "a";
+ import { b } from "b";
+ import { c } from "c";
+ a(b); // Works
+ a(c); // Error, these are from different versions of the library.
+ ~
+!!! error TS2345: Argument of type 'import("/node_modules/c/node_modules/x/index").default' is not assignable to parameter of type 'import("/node_modules/a/node_modules/x/index").default'.
+!!! error TS2345: Types have separate declarations of a private property 'x'.
+
+==== /node_modules/a/index.d.ts (0 errors) ====
+ import X from "x";
+ export function a(x: X): void;
+
+==== /node_modules/a/node_modules/x/index.d.ts (0 errors) ====
+ export default class X {
+ private x: number;
+ }
+
+==== /node_modules/a/node_modules/x/package.json (0 errors) ====
+ { "name": "x", "version": "1.2.3" }
+
+==== /node_modules/b/index.d.ts (0 errors) ====
+ import X from "x";
+ export const b: X;
+
+==== /node_modules/b/node_modules/x/index.d.ts (0 errors) ====
+ content not parsed
+
+==== /node_modules/b/node_modules/x/package.json (0 errors) ====
+ { "name": "x", "version": "1.2.3" }
+
+==== /node_modules/c/index.d.ts (0 errors) ====
+ import X from "x";
+ export const c: X;
+
+==== /node_modules/c/node_modules/x/index.d.ts (0 errors) ====
+ export default class X {
+ private x: number;
+ }
+
+==== /node_modules/c/node_modules/x/package.json (0 errors) ====
+ { "name": "x", "version": "1.2.4" }
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/compiler/disablePackageDeduplication(disablepackagededuplication=false).js b/testdata/baselines/reference/compiler/disablePackageDeduplication(disablepackagededuplication=false).js
new file mode 100644
index 0000000000..f56347541c
--- /dev/null
+++ b/testdata/baselines/reference/compiler/disablePackageDeduplication(disablepackagededuplication=false).js
@@ -0,0 +1,52 @@
+//// [tests/cases/compiler/disablePackageDeduplication.ts] ////
+
+//// [index.d.ts]
+import X from "x";
+export function a(x: X): void;
+
+//// [index.d.ts]
+export default class X {
+ private x: number;
+}
+
+//// [package.json]
+{ "name": "x", "version": "1.2.3" }
+
+//// [index.d.ts]
+import X from "x";
+export const b: X;
+
+//// [index.d.ts]
+content not parsed
+
+//// [package.json]
+{ "name": "x", "version": "1.2.3" }
+
+//// [index.d.ts]
+import X from "x";
+export const c: X;
+
+//// [index.d.ts]
+export default class X {
+ private x: number;
+}
+
+//// [package.json]
+{ "name": "x", "version": "1.2.4" }
+
+//// [a.ts]
+import { a } from "a";
+import { b } from "b";
+import { c } from "c";
+a(b); // Works
+a(c); // Error, these are from different versions of the library.
+
+
+//// [a.js]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+const a_1 = require("a");
+const b_1 = require("b");
+const c_1 = require("c");
+(0, a_1.a)(b_1.b); // Works
+(0, a_1.a)(c_1.c); // Error, these are from different versions of the library.
diff --git a/testdata/baselines/reference/compiler/disablePackageDeduplication(disablepackagededuplication=false).symbols b/testdata/baselines/reference/compiler/disablePackageDeduplication(disablepackagededuplication=false).symbols
new file mode 100644
index 0000000000..e75f610301
--- /dev/null
+++ b/testdata/baselines/reference/compiler/disablePackageDeduplication(disablepackagededuplication=false).symbols
@@ -0,0 +1,67 @@
+//// [tests/cases/compiler/disablePackageDeduplication.ts] ////
+
+=== /src/a.ts ===
+import { a } from "a";
+>a : Symbol(a, Decl(a.ts, 0, 8))
+
+import { b } from "b";
+>b : Symbol(b, Decl(a.ts, 1, 8))
+
+import { c } from "c";
+>c : Symbol(c, Decl(a.ts, 2, 8))
+
+a(b); // Works
+>a : Symbol(a, Decl(a.ts, 0, 8))
+>b : Symbol(b, Decl(a.ts, 1, 8))
+
+a(c); // Error, these are from different versions of the library.
+>a : Symbol(a, Decl(a.ts, 0, 8))
+>c : Symbol(c, Decl(a.ts, 2, 8))
+
+=== /node_modules/a/index.d.ts ===
+import X from "x";
+>X : Symbol(X, Decl(index.d.ts, 0, 6))
+
+export function a(x: X): void;
+>a : Symbol(a, Decl(index.d.ts, 0, 18))
+>x : Symbol(x, Decl(index.d.ts, 1, 18))
+>X : Symbol(X, Decl(index.d.ts, 0, 6))
+
+=== /node_modules/a/node_modules/x/index.d.ts ===
+export default class X {
+>X : Symbol(X, Decl(index.d.ts, 0, 0))
+
+ private x: number;
+>x : Symbol(X.x, Decl(index.d.ts, 0, 24))
+}
+
+=== /node_modules/b/index.d.ts ===
+import X from "x";
+>X : Symbol(X, Decl(index.d.ts, 0, 6))
+
+export const b: X;
+>b : Symbol(b, Decl(index.d.ts, 1, 12))
+>X : Symbol(X, Decl(index.d.ts, 0, 6))
+
+=== /node_modules/b/node_modules/x/index.d.ts ===
+content not parsed
+>X : Symbol(X, Decl(index.d.ts, 0, 0))
+
+>x : Symbol(X.x, Decl(index.d.ts, 0, 24))
+
+=== /node_modules/c/index.d.ts ===
+import X from "x";
+>X : Symbol(X, Decl(index.d.ts, 0, 6))
+
+export const c: X;
+>c : Symbol(c, Decl(index.d.ts, 1, 12))
+>X : Symbol(X, Decl(index.d.ts, 0, 6))
+
+=== /node_modules/c/node_modules/x/index.d.ts ===
+export default class X {
+>X : Symbol(X, Decl(index.d.ts, 0, 0))
+
+ private x: number;
+>x : Symbol(X.x, Decl(index.d.ts, 0, 24))
+}
+
diff --git a/testdata/baselines/reference/compiler/disablePackageDeduplication(disablepackagededuplication=false).types b/testdata/baselines/reference/compiler/disablePackageDeduplication(disablepackagededuplication=false).types
new file mode 100644
index 0000000000..46b6a2e4e5
--- /dev/null
+++ b/testdata/baselines/reference/compiler/disablePackageDeduplication(disablepackagededuplication=false).types
@@ -0,0 +1,66 @@
+//// [tests/cases/compiler/disablePackageDeduplication.ts] ////
+
+=== /src/a.ts ===
+import { a } from "a";
+>a : (x: import("/node_modules/a/node_modules/x/index").default) => void
+
+import { b } from "b";
+>b : import("/node_modules/a/node_modules/x/index").default
+
+import { c } from "c";
+>c : import("/node_modules/c/node_modules/x/index").default
+
+a(b); // Works
+>a(b) : void
+>a : (x: import("/node_modules/a/node_modules/x/index").default) => void
+>b : import("/node_modules/a/node_modules/x/index").default
+
+a(c); // Error, these are from different versions of the library.
+>a(c) : void
+>a : (x: import("/node_modules/a/node_modules/x/index").default) => void
+>c : import("/node_modules/c/node_modules/x/index").default
+
+=== /node_modules/a/index.d.ts ===
+import X from "x";
+>X : typeof X
+
+export function a(x: X): void;
+>a : (x: X) => void
+>x : X
+
+=== /node_modules/a/node_modules/x/index.d.ts ===
+export default class X {
+>X : X
+
+ private x: number;
+>x : number
+}
+
+=== /node_modules/b/index.d.ts ===
+import X from "x";
+>X : typeof X
+
+export const b: X;
+>b : X
+
+=== /node_modules/b/node_modules/x/index.d.ts ===
+content not parsed
+>X : X
+
+>x : number
+
+=== /node_modules/c/index.d.ts ===
+import X from "x";
+>X : typeof X
+
+export const c: X;
+>c : X
+
+=== /node_modules/c/node_modules/x/index.d.ts ===
+export default class X {
+>X : X
+
+ private x: number;
+>x : number
+}
+
diff --git a/testdata/baselines/reference/compiler/disablePackageDeduplication(disablepackagededuplication=true).errors.txt b/testdata/baselines/reference/compiler/disablePackageDeduplication(disablepackagededuplication=true).errors.txt
new file mode 100644
index 0000000000..4e9b3720b6
--- /dev/null
+++ b/testdata/baselines/reference/compiler/disablePackageDeduplication(disablepackagededuplication=true).errors.txt
@@ -0,0 +1,66 @@
+/node_modules/b/index.d.ts(1,15): error TS2306: File '/node_modules/b/node_modules/x/index.d.ts' is not a module.
+/node_modules/b/node_modules/x/index.d.ts(1,1): error TS1434: Unexpected keyword or identifier.
+/node_modules/b/node_modules/x/index.d.ts(1,1): error TS2304: Cannot find name 'content'.
+/node_modules/b/node_modules/x/index.d.ts(1,9): error TS1434: Unexpected keyword or identifier.
+/node_modules/b/node_modules/x/index.d.ts(1,9): error TS2304: Cannot find name 'not'.
+/node_modules/b/node_modules/x/index.d.ts(1,13): error TS2304: Cannot find name 'parsed'.
+/src/a.ts(5,3): error TS2345: Argument of type 'import("/node_modules/c/node_modules/x/index").default' is not assignable to parameter of type 'import("/node_modules/a/node_modules/x/index").default'.
+ Types have separate declarations of a private property 'x'.
+
+
+==== /src/a.ts (1 errors) ====
+ import { a } from "a";
+ import { b } from "b";
+ import { c } from "c";
+ a(b); // Works
+ a(c); // Error, these are from different versions of the library.
+ ~
+!!! error TS2345: Argument of type 'import("/node_modules/c/node_modules/x/index").default' is not assignable to parameter of type 'import("/node_modules/a/node_modules/x/index").default'.
+!!! error TS2345: Types have separate declarations of a private property 'x'.
+
+==== /node_modules/a/index.d.ts (0 errors) ====
+ import X from "x";
+ export function a(x: X): void;
+
+==== /node_modules/a/node_modules/x/index.d.ts (0 errors) ====
+ export default class X {
+ private x: number;
+ }
+
+==== /node_modules/a/node_modules/x/package.json (0 errors) ====
+ { "name": "x", "version": "1.2.3" }
+
+==== /node_modules/b/index.d.ts (1 errors) ====
+ import X from "x";
+ ~~~
+!!! error TS2306: File '/node_modules/b/node_modules/x/index.d.ts' is not a module.
+ export const b: X;
+
+==== /node_modules/b/node_modules/x/index.d.ts (5 errors) ====
+ content not parsed
+ ~~~~~~~
+!!! error TS1434: Unexpected keyword or identifier.
+ ~~~~~~~
+!!! error TS2304: Cannot find name 'content'.
+ ~~~
+!!! error TS1434: Unexpected keyword or identifier.
+ ~~~
+!!! error TS2304: Cannot find name 'not'.
+ ~~~~~~
+!!! error TS2304: Cannot find name 'parsed'.
+
+==== /node_modules/b/node_modules/x/package.json (0 errors) ====
+ { "name": "x", "version": "1.2.3" }
+
+==== /node_modules/c/index.d.ts (0 errors) ====
+ import X from "x";
+ export const c: X;
+
+==== /node_modules/c/node_modules/x/index.d.ts (0 errors) ====
+ export default class X {
+ private x: number;
+ }
+
+==== /node_modules/c/node_modules/x/package.json (0 errors) ====
+ { "name": "x", "version": "1.2.4" }
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/compiler/disablePackageDeduplication(disablepackagededuplication=true).js b/testdata/baselines/reference/compiler/disablePackageDeduplication(disablepackagededuplication=true).js
new file mode 100644
index 0000000000..f56347541c
--- /dev/null
+++ b/testdata/baselines/reference/compiler/disablePackageDeduplication(disablepackagededuplication=true).js
@@ -0,0 +1,52 @@
+//// [tests/cases/compiler/disablePackageDeduplication.ts] ////
+
+//// [index.d.ts]
+import X from "x";
+export function a(x: X): void;
+
+//// [index.d.ts]
+export default class X {
+ private x: number;
+}
+
+//// [package.json]
+{ "name": "x", "version": "1.2.3" }
+
+//// [index.d.ts]
+import X from "x";
+export const b: X;
+
+//// [index.d.ts]
+content not parsed
+
+//// [package.json]
+{ "name": "x", "version": "1.2.3" }
+
+//// [index.d.ts]
+import X from "x";
+export const c: X;
+
+//// [index.d.ts]
+export default class X {
+ private x: number;
+}
+
+//// [package.json]
+{ "name": "x", "version": "1.2.4" }
+
+//// [a.ts]
+import { a } from "a";
+import { b } from "b";
+import { c } from "c";
+a(b); // Works
+a(c); // Error, these are from different versions of the library.
+
+
+//// [a.js]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+const a_1 = require("a");
+const b_1 = require("b");
+const c_1 = require("c");
+(0, a_1.a)(b_1.b); // Works
+(0, a_1.a)(c_1.c); // Error, these are from different versions of the library.
diff --git a/testdata/baselines/reference/compiler/disablePackageDeduplication(disablepackagededuplication=true).symbols b/testdata/baselines/reference/compiler/disablePackageDeduplication(disablepackagededuplication=true).symbols
new file mode 100644
index 0000000000..2450a099f0
--- /dev/null
+++ b/testdata/baselines/reference/compiler/disablePackageDeduplication(disablepackagededuplication=true).symbols
@@ -0,0 +1,65 @@
+//// [tests/cases/compiler/disablePackageDeduplication.ts] ////
+
+=== /src/a.ts ===
+import { a } from "a";
+>a : Symbol(a, Decl(a.ts, 0, 8))
+
+import { b } from "b";
+>b : Symbol(b, Decl(a.ts, 1, 8))
+
+import { c } from "c";
+>c : Symbol(c, Decl(a.ts, 2, 8))
+
+a(b); // Works
+>a : Symbol(a, Decl(a.ts, 0, 8))
+>b : Symbol(b, Decl(a.ts, 1, 8))
+
+a(c); // Error, these are from different versions of the library.
+>a : Symbol(a, Decl(a.ts, 0, 8))
+>c : Symbol(c, Decl(a.ts, 2, 8))
+
+=== /node_modules/a/index.d.ts ===
+import X from "x";
+>X : Symbol(X, Decl(index.d.ts, 0, 6))
+
+export function a(x: X): void;
+>a : Symbol(a, Decl(index.d.ts, 0, 18))
+>x : Symbol(x, Decl(index.d.ts, 1, 18))
+>X : Symbol(X, Decl(index.d.ts, 0, 6))
+
+=== /node_modules/a/node_modules/x/index.d.ts ===
+export default class X {
+>X : Symbol(X, Decl(index.d.ts, 0, 0))
+
+ private x: number;
+>x : Symbol(X.x, Decl(index.d.ts, 0, 24))
+}
+
+=== /node_modules/b/index.d.ts ===
+import X from "x";
+>X : Symbol(X, Decl(index.d.ts, 0, 6))
+
+export const b: X;
+>b : Symbol(b, Decl(index.d.ts, 1, 12))
+>X : Symbol(X, Decl(index.d.ts, 0, 6))
+
+=== /node_modules/b/node_modules/x/index.d.ts ===
+
+content not parsed
+
+=== /node_modules/c/index.d.ts ===
+import X from "x";
+>X : Symbol(X, Decl(index.d.ts, 0, 6))
+
+export const c: X;
+>c : Symbol(c, Decl(index.d.ts, 1, 12))
+>X : Symbol(X, Decl(index.d.ts, 0, 6))
+
+=== /node_modules/c/node_modules/x/index.d.ts ===
+export default class X {
+>X : Symbol(X, Decl(index.d.ts, 0, 0))
+
+ private x: number;
+>x : Symbol(X.x, Decl(index.d.ts, 0, 24))
+}
+
diff --git a/testdata/baselines/reference/compiler/disablePackageDeduplication(disablepackagededuplication=true).types b/testdata/baselines/reference/compiler/disablePackageDeduplication(disablepackagededuplication=true).types
new file mode 100644
index 0000000000..e445464c76
--- /dev/null
+++ b/testdata/baselines/reference/compiler/disablePackageDeduplication(disablepackagededuplication=true).types
@@ -0,0 +1,66 @@
+//// [tests/cases/compiler/disablePackageDeduplication.ts] ////
+
+=== /src/a.ts ===
+import { a } from "a";
+>a : (x: import("/node_modules/a/node_modules/x/index").default) => void
+
+import { b } from "b";
+>b : X
+
+import { c } from "c";
+>c : import("/node_modules/c/node_modules/x/index").default
+
+a(b); // Works
+>a(b) : void
+>a : (x: import("/node_modules/a/node_modules/x/index").default) => void
+>b : X
+
+a(c); // Error, these are from different versions of the library.
+>a(c) : void
+>a : (x: import("/node_modules/a/node_modules/x/index").default) => void
+>c : import("/node_modules/c/node_modules/x/index").default
+
+=== /node_modules/a/index.d.ts ===
+import X from "x";
+>X : typeof X
+
+export function a(x: X): void;
+>a : (x: X) => void
+>x : X
+
+=== /node_modules/a/node_modules/x/index.d.ts ===
+export default class X {
+>X : X
+
+ private x: number;
+>x : number
+}
+
+=== /node_modules/b/index.d.ts ===
+import X from "x";
+>X : any
+
+export const b: X;
+>b : X
+
+=== /node_modules/b/node_modules/x/index.d.ts ===
+content not parsed
+>content : any
+>not : any
+>parsed : any
+
+=== /node_modules/c/index.d.ts ===
+import X from "x";
+>X : typeof X
+
+export const c: X;
+>c : X
+
+=== /node_modules/c/node_modules/x/index.d.ts ===
+export default class X {
+>X : X
+
+ private x: number;
+>x : number
+}
+
diff --git a/testdata/baselines/reference/fourslash/findAllReferences/duplicatePackageServices.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllReferences/duplicatePackageServices.baseline.jsonc
new file mode 100644
index 0000000000..3ca6e48ddb
--- /dev/null
+++ b/testdata/baselines/reference/fourslash/findAllReferences/duplicatePackageServices.baseline.jsonc
@@ -0,0 +1,45 @@
+// === findAllReferences ===
+// === /node_modules/a/index.d.ts ===
+// import [|X|]/*FIND ALL REFS*/ from "x";
+// export function a(x: [|X|]): void;
+
+// === /node_modules/a/node_modules/x/index.d.ts ===
+// export default class [|X|] {
+// private x: number;
+// }
+
+// === /node_modules/b/index.d.ts ===
+// import [|X|] from "x";
+// export const b: [|X|];
+
+
+
+// === findAllReferences ===
+// === /node_modules/a/index.d.ts ===
+// import [|X|] from "x";
+// export function a(x: [|X|]): void;
+
+// === /node_modules/a/node_modules/x/index.d.ts ===
+// export default class /*FIND ALL REFS*/[|X|] {
+// private x: number;
+// }
+
+// === /node_modules/b/index.d.ts ===
+// import [|X|] from "x";
+// export const b: [|X|];
+
+
+
+// === findAllReferences ===
+// === /node_modules/a/index.d.ts ===
+// import [|X|] from "x";
+// export function a(x: [|X|]): void;
+
+// === /node_modules/a/node_modules/x/index.d.ts ===
+// export default class [|X|] {
+// private x: number;
+// }
+
+// === /node_modules/b/index.d.ts ===
+// import [|X|]/*FIND ALL REFS*/ from "x";
+// export const b: [|X|];
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink.types b/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink.types
index 78a2505802..3539b7c103 100644
--- a/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink.types
+++ b/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink.types
@@ -40,6 +40,6 @@ export const a = getA();
=== /p2/index.d.ts ===
export const a: import("typescript-fsa").A;
->a : import("/p2/node_modules/typescript-fsa/index").A
+>a : import("/p1/node_modules/typescript-fsa/index").A
diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink.types.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink.types.diff
new file mode 100644
index 0000000000..045997d7f1
--- /dev/null
+++ b/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink.types.diff
@@ -0,0 +1,9 @@
+--- old.declarationEmitForGlobalishSpecifierSymlink.types
++++ new.declarationEmitForGlobalishSpecifierSymlink.types
+@@= skipped -39, +39 lines =@@
+
+ === /p2/index.d.ts ===
+ export const a: import("typescript-fsa").A;
+->a : import("/p2/node_modules/typescript-fsa/index").A
++>a : import("/p1/node_modules/typescript-fsa/index").A
+
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage.errors.txt b/testdata/baselines/reference/submodule/compiler/duplicatePackage.errors.txt
index 4e9b3720b6..99d5a3f29c 100644
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage.errors.txt
+++ b/testdata/baselines/reference/submodule/compiler/duplicatePackage.errors.txt
@@ -1,9 +1,3 @@
-/node_modules/b/index.d.ts(1,15): error TS2306: File '/node_modules/b/node_modules/x/index.d.ts' is not a module.
-/node_modules/b/node_modules/x/index.d.ts(1,1): error TS1434: Unexpected keyword or identifier.
-/node_modules/b/node_modules/x/index.d.ts(1,1): error TS2304: Cannot find name 'content'.
-/node_modules/b/node_modules/x/index.d.ts(1,9): error TS1434: Unexpected keyword or identifier.
-/node_modules/b/node_modules/x/index.d.ts(1,9): error TS2304: Cannot find name 'not'.
-/node_modules/b/node_modules/x/index.d.ts(1,13): error TS2304: Cannot find name 'parsed'.
/src/a.ts(5,3): error TS2345: Argument of type 'import("/node_modules/c/node_modules/x/index").default' is not assignable to parameter of type 'import("/node_modules/a/node_modules/x/index").default'.
Types have separate declarations of a private property 'x'.
@@ -30,24 +24,12 @@
==== /node_modules/a/node_modules/x/package.json (0 errors) ====
{ "name": "x", "version": "1.2.3" }
-==== /node_modules/b/index.d.ts (1 errors) ====
+==== /node_modules/b/index.d.ts (0 errors) ====
import X from "x";
- ~~~
-!!! error TS2306: File '/node_modules/b/node_modules/x/index.d.ts' is not a module.
export const b: X;
-==== /node_modules/b/node_modules/x/index.d.ts (5 errors) ====
+==== /node_modules/b/node_modules/x/index.d.ts (0 errors) ====
content not parsed
- ~~~~~~~
-!!! error TS1434: Unexpected keyword or identifier.
- ~~~~~~~
-!!! error TS2304: Cannot find name 'content'.
- ~~~
-!!! error TS1434: Unexpected keyword or identifier.
- ~~~
-!!! error TS2304: Cannot find name 'not'.
- ~~~~~~
-!!! error TS2304: Cannot find name 'parsed'.
==== /node_modules/b/node_modules/x/package.json (0 errors) ====
{ "name": "x", "version": "1.2.3" }
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/duplicatePackage.errors.txt.diff
deleted file mode 100644
index ff69e90fce..0000000000
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage.errors.txt.diff
+++ /dev/null
@@ -1,39 +0,0 @@
---- old.duplicatePackage.errors.txt
-+++ new.duplicatePackage.errors.txt
-@@= skipped -0, +0 lines =@@
-+/node_modules/b/index.d.ts(1,15): error TS2306: File '/node_modules/b/node_modules/x/index.d.ts' is not a module.
-+/node_modules/b/node_modules/x/index.d.ts(1,1): error TS1434: Unexpected keyword or identifier.
-+/node_modules/b/node_modules/x/index.d.ts(1,1): error TS2304: Cannot find name 'content'.
-+/node_modules/b/node_modules/x/index.d.ts(1,9): error TS1434: Unexpected keyword or identifier.
-+/node_modules/b/node_modules/x/index.d.ts(1,9): error TS2304: Cannot find name 'not'.
-+/node_modules/b/node_modules/x/index.d.ts(1,13): error TS2304: Cannot find name 'parsed'.
- /src/a.ts(5,3): error TS2345: Argument of type 'import("/node_modules/c/node_modules/x/index").default' is not assignable to parameter of type 'import("/node_modules/a/node_modules/x/index").default'.
- Types have separate declarations of a private property 'x'.
-
-@@= skipped -23, +29 lines =@@
- ==== /node_modules/a/node_modules/x/package.json (0 errors) ====
- { "name": "x", "version": "1.2.3" }
-
--==== /node_modules/b/index.d.ts (0 errors) ====
-+==== /node_modules/b/index.d.ts (1 errors) ====
- import X from "x";
-+ ~~~
-+!!! error TS2306: File '/node_modules/b/node_modules/x/index.d.ts' is not a module.
- export const b: X;
-
--==== /node_modules/b/node_modules/x/index.d.ts (0 errors) ====
-+==== /node_modules/b/node_modules/x/index.d.ts (5 errors) ====
- content not parsed
-+ ~~~~~~~
-+!!! error TS1434: Unexpected keyword or identifier.
-+ ~~~~~~~
-+!!! error TS2304: Cannot find name 'content'.
-+ ~~~
-+!!! error TS1434: Unexpected keyword or identifier.
-+ ~~~
-+!!! error TS2304: Cannot find name 'not'.
-+ ~~~~~~
-+!!! error TS2304: Cannot find name 'parsed'.
-
- ==== /node_modules/b/node_modules/x/package.json (0 errors) ====
- { "name": "x", "version": "1.2.3" }
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage.symbols b/testdata/baselines/reference/submodule/compiler/duplicatePackage.symbols
index b5fd703b49..0872054c30 100644
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage.symbols
+++ b/testdata/baselines/reference/submodule/compiler/duplicatePackage.symbols
@@ -44,8 +44,10 @@ export const b: X;
>X : Symbol(X, Decl(index.d.ts, 0, 6))
=== /node_modules/b/node_modules/x/index.d.ts ===
-
content not parsed
+>X : Symbol(X, Decl(index.d.ts, 0, 0))
+
+>x : Symbol(X.x, Decl(index.d.ts, 0, 24))
=== /node_modules/c/index.d.ts ===
import X from "x";
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage.symbols.diff b/testdata/baselines/reference/submodule/compiler/duplicatePackage.symbols.diff
deleted file mode 100644
index a7dc526dc8..0000000000
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage.symbols.diff
+++ /dev/null
@@ -1,14 +0,0 @@
---- old.duplicatePackage.symbols
-+++ new.duplicatePackage.symbols
-@@= skipped -43, +43 lines =@@
- >X : Symbol(X, Decl(index.d.ts, 0, 6))
-
- === /node_modules/b/node_modules/x/index.d.ts ===
--content not parsed
-->X : Symbol(X, Decl(index.d.ts, 0, 0))
-
-->x : Symbol(X.x, Decl(index.d.ts, 0, 24))
-+content not parsed
-
- === /node_modules/c/index.d.ts ===
- import X from "x";
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage.types b/testdata/baselines/reference/submodule/compiler/duplicatePackage.types
index 77b1ce24d1..30efd9bc9e 100644
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage.types
+++ b/testdata/baselines/reference/submodule/compiler/duplicatePackage.types
@@ -5,7 +5,7 @@ import { a } from "a";
>a : (x: import("/node_modules/a/node_modules/x/index").default) => void
import { b } from "b";
->b : X
+>b : import("/node_modules/a/node_modules/x/index").default
import { c } from "c";
>c : import("/node_modules/c/node_modules/x/index").default
@@ -13,7 +13,7 @@ import { c } from "c";
a(b); // Works
>a(b) : void
>a : (x: import("/node_modules/a/node_modules/x/index").default) => void
->b : X
+>b : import("/node_modules/a/node_modules/x/index").default
a(c); // Error, these are from different versions of the library.
>a(c) : void
@@ -38,16 +38,16 @@ export default class X {
=== /node_modules/b/index.d.ts ===
import X from "x";
->X : any
+>X : typeof X
export const b: X;
>b : X
=== /node_modules/b/node_modules/x/index.d.ts ===
content not parsed
->content : any
->not : any
->parsed : any
+>X : X
+
+>x : number
=== /node_modules/c/index.d.ts ===
import X from "x";
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage.types.diff b/testdata/baselines/reference/submodule/compiler/duplicatePackage.types.diff
deleted file mode 100644
index 6dcafc5f6d..0000000000
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage.types.diff
+++ /dev/null
@@ -1,41 +0,0 @@
---- old.duplicatePackage.types
-+++ new.duplicatePackage.types
-@@= skipped -4, +4 lines =@@
- >a : (x: import("/node_modules/a/node_modules/x/index").default) => void
-
- import { b } from "b";
-->b : import("/node_modules/a/node_modules/x/index").default
-+>b : X
-
- import { c } from "c";
- >c : import("/node_modules/c/node_modules/x/index").default
-@@= skipped -8, +8 lines =@@
- a(b); // Works
- >a(b) : void
- >a : (x: import("/node_modules/a/node_modules/x/index").default) => void
-->b : import("/node_modules/a/node_modules/x/index").default
-+>b : X
-
- a(c); // Error, these are from different versions of the library.
- >a(c) : void
-@@= skipped -25, +25 lines =@@
-
- === /node_modules/b/index.d.ts ===
- import X from "x";
-->X : typeof X
-+>X : any
-
- export const b: X;
- >b : X
-
- === /node_modules/b/node_modules/x/index.d.ts ===
- content not parsed
-->X : X
--
-->x : number
-+>content : any
-+>not : any
-+>parsed : any
-
- === /node_modules/c/index.d.ts ===
- import X from "x";
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_globalMerge.symbols b/testdata/baselines/reference/submodule/compiler/duplicatePackage_globalMerge.symbols
index abc070a609..0b3ba9f899 100644
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_globalMerge.symbols
+++ b/testdata/baselines/reference/submodule/compiler/duplicatePackage_globalMerge.symbols
@@ -23,6 +23,8 @@ export var y = 2
=== /tests/node_modules/@types/react/index.d.ts ===
+>global : Symbol(global, Decl(index.d.ts, 0, 0))
+
=== /node_modules/@types/react/index.d.ts ===
declare global { }
>global : Symbol(global, Decl(index.d.ts, 0, 0))
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_globalMerge.symbols.diff b/testdata/baselines/reference/submodule/compiler/duplicatePackage_globalMerge.symbols.diff
deleted file mode 100644
index 3de2625386..0000000000
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_globalMerge.symbols.diff
+++ /dev/null
@@ -1,11 +0,0 @@
---- old.duplicatePackage_globalMerge.symbols
-+++ new.duplicatePackage_globalMerge.symbols
-@@= skipped -22, +22 lines =@@
-
- === /tests/node_modules/@types/react/index.d.ts ===
-
-->global : Symbol(global, Decl(index.d.ts, 0, 0))
--
- === /node_modules/@types/react/index.d.ts ===
- declare global { }
- >global : Symbol(global, Decl(index.d.ts, 0, 0))
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_globalMerge.types b/testdata/baselines/reference/submodule/compiler/duplicatePackage_globalMerge.types
index ecba91848d..920d6906dc 100644
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_globalMerge.types
+++ b/testdata/baselines/reference/submodule/compiler/duplicatePackage_globalMerge.types
@@ -25,6 +25,8 @@ export var y = 2
=== /tests/node_modules/@types/react/index.d.ts ===
+>global : typeof global
+
=== /node_modules/@types/react/index.d.ts ===
declare global { }
>global : typeof global
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_globalMerge.types.diff b/testdata/baselines/reference/submodule/compiler/duplicatePackage_globalMerge.types.diff
deleted file mode 100644
index a280e89724..0000000000
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_globalMerge.types.diff
+++ /dev/null
@@ -1,11 +0,0 @@
---- old.duplicatePackage_globalMerge.types
-+++ new.duplicatePackage_globalMerge.types
-@@= skipped -24, +24 lines =@@
-
- === /tests/node_modules/@types/react/index.d.ts ===
-
-->global : typeof global
--
- === /node_modules/@types/react/index.d.ts ===
- declare global { }
- >global : typeof global
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_referenceTypes.errors.txt b/testdata/baselines/reference/submodule/compiler/duplicatePackage_referenceTypes.errors.txt
deleted file mode 100644
index 954f20ec44..0000000000
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_referenceTypes.errors.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-/index.ts(4,5): error TS2322: Type 'import("/node_modules/a/node_modules/foo/index").Foo' is not assignable to type 'import("/node_modules/@types/foo/index").Foo'.
- Types have separate declarations of a private property 'x'.
-
-
-==== /index.ts (1 errors) ====
- import * as a from "a";
- import { Foo } from "foo";
-
- let foo: Foo = a.foo;
- ~~~
-!!! error TS2322: Type 'import("/node_modules/a/node_modules/foo/index").Foo' is not assignable to type 'import("/node_modules/@types/foo/index").Foo'.
-!!! error TS2322: Types have separate declarations of a private property 'x'.
-
-==== /node_modules/a/index.d.ts (0 errors) ====
- ///
- import { Foo } from "foo";
- export const foo: Foo;
-
-==== /node_modules/a/node_modules/foo/index.d.ts (0 errors) ====
- export class Foo { private x; }
-
-==== /node_modules/a/node_modules/foo/package.json (0 errors) ====
- { "name": "foo", "version": "1.2.3" }
-
-==== /node_modules/@types/foo/index.d.ts (0 errors) ====
- export class Foo { private x; }
-
-==== /node_modules/@types/foo/package.json (0 errors) ====
- { "name": "foo", "version": "1.2.3" }
-
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_referenceTypes.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/duplicatePackage_referenceTypes.errors.txt.diff
deleted file mode 100644
index 58e5b61220..0000000000
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_referenceTypes.errors.txt.diff
+++ /dev/null
@@ -1,34 +0,0 @@
---- old.duplicatePackage_referenceTypes.errors.txt
-+++ new.duplicatePackage_referenceTypes.errors.txt
-@@= skipped -0, +0 lines =@@
--
-+/index.ts(4,5): error TS2322: Type 'import("/node_modules/a/node_modules/foo/index").Foo' is not assignable to type 'import("/node_modules/@types/foo/index").Foo'.
-+ Types have separate declarations of a private property 'x'.
-+
-+
-+==== /index.ts (1 errors) ====
-+ import * as a from "a";
-+ import { Foo } from "foo";
-+
-+ let foo: Foo = a.foo;
-+ ~~~
-+!!! error TS2322: Type 'import("/node_modules/a/node_modules/foo/index").Foo' is not assignable to type 'import("/node_modules/@types/foo/index").Foo'.
-+!!! error TS2322: Types have separate declarations of a private property 'x'.
-+
-+==== /node_modules/a/index.d.ts (0 errors) ====
-+ ///
-+ import { Foo } from "foo";
-+ export const foo: Foo;
-+
-+==== /node_modules/a/node_modules/foo/index.d.ts (0 errors) ====
-+ export class Foo { private x; }
-+
-+==== /node_modules/a/node_modules/foo/package.json (0 errors) ====
-+ { "name": "foo", "version": "1.2.3" }
-+
-+==== /node_modules/@types/foo/index.d.ts (0 errors) ====
-+ export class Foo { private x; }
-+
-+==== /node_modules/@types/foo/package.json (0 errors) ====
-+ { "name": "foo", "version": "1.2.3" }
-+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_referenceTypes.types b/testdata/baselines/reference/submodule/compiler/duplicatePackage_referenceTypes.types
index ac9be73082..c9c06c50d9 100644
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_referenceTypes.types
+++ b/testdata/baselines/reference/submodule/compiler/duplicatePackage_referenceTypes.types
@@ -9,9 +9,9 @@ import { Foo } from "foo";
let foo: Foo = a.foo;
>foo : Foo
->a.foo : import("/node_modules/a/node_modules/foo/index").Foo
+>a.foo : Foo
>a : typeof a
->foo : import("/node_modules/a/node_modules/foo/index").Foo
+>foo : Foo
=== /node_modules/a/index.d.ts ===
///
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_referenceTypes.types.diff b/testdata/baselines/reference/submodule/compiler/duplicatePackage_referenceTypes.types.diff
deleted file mode 100644
index 80ed49bf27..0000000000
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_referenceTypes.types.diff
+++ /dev/null
@@ -1,14 +0,0 @@
---- old.duplicatePackage_referenceTypes.types
-+++ new.duplicatePackage_referenceTypes.types
-@@= skipped -8, +8 lines =@@
-
- let foo: Foo = a.foo;
- >foo : Foo
-->a.foo : Foo
-+>a.foo : import("/node_modules/a/node_modules/foo/index").Foo
- >a : typeof a
-->foo : Foo
-+>foo : import("/node_modules/a/node_modules/foo/index").Foo
-
- === /node_modules/a/index.d.ts ===
- ///
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage.errors.txt b/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage.errors.txt
deleted file mode 100644
index 9f4f6d7f9b..0000000000
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage.errors.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-/index.ts(4,5): error TS2345: Argument of type 'import("/node_modules/a/node_modules/foo/index").C' is not assignable to parameter of type 'import("/node_modules/foo/index").C'.
- Types have separate declarations of a private property 'x'.
-
-
-==== /index.ts (1 errors) ====
- import { use } from "foo/use";
- import { o } from "a";
-
- use(o);
- ~
-!!! error TS2345: Argument of type 'import("/node_modules/a/node_modules/foo/index").C' is not assignable to parameter of type 'import("/node_modules/foo/index").C'.
-!!! error TS2345: Types have separate declarations of a private property 'x'.
-
-==== /node_modules/a/node_modules/foo/package.json (0 errors) ====
- {
- "name": "foo",
- "version": "1.2.3"
- }
-
-==== /node_modules/a/node_modules/foo/index.d.ts (0 errors) ====
- export class C {
- private x: number;
- }
-
-==== /node_modules/a/index.d.ts (0 errors) ====
- import { C } from "foo";
- export const o: C;
-
-==== /node_modules/foo/use.d.ts (0 errors) ====
- import { C } from "./index";
- export function use(o: C): void;
-
-==== /node_modules/foo/index.d.ts (0 errors) ====
- export class C {
- private x: number;
- }
-
-==== /node_modules/foo/package.json (0 errors) ====
- {
- "name": "foo",
- "version": "1.2.3"
- }
-
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage.errors.txt.diff
deleted file mode 100644
index 6be7c60fc7..0000000000
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage.errors.txt.diff
+++ /dev/null
@@ -1,47 +0,0 @@
---- old.duplicatePackage_relativeImportWithinPackage.errors.txt
-+++ new.duplicatePackage_relativeImportWithinPackage.errors.txt
-@@= skipped -0, +0 lines =@@
--
-+/index.ts(4,5): error TS2345: Argument of type 'import("/node_modules/a/node_modules/foo/index").C' is not assignable to parameter of type 'import("/node_modules/foo/index").C'.
-+ Types have separate declarations of a private property 'x'.
-+
-+
-+==== /index.ts (1 errors) ====
-+ import { use } from "foo/use";
-+ import { o } from "a";
-+
-+ use(o);
-+ ~
-+!!! error TS2345: Argument of type 'import("/node_modules/a/node_modules/foo/index").C' is not assignable to parameter of type 'import("/node_modules/foo/index").C'.
-+!!! error TS2345: Types have separate declarations of a private property 'x'.
-+
-+==== /node_modules/a/node_modules/foo/package.json (0 errors) ====
-+ {
-+ "name": "foo",
-+ "version": "1.2.3"
-+ }
-+
-+==== /node_modules/a/node_modules/foo/index.d.ts (0 errors) ====
-+ export class C {
-+ private x: number;
-+ }
-+
-+==== /node_modules/a/index.d.ts (0 errors) ====
-+ import { C } from "foo";
-+ export const o: C;
-+
-+==== /node_modules/foo/use.d.ts (0 errors) ====
-+ import { C } from "./index";
-+ export function use(o: C): void;
-+
-+==== /node_modules/foo/index.d.ts (0 errors) ====
-+ export class C {
-+ private x: number;
-+ }
-+
-+==== /node_modules/foo/package.json (0 errors) ====
-+ {
-+ "name": "foo",
-+ "version": "1.2.3"
-+ }
-+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage.trace.json b/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage.trace.json
index dc6e3a92cf..8de27591a1 100644
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage.trace.json
+++ b/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage.trace.json
@@ -11,7 +11,7 @@ File '/node_modules/foo/use.tsx' does not exist.
File '/node_modules/foo/use.d.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/node_modules/foo/use.d.ts', result '/node_modules/foo/use.d.ts'.
-======== Module name 'foo/use' was successfully resolved to '/node_modules/foo/use.d.ts' with Package ID 'foo@1.2.3'. ========
+======== Module name 'foo/use' was successfully resolved to '/node_modules/foo/use.d.ts' with Package ID 'foo/use.d.ts@1.2.3'. ========
======== Resolving module 'a' from '/index.ts'. ========
Module resolution kind is not specified, using 'Bundler'.
Resolving in CJS mode with conditions 'require', 'types'.
@@ -58,4 +58,4 @@ File '/node_modules/a/node_modules/foo/index.tsx' does not exist.
File '/node_modules/a/node_modules/foo/index.d.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/node_modules/a/node_modules/foo/index.d.ts', result '/node_modules/a/node_modules/foo/index.d.ts'.
-======== Module name 'foo' was successfully resolved to '/node_modules/a/node_modules/foo/index.d.ts' with Package ID 'foo@1.2.3'. ========
+======== Module name 'foo' was successfully resolved to '/node_modules/a/node_modules/foo/index.d.ts' with Package ID 'foo/index.d.ts@1.2.3'. ========
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage.types b/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage.types
index 75d6b524f4..0993442b2d 100644
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage.types
+++ b/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage.types
@@ -5,12 +5,12 @@ import { use } from "foo/use";
>use : (o: import("/node_modules/foo/index").C) => void
import { o } from "a";
->o : import("/node_modules/a/node_modules/foo/index").C
+>o : import("/node_modules/foo/index").C
use(o);
>use(o) : void
>use : (o: import("/node_modules/foo/index").C) => void
->o : import("/node_modules/a/node_modules/foo/index").C
+>o : import("/node_modules/foo/index").C
=== /node_modules/a/node_modules/foo/index.d.ts ===
export class C {
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage.types.diff b/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage.types.diff
deleted file mode 100644
index bd4b5c7d10..0000000000
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage.types.diff
+++ /dev/null
@@ -1,17 +0,0 @@
---- old.duplicatePackage_relativeImportWithinPackage.types
-+++ new.duplicatePackage_relativeImportWithinPackage.types
-@@= skipped -4, +4 lines =@@
- >use : (o: import("/node_modules/foo/index").C) => void
-
- import { o } from "a";
-->o : import("/node_modules/foo/index").C
-+>o : import("/node_modules/a/node_modules/foo/index").C
-
- use(o);
- >use(o) : void
- >use : (o: import("/node_modules/foo/index").C) => void
-->o : import("/node_modules/foo/index").C
-+>o : import("/node_modules/a/node_modules/foo/index").C
-
- === /node_modules/a/node_modules/foo/index.d.ts ===
- export class C {
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage_scoped.errors.txt b/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage_scoped.errors.txt
deleted file mode 100644
index 19026366ac..0000000000
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage_scoped.errors.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-/index.ts(4,5): error TS2345: Argument of type 'import("/node_modules/a/node_modules/@foo/bar/index").C' is not assignable to parameter of type 'import("/node_modules/@foo/bar/index").C'.
- Types have separate declarations of a private property 'x'.
-
-
-==== /index.ts (1 errors) ====
- import { use } from "@foo/bar/use";
- import { o } from "a";
-
- use(o);
- ~
-!!! error TS2345: Argument of type 'import("/node_modules/a/node_modules/@foo/bar/index").C' is not assignable to parameter of type 'import("/node_modules/@foo/bar/index").C'.
-!!! error TS2345: Types have separate declarations of a private property 'x'.
-
-==== /node_modules/a/node_modules/@foo/bar/package.json (0 errors) ====
- {
- "name": "@foo/bar",
- "version": "1.2.3"
- }
-
-==== /node_modules/a/node_modules/@foo/bar/index.d.ts (0 errors) ====
- export class C {
- private x: number;
- }
-
-==== /node_modules/a/index.d.ts (0 errors) ====
- import { C } from "@foo/bar";
- export const o: C;
-
-==== /node_modules/@foo/bar/use.d.ts (0 errors) ====
- import { C } from "./index";
- export function use(o: C): void;
-
-==== /node_modules/@foo/bar/index.d.ts (0 errors) ====
- export class C {
- private x: number;
- }
-
-==== /node_modules/@foo/bar/package.json (0 errors) ====
- {
- "name": "@foo/bar",
- "version": "1.2.3"
- }
-
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage_scoped.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage_scoped.errors.txt.diff
deleted file mode 100644
index 5fd8e03f0b..0000000000
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage_scoped.errors.txt.diff
+++ /dev/null
@@ -1,47 +0,0 @@
---- old.duplicatePackage_relativeImportWithinPackage_scoped.errors.txt
-+++ new.duplicatePackage_relativeImportWithinPackage_scoped.errors.txt
-@@= skipped -0, +0 lines =@@
--
-+/index.ts(4,5): error TS2345: Argument of type 'import("/node_modules/a/node_modules/@foo/bar/index").C' is not assignable to parameter of type 'import("/node_modules/@foo/bar/index").C'.
-+ Types have separate declarations of a private property 'x'.
-+
-+
-+==== /index.ts (1 errors) ====
-+ import { use } from "@foo/bar/use";
-+ import { o } from "a";
-+
-+ use(o);
-+ ~
-+!!! error TS2345: Argument of type 'import("/node_modules/a/node_modules/@foo/bar/index").C' is not assignable to parameter of type 'import("/node_modules/@foo/bar/index").C'.
-+!!! error TS2345: Types have separate declarations of a private property 'x'.
-+
-+==== /node_modules/a/node_modules/@foo/bar/package.json (0 errors) ====
-+ {
-+ "name": "@foo/bar",
-+ "version": "1.2.3"
-+ }
-+
-+==== /node_modules/a/node_modules/@foo/bar/index.d.ts (0 errors) ====
-+ export class C {
-+ private x: number;
-+ }
-+
-+==== /node_modules/a/index.d.ts (0 errors) ====
-+ import { C } from "@foo/bar";
-+ export const o: C;
-+
-+==== /node_modules/@foo/bar/use.d.ts (0 errors) ====
-+ import { C } from "./index";
-+ export function use(o: C): void;
-+
-+==== /node_modules/@foo/bar/index.d.ts (0 errors) ====
-+ export class C {
-+ private x: number;
-+ }
-+
-+==== /node_modules/@foo/bar/package.json (0 errors) ====
-+ {
-+ "name": "@foo/bar",
-+ "version": "1.2.3"
-+ }
-+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage_scoped.trace.json b/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage_scoped.trace.json
index 9e9981afde..39f2d2b98b 100644
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage_scoped.trace.json
+++ b/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage_scoped.trace.json
@@ -11,7 +11,7 @@ File '/node_modules/@foo/bar/use.tsx' does not exist.
File '/node_modules/@foo/bar/use.d.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/node_modules/@foo/bar/use.d.ts', result '/node_modules/@foo/bar/use.d.ts'.
-======== Module name '@foo/bar/use' was successfully resolved to '/node_modules/@foo/bar/use.d.ts' with Package ID '@foo/bar@1.2.3'. ========
+======== Module name '@foo/bar/use' was successfully resolved to '/node_modules/@foo/bar/use.d.ts' with Package ID '@foo/bar/use.d.ts@1.2.3'. ========
======== Resolving module 'a' from '/index.ts'. ========
Module resolution kind is not specified, using 'Bundler'.
Resolving in CJS mode with conditions 'require', 'types'.
@@ -58,4 +58,4 @@ File '/node_modules/a/node_modules/@foo/bar/index.tsx' does not exist.
File '/node_modules/a/node_modules/@foo/bar/index.d.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/node_modules/a/node_modules/@foo/bar/index.d.ts', result '/node_modules/a/node_modules/@foo/bar/index.d.ts'.
-======== Module name '@foo/bar' was successfully resolved to '/node_modules/a/node_modules/@foo/bar/index.d.ts' with Package ID '@foo/bar@1.2.3'. ========
+======== Module name '@foo/bar' was successfully resolved to '/node_modules/a/node_modules/@foo/bar/index.d.ts' with Package ID '@foo/bar/index.d.ts@1.2.3'. ========
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage_scoped.types b/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage_scoped.types
index 8fa6f0c879..927fdfa748 100644
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage_scoped.types
+++ b/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage_scoped.types
@@ -5,12 +5,12 @@ import { use } from "@foo/bar/use";
>use : (o: import("/node_modules/@foo/bar/index").C) => void
import { o } from "a";
->o : import("/node_modules/a/node_modules/@foo/bar/index").C
+>o : import("/node_modules/@foo/bar/index").C
use(o);
>use(o) : void
>use : (o: import("/node_modules/@foo/bar/index").C) => void
->o : import("/node_modules/a/node_modules/@foo/bar/index").C
+>o : import("/node_modules/@foo/bar/index").C
=== /node_modules/a/node_modules/@foo/bar/index.d.ts ===
export class C {
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage_scoped.types.diff b/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage_scoped.types.diff
deleted file mode 100644
index 61dace3bcc..0000000000
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_relativeImportWithinPackage_scoped.types.diff
+++ /dev/null
@@ -1,17 +0,0 @@
---- old.duplicatePackage_relativeImportWithinPackage_scoped.types
-+++ new.duplicatePackage_relativeImportWithinPackage_scoped.types
-@@= skipped -4, +4 lines =@@
- >use : (o: import("/node_modules/@foo/bar/index").C) => void
-
- import { o } from "a";
-->o : import("/node_modules/@foo/bar/index").C
-+>o : import("/node_modules/a/node_modules/@foo/bar/index").C
-
- use(o);
- >use(o) : void
- >use : (o: import("/node_modules/@foo/bar/index").C) => void
-->o : import("/node_modules/@foo/bar/index").C
-+>o : import("/node_modules/a/node_modules/@foo/bar/index").C
-
- === /node_modules/a/node_modules/@foo/bar/index.d.ts ===
- export class C {
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_subModule.errors.txt b/testdata/baselines/reference/submodule/compiler/duplicatePackage_subModule.errors.txt
deleted file mode 100644
index a7412affa6..0000000000
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_subModule.errors.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-/index.ts(4,7): error TS2322: Type 'import("/node_modules/a/node_modules/foo/Foo").default' is not assignable to type 'import("/node_modules/foo/Foo").default'.
- Property 'source' is protected but type 'Foo' is not a class derived from 'Foo'.
-
-
-==== /index.ts (1 errors) ====
- import Foo from "foo/Foo";
- import * as a from "a";
-
- const o: Foo = a.o;
- ~
-!!! error TS2322: Type 'import("/node_modules/a/node_modules/foo/Foo").default' is not assignable to type 'import("/node_modules/foo/Foo").default'.
-!!! error TS2322: Property 'source' is protected but type 'Foo' is not a class derived from 'Foo'.
-
-==== /node_modules/a/index.d.ts (0 errors) ====
- import Foo from "foo/Foo";
- export const o: Foo;
-
-==== /node_modules/a/node_modules/foo/Foo.d.ts (0 errors) ====
- export default class Foo {
- protected source: boolean;
- }
-
-==== /node_modules/a/node_modules/foo/package.json (0 errors) ====
- { "name": "foo", "version": "1.2.3" }
-
-==== /node_modules/foo/Foo.d.ts (0 errors) ====
- export default class Foo {
- protected source: boolean;
- }
-
-==== /node_modules/foo/package.json (0 errors) ====
- { "name": "foo", "version": "1.2.3" }
-
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_subModule.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/duplicatePackage_subModule.errors.txt.diff
deleted file mode 100644
index 7fb6c1ad0b..0000000000
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_subModule.errors.txt.diff
+++ /dev/null
@@ -1,37 +0,0 @@
---- old.duplicatePackage_subModule.errors.txt
-+++ new.duplicatePackage_subModule.errors.txt
-@@= skipped -0, +0 lines =@@
--
-+/index.ts(4,7): error TS2322: Type 'import("/node_modules/a/node_modules/foo/Foo").default' is not assignable to type 'import("/node_modules/foo/Foo").default'.
-+ Property 'source' is protected but type 'Foo' is not a class derived from 'Foo'.
-+
-+
-+==== /index.ts (1 errors) ====
-+ import Foo from "foo/Foo";
-+ import * as a from "a";
-+
-+ const o: Foo = a.o;
-+ ~
-+!!! error TS2322: Type 'import("/node_modules/a/node_modules/foo/Foo").default' is not assignable to type 'import("/node_modules/foo/Foo").default'.
-+!!! error TS2322: Property 'source' is protected but type 'Foo' is not a class derived from 'Foo'.
-+
-+==== /node_modules/a/index.d.ts (0 errors) ====
-+ import Foo from "foo/Foo";
-+ export const o: Foo;
-+
-+==== /node_modules/a/node_modules/foo/Foo.d.ts (0 errors) ====
-+ export default class Foo {
-+ protected source: boolean;
-+ }
-+
-+==== /node_modules/a/node_modules/foo/package.json (0 errors) ====
-+ { "name": "foo", "version": "1.2.3" }
-+
-+==== /node_modules/foo/Foo.d.ts (0 errors) ====
-+ export default class Foo {
-+ protected source: boolean;
-+ }
-+
-+==== /node_modules/foo/package.json (0 errors) ====
-+ { "name": "foo", "version": "1.2.3" }
-+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_subModule.types b/testdata/baselines/reference/submodule/compiler/duplicatePackage_subModule.types
index 7767de1d94..976b785722 100644
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_subModule.types
+++ b/testdata/baselines/reference/submodule/compiler/duplicatePackage_subModule.types
@@ -9,9 +9,9 @@ import * as a from "a";
const o: Foo = a.o;
>o : Foo
->a.o : import("/node_modules/a/node_modules/foo/Foo").default
+>a.o : Foo
>a : typeof a
->o : import("/node_modules/a/node_modules/foo/Foo").default
+>o : Foo
=== /node_modules/a/index.d.ts ===
import Foo from "foo/Foo";
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_subModule.types.diff b/testdata/baselines/reference/submodule/compiler/duplicatePackage_subModule.types.diff
deleted file mode 100644
index 25738a74af..0000000000
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_subModule.types.diff
+++ /dev/null
@@ -1,14 +0,0 @@
---- old.duplicatePackage_subModule.types
-+++ new.duplicatePackage_subModule.types
-@@= skipped -8, +8 lines =@@
-
- const o: Foo = a.o;
- >o : Foo
-->a.o : Foo
-+>a.o : import("/node_modules/a/node_modules/foo/Foo").default
- >a : typeof a
-->o : Foo
-+>o : import("/node_modules/a/node_modules/foo/Foo").default
-
- === /node_modules/a/index.d.ts ===
- import Foo from "foo/Foo";
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_withErrors.errors.txt b/testdata/baselines/reference/submodule/compiler/duplicatePackage_withErrors.errors.txt
index 090ca51dd3..89cc598606 100644
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_withErrors.errors.txt
+++ b/testdata/baselines/reference/submodule/compiler/duplicatePackage_withErrors.errors.txt
@@ -1,10 +1,4 @@
/node_modules/a/node_modules/x/index.d.ts(1,18): error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.
-/node_modules/b/index.d.ts(1,19): error TS2306: File '/node_modules/b/node_modules/x/index.d.ts' is not a module.
-/node_modules/b/node_modules/x/index.d.ts(1,1): error TS1434: Unexpected keyword or identifier.
-/node_modules/b/node_modules/x/index.d.ts(1,1): error TS2304: Cannot find name 'content'.
-/node_modules/b/node_modules/x/index.d.ts(1,9): error TS1434: Unexpected keyword or identifier.
-/node_modules/b/node_modules/x/index.d.ts(1,9): error TS2304: Cannot find name 'not'.
-/node_modules/b/node_modules/x/index.d.ts(1,13): error TS2304: Cannot find name 'parsed'.
==== /src/a.ts (0 errors) ====
@@ -22,23 +16,11 @@
==== /node_modules/a/node_modules/x/package.json (0 errors) ====
{ "name": "x", "version": "1.2.3" }
-==== /node_modules/b/index.d.ts (1 errors) ====
+==== /node_modules/b/index.d.ts (0 errors) ====
export { x } from "x";
- ~~~
-!!! error TS2306: File '/node_modules/b/node_modules/x/index.d.ts' is not a module.
-==== /node_modules/b/node_modules/x/index.d.ts (5 errors) ====
+==== /node_modules/b/node_modules/x/index.d.ts (0 errors) ====
content not parsed
- ~~~~~~~
-!!! error TS1434: Unexpected keyword or identifier.
- ~~~~~~~
-!!! error TS2304: Cannot find name 'content'.
- ~~~
-!!! error TS1434: Unexpected keyword or identifier.
- ~~~
-!!! error TS2304: Cannot find name 'not'.
- ~~~~~~
-!!! error TS2304: Cannot find name 'parsed'.
==== /node_modules/b/node_modules/x/package.json (0 errors) ====
{ "name": "x", "version": "1.2.3" }
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_withErrors.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/duplicatePackage_withErrors.errors.txt.diff
deleted file mode 100644
index 8885fbc2f7..0000000000
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_withErrors.errors.txt.diff
+++ /dev/null
@@ -1,39 +0,0 @@
---- old.duplicatePackage_withErrors.errors.txt
-+++ new.duplicatePackage_withErrors.errors.txt
-@@= skipped -0, +0 lines =@@
- /node_modules/a/node_modules/x/index.d.ts(1,18): error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.
-+/node_modules/b/index.d.ts(1,19): error TS2306: File '/node_modules/b/node_modules/x/index.d.ts' is not a module.
-+/node_modules/b/node_modules/x/index.d.ts(1,1): error TS1434: Unexpected keyword or identifier.
-+/node_modules/b/node_modules/x/index.d.ts(1,1): error TS2304: Cannot find name 'content'.
-+/node_modules/b/node_modules/x/index.d.ts(1,9): error TS1434: Unexpected keyword or identifier.
-+/node_modules/b/node_modules/x/index.d.ts(1,9): error TS2304: Cannot find name 'not'.
-+/node_modules/b/node_modules/x/index.d.ts(1,13): error TS2304: Cannot find name 'parsed'.
-
-
- ==== /src/a.ts (0 errors) ====
-@@= skipped -15, +21 lines =@@
- ==== /node_modules/a/node_modules/x/package.json (0 errors) ====
- { "name": "x", "version": "1.2.3" }
-
--==== /node_modules/b/index.d.ts (0 errors) ====
-+==== /node_modules/b/index.d.ts (1 errors) ====
- export { x } from "x";
-+ ~~~
-+!!! error TS2306: File '/node_modules/b/node_modules/x/index.d.ts' is not a module.
-
--==== /node_modules/b/node_modules/x/index.d.ts (0 errors) ====
-+==== /node_modules/b/node_modules/x/index.d.ts (5 errors) ====
- content not parsed
-+ ~~~~~~~
-+!!! error TS1434: Unexpected keyword or identifier.
-+ ~~~~~~~
-+!!! error TS2304: Cannot find name 'content'.
-+ ~~~
-+!!! error TS1434: Unexpected keyword or identifier.
-+ ~~~
-+!!! error TS2304: Cannot find name 'not'.
-+ ~~~~~~
-+!!! error TS2304: Cannot find name 'parsed'.
-
- ==== /node_modules/b/node_modules/x/package.json (0 errors) ====
- { "name": "x", "version": "1.2.3" }
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_withErrors.symbols b/testdata/baselines/reference/submodule/compiler/duplicatePackage_withErrors.symbols
index a8df9c4b12..76a9124077 100644
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_withErrors.symbols
+++ b/testdata/baselines/reference/submodule/compiler/duplicatePackage_withErrors.symbols
@@ -22,6 +22,6 @@ export { x } from "x";
>x : Symbol(x, Decl(index.d.ts, 0, 8))
=== /node_modules/b/node_modules/x/index.d.ts ===
-
content not parsed
+>x : Symbol(x, Decl(index.d.ts, 0, 12))
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_withErrors.symbols.diff b/testdata/baselines/reference/submodule/compiler/duplicatePackage_withErrors.symbols.diff
deleted file mode 100644
index 666f32f2ad..0000000000
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_withErrors.symbols.diff
+++ /dev/null
@@ -1,9 +0,0 @@
---- old.duplicatePackage_withErrors.symbols
-+++ new.duplicatePackage_withErrors.symbols
-@@= skipped -21, +21 lines =@@
- >x : Symbol(x, Decl(index.d.ts, 0, 8))
-
- === /node_modules/b/node_modules/x/index.d.ts ===
-+
- content not parsed
-->x : Symbol(x, Decl(index.d.ts, 0, 12))
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_withErrors.types b/testdata/baselines/reference/submodule/compiler/duplicatePackage_withErrors.types
index f1e33a4617..e96c81fd63 100644
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_withErrors.types
+++ b/testdata/baselines/reference/submodule/compiler/duplicatePackage_withErrors.types
@@ -6,8 +6,8 @@ import { x as xa } from "a";
>xa : number
import { x as xb } from "b";
->x : any
->xb : any
+>x : number
+>xb : number
=== /node_modules/a/index.d.ts ===
export { x } from "x";
@@ -22,11 +22,12 @@ export const x = 1 + 1;
=== /node_modules/b/index.d.ts ===
export { x } from "x";
->x : any
+>x : number
=== /node_modules/b/node_modules/x/index.d.ts ===
content not parsed
->content : any
->not : any
->parsed : any
+>x : number
+>1 + 1 : number
+>1 : 1
+>1 : 1
diff --git a/testdata/baselines/reference/submodule/compiler/duplicatePackage_withErrors.types.diff b/testdata/baselines/reference/submodule/compiler/duplicatePackage_withErrors.types.diff
deleted file mode 100644
index 6f962c0e97..0000000000
--- a/testdata/baselines/reference/submodule/compiler/duplicatePackage_withErrors.types.diff
+++ /dev/null
@@ -1,29 +0,0 @@
---- old.duplicatePackage_withErrors.types
-+++ new.duplicatePackage_withErrors.types
-@@= skipped -5, +5 lines =@@
- >xa : number
-
- import { x as xb } from "b";
-->x : number
-->xb : number
-+>x : any
-+>xb : any
-
- === /node_modules/a/index.d.ts ===
- export { x } from "x";
-@@= skipped -16, +16 lines =@@
-
- === /node_modules/b/index.d.ts ===
- export { x } from "x";
-->x : number
-+>x : any
-
- === /node_modules/b/node_modules/x/index.d.ts ===
- content not parsed
-->x : number
-->1 + 1 : number
-->1 : 1
-->1 : 1
-+>content : any
-+>not : any
-+>parsed : any
diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolution_packageJson_yesAtPackageRoot.trace.json b/testdata/baselines/reference/submodule/compiler/moduleResolution_packageJson_yesAtPackageRoot.trace.json
index f47943dc9e..642813b1a2 100644
--- a/testdata/baselines/reference/submodule/compiler/moduleResolution_packageJson_yesAtPackageRoot.trace.json
+++ b/testdata/baselines/reference/submodule/compiler/moduleResolution_packageJson_yesAtPackageRoot.trace.json
@@ -25,4 +25,4 @@ File '/node_modules/foo/bar.jsx' does not exist.
File '/node_modules/foo/bar/index.js' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/node_modules/foo/bar/index.js', result '/node_modules/foo/bar/index.js'.
-======== Module name 'foo/bar' was successfully resolved to '/node_modules/foo/bar/index.js' with Package ID 'foo@1.2.3'. ========
+======== Module name 'foo/bar' was successfully resolved to '/node_modules/foo/bar/index.js' with Package ID 'foo/bar/index.js@1.2.3'. ========
diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolution_packageJson_yesAtPackageRoot_fakeScopedPackage.trace.json b/testdata/baselines/reference/submodule/compiler/moduleResolution_packageJson_yesAtPackageRoot_fakeScopedPackage.trace.json
index 6dd76efa8d..c75b64190d 100644
--- a/testdata/baselines/reference/submodule/compiler/moduleResolution_packageJson_yesAtPackageRoot_fakeScopedPackage.trace.json
+++ b/testdata/baselines/reference/submodule/compiler/moduleResolution_packageJson_yesAtPackageRoot_fakeScopedPackage.trace.json
@@ -25,4 +25,4 @@ File '/node_modules/foo/@bar.jsx' does not exist.
File '/node_modules/foo/@bar/index.js' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/node_modules/foo/@bar/index.js', result '/node_modules/foo/@bar/index.js'.
-======== Module name 'foo/@bar' was successfully resolved to '/node_modules/foo/@bar/index.js' with Package ID 'foo@1.2.3'. ========
+======== Module name 'foo/@bar' was successfully resolved to '/node_modules/foo/@bar/index.js' with Package ID 'foo/@bar/index.js@1.2.3'. ========
diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolution_packageJson_yesAtPackageRoot_mainFieldInSubDirectory.trace.json b/testdata/baselines/reference/submodule/compiler/moduleResolution_packageJson_yesAtPackageRoot_mainFieldInSubDirectory.trace.json
index eeba5d48f4..9ab3791dde 100644
--- a/testdata/baselines/reference/submodule/compiler/moduleResolution_packageJson_yesAtPackageRoot_mainFieldInSubDirectory.trace.json
+++ b/testdata/baselines/reference/submodule/compiler/moduleResolution_packageJson_yesAtPackageRoot_mainFieldInSubDirectory.trace.json
@@ -18,4 +18,4 @@ File '/node_modules/foo/src/index.tsx' does not exist.
File '/node_modules/foo/src/index.d.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/node_modules/foo/src/index.d.ts', result '/node_modules/foo/src/index.d.ts'.
-======== Module name 'foo' was successfully resolved to '/node_modules/foo/src/index.d.ts' with Package ID 'foo@1.2.3'. ========
+======== Module name 'foo' was successfully resolved to '/node_modules/foo/src/index.d.ts' with Package ID 'foo/src/index.d.ts@1.2.3'. ========
diff --git a/testdata/baselines/reference/submodule/compiler/reactJsxReactResolvedNodeNext.trace.json b/testdata/baselines/reference/submodule/compiler/reactJsxReactResolvedNodeNext.trace.json
index 590f425b3a..028a3d5f62 100644
--- a/testdata/baselines/reference/submodule/compiler/reactJsxReactResolvedNodeNext.trace.json
+++ b/testdata/baselines/reference/submodule/compiler/reactJsxReactResolvedNodeNext.trace.json
@@ -10,7 +10,7 @@ Found 'package.json' at '/.src/node_modules/@types/react/package.json'.
File '/.src/node_modules/@types/react/jsx-runtime.d.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/.src/node_modules/@types/react/jsx-runtime.d.ts', result '/.src/node_modules/@types/react/jsx-runtime.d.ts'.
-======== Module name 'react/jsx-runtime' was successfully resolved to '/.src/node_modules/@types/react/jsx-runtime.d.ts' with Package ID '@types/react@0.0.1'. ========
+======== Module name 'react/jsx-runtime' was successfully resolved to '/.src/node_modules/@types/react/jsx-runtime.d.ts' with Package ID '@types/react/jsx-runtime.d.ts@0.0.1'. ========
======== Resolving module './' from '/.src/node_modules/@types/react/jsx-runtime.d.ts'. ========
Module resolution kind is not specified, using 'NodeNext'.
Resolving in CJS mode with conditions 'require', 'types', 'node'.
diff --git a/testdata/baselines/reference/submodule/conformance/customConditions(resolvepackagejsonexports=false).trace.json b/testdata/baselines/reference/submodule/conformance/customConditions(resolvepackagejsonexports=false).trace.json
index 2f3ee4888b..96a621363a 100644
--- a/testdata/baselines/reference/submodule/conformance/customConditions(resolvepackagejsonexports=false).trace.json
+++ b/testdata/baselines/reference/submodule/conformance/customConditions(resolvepackagejsonexports=false).trace.json
@@ -18,4 +18,4 @@ File '/node_modules/lodash/index.tsx' does not exist.
File '/node_modules/lodash/index.d.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/node_modules/lodash/index.d.ts', result '/node_modules/lodash/index.d.ts'.
-======== Module name 'lodash' was successfully resolved to '/node_modules/lodash/index.d.ts' with Package ID 'lodash@1.0.0'. ========
+======== Module name 'lodash' was successfully resolved to '/node_modules/lodash/index.d.ts' with Package ID 'lodash/index.d.ts@1.0.0'. ========
diff --git a/testdata/baselines/reference/submodule/conformance/typesVersions.ambientModules.trace.json b/testdata/baselines/reference/submodule/conformance/typesVersions.ambientModules.trace.json
index 3880078ee4..3cd5db8e87 100644
--- a/testdata/baselines/reference/submodule/conformance/typesVersions.ambientModules.trace.json
+++ b/testdata/baselines/reference/submodule/conformance/typesVersions.ambientModules.trace.json
@@ -21,7 +21,7 @@ File '/.src/node_modules/ext/ts3.1/index.tsx' does not exist.
File '/.src/node_modules/ext/ts3.1/index.d.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/.src/node_modules/ext/ts3.1/index.d.ts', result '/.src/node_modules/ext/ts3.1/index.d.ts'.
-======== Module name 'ext' was successfully resolved to '/.src/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext@1.0.0'. ========
+======== Module name 'ext' was successfully resolved to '/.src/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext/ts3.1/index.d.ts@1.0.0'. ========
======== Resolving module 'ext/other' from '/.src/main.ts'. ========
Module resolution kind is not specified, using 'Bundler'.
Resolving in CJS mode with conditions 'require', 'types'.
diff --git a/testdata/baselines/reference/submodule/conformance/typesVersions.multiFile.trace.json b/testdata/baselines/reference/submodule/conformance/typesVersions.multiFile.trace.json
index 27fef0f583..dd86ae732a 100644
--- a/testdata/baselines/reference/submodule/conformance/typesVersions.multiFile.trace.json
+++ b/testdata/baselines/reference/submodule/conformance/typesVersions.multiFile.trace.json
@@ -21,7 +21,7 @@ File '/.src/node_modules/ext/ts3.1/index.tsx' does not exist.
File '/.src/node_modules/ext/ts3.1/index.d.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/.src/node_modules/ext/ts3.1/index.d.ts', result '/.src/node_modules/ext/ts3.1/index.d.ts'.
-======== Module name 'ext' was successfully resolved to '/.src/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext@1.0.0'. ========
+======== Module name 'ext' was successfully resolved to '/.src/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext/ts3.1/index.d.ts@1.0.0'. ========
======== Resolving module 'ext/other' from '/.src/main.ts'. ========
Module resolution kind is not specified, using 'Bundler'.
Resolving in CJS mode with conditions 'require', 'types'.
@@ -39,4 +39,4 @@ File '/.src/node_modules/ext/ts3.1/other.tsx' does not exist.
File '/.src/node_modules/ext/ts3.1/other.d.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/.src/node_modules/ext/ts3.1/other.d.ts', result '/.src/node_modules/ext/ts3.1/other.d.ts'.
-======== Module name 'ext/other' was successfully resolved to '/.src/node_modules/ext/ts3.1/other.d.ts' with Package ID 'ext@1.0.0'. ========
+======== Module name 'ext/other' was successfully resolved to '/.src/node_modules/ext/ts3.1/other.d.ts' with Package ID 'ext/ts3.1/other.d.ts@1.0.0'. ========
diff --git a/testdata/baselines/reference/submodule/conformance/typesVersionsDeclarationEmit.ambient.trace.json b/testdata/baselines/reference/submodule/conformance/typesVersionsDeclarationEmit.ambient.trace.json
index 3880078ee4..3cd5db8e87 100644
--- a/testdata/baselines/reference/submodule/conformance/typesVersionsDeclarationEmit.ambient.trace.json
+++ b/testdata/baselines/reference/submodule/conformance/typesVersionsDeclarationEmit.ambient.trace.json
@@ -21,7 +21,7 @@ File '/.src/node_modules/ext/ts3.1/index.tsx' does not exist.
File '/.src/node_modules/ext/ts3.1/index.d.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/.src/node_modules/ext/ts3.1/index.d.ts', result '/.src/node_modules/ext/ts3.1/index.d.ts'.
-======== Module name 'ext' was successfully resolved to '/.src/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext@1.0.0'. ========
+======== Module name 'ext' was successfully resolved to '/.src/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext/ts3.1/index.d.ts@1.0.0'. ========
======== Resolving module 'ext/other' from '/.src/main.ts'. ========
Module resolution kind is not specified, using 'Bundler'.
Resolving in CJS mode with conditions 'require', 'types'.
diff --git a/testdata/baselines/reference/submodule/conformance/typesVersionsDeclarationEmit.multiFile.trace.json b/testdata/baselines/reference/submodule/conformance/typesVersionsDeclarationEmit.multiFile.trace.json
index 27fef0f583..dd86ae732a 100644
--- a/testdata/baselines/reference/submodule/conformance/typesVersionsDeclarationEmit.multiFile.trace.json
+++ b/testdata/baselines/reference/submodule/conformance/typesVersionsDeclarationEmit.multiFile.trace.json
@@ -21,7 +21,7 @@ File '/.src/node_modules/ext/ts3.1/index.tsx' does not exist.
File '/.src/node_modules/ext/ts3.1/index.d.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/.src/node_modules/ext/ts3.1/index.d.ts', result '/.src/node_modules/ext/ts3.1/index.d.ts'.
-======== Module name 'ext' was successfully resolved to '/.src/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext@1.0.0'. ========
+======== Module name 'ext' was successfully resolved to '/.src/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext/ts3.1/index.d.ts@1.0.0'. ========
======== Resolving module 'ext/other' from '/.src/main.ts'. ========
Module resolution kind is not specified, using 'Bundler'.
Resolving in CJS mode with conditions 'require', 'types'.
@@ -39,4 +39,4 @@ File '/.src/node_modules/ext/ts3.1/other.tsx' does not exist.
File '/.src/node_modules/ext/ts3.1/other.d.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/.src/node_modules/ext/ts3.1/other.d.ts', result '/.src/node_modules/ext/ts3.1/other.d.ts'.
-======== Module name 'ext/other' was successfully resolved to '/.src/node_modules/ext/ts3.1/other.d.ts' with Package ID 'ext@1.0.0'. ========
+======== Module name 'ext/other' was successfully resolved to '/.src/node_modules/ext/ts3.1/other.d.ts' with Package ID 'ext/ts3.1/other.d.ts@1.0.0'. ========
diff --git a/testdata/baselines/reference/submodule/conformance/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.trace.json b/testdata/baselines/reference/submodule/conformance/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.trace.json
index e5390b7825..539fad4d83 100644
--- a/testdata/baselines/reference/submodule/conformance/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.trace.json
+++ b/testdata/baselines/reference/submodule/conformance/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.trace.json
@@ -21,7 +21,7 @@ File '/.src/node_modules/ext/ts3.1/index.tsx' does not exist.
File '/.src/node_modules/ext/ts3.1/index.d.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/.src/node_modules/ext/ts3.1/index.d.ts', result '/.src/node_modules/ext/ts3.1/index.d.ts'.
-======== Module name 'ext' was successfully resolved to '/.src/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext@1.0.0'. ========
+======== Module name 'ext' was successfully resolved to '/.src/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext/ts3.1/index.d.ts@1.0.0'. ========
======== Resolving module 'ext/other' from '/.src/main.ts'. ========
Module resolution kind is not specified, using 'Bundler'.
Resolving in CJS mode with conditions 'require', 'types'.
@@ -39,7 +39,7 @@ File '/.src/node_modules/ext/ts3.1/other.tsx' does not exist.
File '/.src/node_modules/ext/ts3.1/other.d.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/.src/node_modules/ext/ts3.1/other.d.ts', result '/.src/node_modules/ext/ts3.1/other.d.ts'.
-======== Module name 'ext/other' was successfully resolved to '/.src/node_modules/ext/ts3.1/other.d.ts' with Package ID 'ext@1.0.0'. ========
+======== Module name 'ext/other' was successfully resolved to '/.src/node_modules/ext/ts3.1/other.d.ts' with Package ID 'ext/ts3.1/other.d.ts@1.0.0'. ========
======== Resolving module '../' from '/.src/node_modules/ext/ts3.1/index.d.ts'. ========
Module resolution kind is not specified, using 'Bundler'.
Resolving in CJS mode with conditions 'require', 'types'.
diff --git a/testdata/baselines/reference/submodule/conformance/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.trace.json b/testdata/baselines/reference/submodule/conformance/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.trace.json
index 59839558cf..1147e4d6c5 100644
--- a/testdata/baselines/reference/submodule/conformance/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.trace.json
+++ b/testdata/baselines/reference/submodule/conformance/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.trace.json
@@ -21,7 +21,7 @@ File '/.src/node_modules/ext/ts3.1/index.tsx' does not exist.
File '/.src/node_modules/ext/ts3.1/index.d.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/.src/node_modules/ext/ts3.1/index.d.ts', result '/.src/node_modules/ext/ts3.1/index.d.ts'.
-======== Module name 'ext' was successfully resolved to '/.src/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext@1.0.0'. ========
+======== Module name 'ext' was successfully resolved to '/.src/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext/ts3.1/index.d.ts@1.0.0'. ========
======== Resolving module 'ext/other' from '/.src/main.ts'. ========
Module resolution kind is not specified, using 'Bundler'.
Resolving in CJS mode with conditions 'require', 'types'.
@@ -37,7 +37,7 @@ File '/.src/node_modules/ext/other.tsx' does not exist.
File '/.src/node_modules/ext/other.d.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/.src/node_modules/ext/other.d.ts', result '/.src/node_modules/ext/other.d.ts'.
-======== Module name 'ext/other' was successfully resolved to '/.src/node_modules/ext/other.d.ts' with Package ID 'ext@1.0.0'. ========
+======== Module name 'ext/other' was successfully resolved to '/.src/node_modules/ext/other.d.ts' with Package ID 'ext/other.d.ts@1.0.0'. ========
======== Resolving module '../other' from '/.src/node_modules/ext/ts3.1/index.d.ts'. ========
Module resolution kind is not specified, using 'Bundler'.
Resolving in CJS mode with conditions 'require', 'types'.
diff --git a/testdata/baselines/reference/submodule/fourslash/goToDefinition/duplicatePackageServices.baseline.jsonc b/testdata/baselines/reference/submodule/fourslash/goToDefinition/duplicatePackageServices.baseline.jsonc
new file mode 100644
index 0000000000..9e286c69af
--- /dev/null
+++ b/testdata/baselines/reference/submodule/fourslash/goToDefinition/duplicatePackageServices.baseline.jsonc
@@ -0,0 +1,21 @@
+// === goToDefinition ===
+// === /node_modules/a/node_modules/x/index.d.ts ===
+// <|export default class [|X|] {
+// private x: number;
+// }|>
+
+// === /node_modules/a/index.d.ts ===
+// import [|X|]/*GOTO DEF*/ from "x";
+// export function a(x: X): void;
+
+
+
+// === goToDefinition ===
+// === /node_modules/a/node_modules/x/index.d.ts ===
+// <|export default class [|X|] {
+// private x: number;
+// }|>
+
+// === /node_modules/b/index.d.ts ===
+// import [|X|]/*GOTO DEF*/ from "x";
+// export const b: X;
\ No newline at end of file
diff --git a/testdata/baselines/reference/tsbuild/commandLine/help.js b/testdata/baselines/reference/tsbuild/commandLine/help.js
index 856a112bfc..e265cee7a4 100644
--- a/testdata/baselines/reference/tsbuild/commandLine/help.js
+++ b/testdata/baselines/reference/tsbuild/commandLine/help.js
@@ -104,6 +104,11 @@ Disable full type checking (only critical parse and emit errors will be reported
type: boolean
default: false
+[94m--disablePackageDeduplication[39m
+Disable deduplication of packages with the same name and version.
+type: boolean
+default: false
+
[94m--noEmit[39m
Disable emitting files from a compilation.
type: boolean
diff --git a/testdata/baselines/reference/tsbuild/commandLine/locale.js b/testdata/baselines/reference/tsbuild/commandLine/locale.js
index 26271d5f01..002c429519 100644
--- a/testdata/baselines/reference/tsbuild/commandLine/locale.js
+++ b/testdata/baselines/reference/tsbuild/commandLine/locale.js
@@ -104,6 +104,11 @@ Disable full type checking (only critical parse and emit errors will be reported
type: boolean
default: false
+[94m--disablePackageDeduplication[39m
+Disable deduplication of packages with the same name and version.
+type: boolean
+default: false
+
[94m--noEmit[39m
Disable emitting files from a compilation.
type: boolean
diff --git a/testdata/baselines/reference/tsbuild/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-preserveSymlinks.js b/testdata/baselines/reference/tsbuild/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-preserveSymlinks.js
index 45b4bc5898..034091b199 100644
--- a/testdata/baselines/reference/tsbuild/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-preserveSymlinks.js
+++ b/testdata/baselines/reference/tsbuild/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-preserveSymlinks.js
@@ -88,7 +88,7 @@ File '/user/username/projects/myproject/node_modules/pkg2/build/index.ts' does n
File '/user/username/projects/myproject/node_modules/pkg2/build/index.tsx' does not exist.
File '/user/username/projects/myproject/node_modules/pkg2/build/index.d.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
-======== Module name 'pkg2' was successfully resolved to '/user/username/projects/myproject/node_modules/pkg2/build/index.d.ts' with Package ID 'pkg2@1.0.0'. ========
+======== Module name 'pkg2' was successfully resolved to '/user/username/projects/myproject/node_modules/pkg2/build/index.d.ts' with Package ID 'pkg2/build/index.d.ts@1.0.0'. ========
======== Resolving module 'const' from '/user/username/projects/myproject/packages/pkg2/index.ts'. ========
Using compiler options of project reference redirect '/user/username/projects/myproject/packages/pkg2/tsconfig.json'.
Module resolution kind is not specified, using 'Bundler'.
diff --git a/testdata/baselines/reference/tsbuild/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly.js b/testdata/baselines/reference/tsbuild/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly.js
index 3744082d9d..e121e2932d 100644
--- a/testdata/baselines/reference/tsbuild/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly.js
+++ b/testdata/baselines/reference/tsbuild/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly.js
@@ -89,7 +89,7 @@ File '/user/username/projects/myproject/node_modules/pkg2/build/index.tsx' does
File '/user/username/projects/myproject/node_modules/pkg2/build/index.d.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/user/username/projects/myproject/node_modules/pkg2/build/index.d.ts', result '/user/username/projects/myproject/packages/pkg2/build/index.d.ts'.
-======== Module name 'pkg2' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/build/index.d.ts' with Package ID 'pkg2@1.0.0'. ========
+======== Module name 'pkg2' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/build/index.d.ts' with Package ID 'pkg2/build/index.d.ts@1.0.0'. ========
======== Resolving module 'const' from '/user/username/projects/myproject/packages/pkg2/index.ts'. ========
Using compiler options of project reference redirect '/user/username/projects/myproject/packages/pkg2/tsconfig.json'.
Module resolution kind is not specified, using 'Bundler'.
diff --git a/testdata/baselines/reference/tsbuildWatch/moduleResolution/build-mode-watches-for-changes-to-package-json-main-fields.js b/testdata/baselines/reference/tsbuildWatch/moduleResolution/build-mode-watches-for-changes-to-package-json-main-fields.js
index e9cdbb7c50..098eebd9bc 100644
--- a/testdata/baselines/reference/tsbuildWatch/moduleResolution/build-mode-watches-for-changes-to-package-json-main-fields.js
+++ b/testdata/baselines/reference/tsbuildWatch/moduleResolution/build-mode-watches-for-changes-to-package-json-main-fields.js
@@ -86,7 +86,7 @@ File '/user/username/projects/myproject/node_modules/pkg2/build/index.tsx' does
File '/user/username/projects/myproject/node_modules/pkg2/build/index.d.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/user/username/projects/myproject/node_modules/pkg2/build/index.d.ts', result '/user/username/projects/myproject/packages/pkg2/build/index.d.ts'.
-======== Module name 'pkg2' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/build/index.d.ts' with Package ID 'pkg2@1.0.0'. ========
+======== Module name 'pkg2' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/build/index.d.ts' with Package ID 'pkg2/build/index.d.ts@1.0.0'. ========
======== Resolving module './const.js' from '/user/username/projects/myproject/packages/pkg2/index.ts'. ========
Using compiler options of project reference redirect '/user/username/projects/myproject/packages/pkg2/tsconfig.json'.
Module resolution kind is not specified, using 'Bundler'.
diff --git a/testdata/baselines/reference/tsbuildWatch/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-cts-and-mts-extensions.js b/testdata/baselines/reference/tsbuildWatch/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-cts-and-mts-extensions.js
index 44005f7815..c9827a6f33 100644
--- a/testdata/baselines/reference/tsbuildWatch/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-cts-and-mts-extensions.js
+++ b/testdata/baselines/reference/tsbuildWatch/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-cts-and-mts-extensions.js
@@ -85,7 +85,7 @@ File '/user/username/projects/myproject/node_modules/pkg2/build/index.tsx' does
File '/user/username/projects/myproject/node_modules/pkg2/build/index.d.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/user/username/projects/myproject/node_modules/pkg2/build/index.d.ts', result '/user/username/projects/myproject/packages/pkg2/build/index.d.ts'.
-======== Module name 'pkg2' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/build/index.d.ts' with Package ID 'pkg2@1.0.0'. ========
+======== Module name 'pkg2' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/build/index.d.ts' with Package ID 'pkg2/build/index.d.ts@1.0.0'. ========
======== Resolving module './const.cjs' from '/user/username/projects/myproject/packages/pkg2/index.ts'. ========
Using compiler options of project reference redirect '/user/username/projects/myproject/packages/pkg2/tsconfig.json'.
Module resolution kind is not specified, using 'Node16'.
@@ -383,7 +383,7 @@ File '/user/username/projects/myproject/node_modules/pkg2/build/index.cts' does
File '/user/username/projects/myproject/node_modules/pkg2/build/index.d.cts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/user/username/projects/myproject/node_modules/pkg2/build/index.d.cts', result '/user/username/projects/myproject/packages/pkg2/build/index.d.cts'.
-======== Module name 'pkg2' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/build/index.d.cts' with Package ID 'pkg2@1.0.0'. ========
+======== Module name 'pkg2' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/build/index.d.cts' with Package ID 'pkg2/build/index.d.cts@1.0.0'. ========
======== Resolving module './const.cjs' from '/user/username/projects/myproject/packages/pkg2/index.cts'. ========
Using compiler options of project reference redirect '/user/username/projects/myproject/packages/pkg2/tsconfig.json'.
Module resolution kind is not specified, using 'Node16'.
diff --git a/testdata/baselines/reference/tsc/commandLine/help-all.js b/testdata/baselines/reference/tsc/commandLine/help-all.js
index 5e561d8833..426564f638 100644
--- a/testdata/baselines/reference/tsc/commandLine/help-all.js
+++ b/testdata/baselines/reference/tsc/commandLine/help-all.js
@@ -221,6 +221,11 @@ Ensure 'use strict' is always emitted.
type: boolean
default: `false`, unless `strict` is set
+[94m--disablePackageDeduplication[39m
+Disable deduplication of packages with the same name and version.
+type: boolean
+default: false
+
[94m--exactOptionalPropertyTypes[39m
Interpret optional property types as written, rather than adding 'undefined'.
type: boolean
diff --git a/testdata/baselines/reference/tsc/declarationEmit/when-pkg-references-sibling-package-through-indirect-symlink.js b/testdata/baselines/reference/tsc/declarationEmit/when-pkg-references-sibling-package-through-indirect-symlink.js
index 710a6e7b26..914182b948 100644
--- a/testdata/baselines/reference/tsc/declarationEmit/when-pkg-references-sibling-package-through-indirect-symlink.js
+++ b/testdata/baselines/reference/tsc/declarationEmit/when-pkg-references-sibling-package-through-indirect-symlink.js
@@ -68,11 +68,11 @@ Output::
pkg1/dist/types.d.ts
Imported via './types' from file 'pkg1/dist/index.d.ts'
pkg1/dist/index.d.ts
- Imported via '@raymondfeng/pkg1' from file 'pkg2/dist/types.d.ts' with packageId '@raymondfeng/pkg1@1.0.0'
+ Imported via '@raymondfeng/pkg1' from file 'pkg2/dist/types.d.ts' with packageId '@raymondfeng/pkg1/dist/index.d.ts@1.0.0'
pkg2/dist/types.d.ts
Imported via './types' from file 'pkg2/dist/index.d.ts'
pkg2/dist/index.d.ts
- Imported via "@raymondfeng/pkg2" from file 'pkg3/src/keys.ts' with packageId '@raymondfeng/pkg2@1.0.0'
+ Imported via "@raymondfeng/pkg2" from file 'pkg3/src/keys.ts' with packageId '@raymondfeng/pkg2/dist/index.d.ts@1.0.0'
pkg3/src/keys.ts
Imported via './keys' from file 'pkg3/src/index.ts'
Matched by default include pattern '**/*'
diff --git a/testdata/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link.js b/testdata/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link.js
index 5cfa0d4d57..70e094d00d 100644
--- a/testdata/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link.js
+++ b/testdata/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link.js
@@ -112,7 +112,7 @@ File '/user/username/projects/myproject/plugin-one/node_modules/plugin-two/dist/
File '/user/username/projects/myproject/plugin-one/node_modules/plugin-two/dist/commonjs/index.d.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/user/username/projects/myproject/plugin-one/node_modules/plugin-two/dist/commonjs/index.d.ts', result '/user/username/projects/myproject/plugin-two/dist/commonjs/index.d.ts'.
-======== Module name 'plugin-two' was successfully resolved to '/user/username/projects/myproject/plugin-two/dist/commonjs/index.d.ts' with Package ID 'plugin-two@0.1.3'. ========
+======== Module name 'plugin-two' was successfully resolved to '/user/username/projects/myproject/plugin-two/dist/commonjs/index.d.ts' with Package ID 'plugin-two/dist/commonjs/index.d.ts@0.1.3'. ========
======== Resolving module 'typescript-fsa' from '/user/username/projects/myproject/plugin-one/index.ts'. ========
Module resolution kind is not specified, using 'Bundler'.
Resolving in CJS mode with conditions 'require', 'types'.
@@ -137,7 +137,7 @@ File '/user/username/projects/myproject/plugin-one/node_modules/typescript-fsa/i
File '/user/username/projects/myproject/plugin-one/node_modules/typescript-fsa/index.d.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/user/username/projects/myproject/plugin-one/node_modules/typescript-fsa/index.d.ts', result '/user/username/projects/myproject/plugin-one/node_modules/typescript-fsa/index.d.ts'.
-======== Module name 'typescript-fsa' was successfully resolved to '/user/username/projects/myproject/plugin-one/node_modules/typescript-fsa/index.d.ts' with Package ID 'typescript-fsa@3.0.0-beta-2'. ========
+======== Module name 'typescript-fsa' was successfully resolved to '/user/username/projects/myproject/plugin-one/node_modules/typescript-fsa/index.d.ts' with Package ID 'typescript-fsa/index.d.ts@3.0.0-beta-2'. ========
======== Resolving module 'typescript-fsa' from '/user/username/projects/myproject/plugin-two/dist/commonjs/index.d.ts'. ========
Module resolution kind is not specified, using 'Bundler'.
Resolving in CJS mode with conditions 'require', 'types'.
@@ -163,15 +163,13 @@ File '/user/username/projects/myproject/plugin-two/node_modules/typescript-fsa/i
File '/user/username/projects/myproject/plugin-two/node_modules/typescript-fsa/index.d.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/user/username/projects/myproject/plugin-two/node_modules/typescript-fsa/index.d.ts', result '/user/username/projects/myproject/plugin-two/node_modules/typescript-fsa/index.d.ts'.
-======== Module name 'typescript-fsa' was successfully resolved to '/user/username/projects/myproject/plugin-two/node_modules/typescript-fsa/index.d.ts' with Package ID 'typescript-fsa@3.0.0-beta-2'. ========
+======== Module name 'typescript-fsa' was successfully resolved to '/user/username/projects/myproject/plugin-two/node_modules/typescript-fsa/index.d.ts' with Package ID 'typescript-fsa/index.d.ts@3.0.0-beta-2'. ========
../../../../home/src/tslibs/TS/Lib/lib.d.ts
Default library for target 'ES5'
-plugin-two/node_modules/typescript-fsa/index.d.ts
- Imported via "typescript-fsa" from file 'plugin-two/dist/commonjs/index.d.ts' with packageId 'typescript-fsa@3.0.0-beta-2'
plugin-two/dist/commonjs/index.d.ts
- Imported via "plugin-two" from file 'plugin-one/index.ts' with packageId 'plugin-two@0.1.3'
+ Imported via "plugin-two" from file 'plugin-one/index.ts' with packageId 'plugin-two/dist/commonjs/index.d.ts@0.1.3'
plugin-one/node_modules/typescript-fsa/index.d.ts
- Imported via "typescript-fsa" from file 'plugin-one/index.ts' with packageId 'typescript-fsa@3.0.0-beta-2'
+ Imported via "typescript-fsa" from file 'plugin-one/index.ts' with packageId 'typescript-fsa/index.d.ts@3.0.0-beta-2'
plugin-one/index.ts
Matched by default include pattern '**/*'
//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib*
diff --git a/testdata/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package.js b/testdata/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package.js
index 83b1575d13..fc9f6e3c5d 100644
--- a/testdata/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package.js
+++ b/testdata/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package.js
@@ -105,7 +105,7 @@ File '/user/username/projects/myproject/plugin-one/node_modules/typescript-fsa/i
File '/user/username/projects/myproject/plugin-one/node_modules/typescript-fsa/index.d.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/user/username/projects/myproject/plugin-one/node_modules/typescript-fsa/index.d.ts', result '/user/username/projects/myproject/plugin-one/node_modules/typescript-fsa/index.d.ts'.
-======== Module name 'typescript-fsa' was successfully resolved to '/user/username/projects/myproject/plugin-one/node_modules/typescript-fsa/index.d.ts' with Package ID 'typescript-fsa@3.0.0-beta-2'. ========
+======== Module name 'typescript-fsa' was successfully resolved to '/user/username/projects/myproject/plugin-one/node_modules/typescript-fsa/index.d.ts' with Package ID 'typescript-fsa/index.d.ts@3.0.0-beta-2'. ========
======== Resolving module 'plugin-two' from '/user/username/projects/myproject/plugin-one/index.ts'. ========
Module resolution kind is not specified, using 'Bundler'.
Resolving in CJS mode with conditions 'require', 'types'.
@@ -150,15 +150,13 @@ File '/user/username/projects/myproject/plugin-two/node_modules/typescript-fsa/i
File '/user/username/projects/myproject/plugin-two/node_modules/typescript-fsa/index.d.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/user/username/projects/myproject/plugin-two/node_modules/typescript-fsa/index.d.ts', result '/user/username/projects/myproject/plugin-two/node_modules/typescript-fsa/index.d.ts'.
-======== Module name 'typescript-fsa' was successfully resolved to '/user/username/projects/myproject/plugin-two/node_modules/typescript-fsa/index.d.ts' with Package ID 'typescript-fsa@3.0.0-beta-2'. ========
+======== Module name 'typescript-fsa' was successfully resolved to '/user/username/projects/myproject/plugin-two/node_modules/typescript-fsa/index.d.ts' with Package ID 'typescript-fsa/index.d.ts@3.0.0-beta-2'. ========
../../../../home/src/tslibs/TS/Lib/lib.d.ts
Default library for target 'ES5'
plugin-one/node_modules/typescript-fsa/index.d.ts
- Imported via "typescript-fsa" from file 'plugin-one/action.ts' with packageId 'typescript-fsa@3.0.0-beta-2'
+ Imported via "typescript-fsa" from file 'plugin-one/action.ts' with packageId 'typescript-fsa/index.d.ts@3.0.0-beta-2'
plugin-one/action.ts
Matched by default include pattern '**/*'
-plugin-two/node_modules/typescript-fsa/index.d.ts
- Imported via "typescript-fsa" from file 'plugin-two/index.d.ts' with packageId 'typescript-fsa@3.0.0-beta-2'
plugin-two/index.d.ts
Imported via "plugin-two" from file 'plugin-one/index.ts'
plugin-one/index.ts
diff --git a/testdata/baselines/reference/tsc/moduleResolution/pnpm-style-layout.js b/testdata/baselines/reference/tsc/moduleResolution/pnpm-style-layout.js
index 01e668625c..3c2149a1b2 100644
--- a/testdata/baselines/reference/tsc/moduleResolution/pnpm-style-layout.js
+++ b/testdata/baselines/reference/tsc/moduleResolution/pnpm-style-layout.js
@@ -134,7 +134,7 @@ File '/home/src/projects/component-type-checker/packages/app/node_modules/@compo
File '/home/src/projects/component-type-checker/packages/app/node_modules/@component-type-checker/sdk/src/index.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/home/src/projects/component-type-checker/packages/app/node_modules/@component-type-checker/sdk/src/index.ts', result '/home/src/projects/component-type-checker/packages/sdk/src/index.ts'.
-======== Module name '@component-type-checker/sdk' was successfully resolved to '/home/src/projects/component-type-checker/packages/sdk/src/index.ts' with Package ID '@component-type-checker/sdk1@0.0.2'. ========
+======== Module name '@component-type-checker/sdk' was successfully resolved to '/home/src/projects/component-type-checker/packages/sdk/src/index.ts' with Package ID '@component-type-checker/sdk1/src/index.ts@0.0.2'. ========
======== Resolving module '@component-type-checker/components' from '/home/src/projects/component-type-checker/packages/app/src/app.tsx'. ========
Module resolution kind is not specified, using 'Bundler'.
Resolving in CJS mode with conditions 'import', 'types'.
@@ -159,7 +159,7 @@ Resolving real path for '/home/src/projects/component-type-checker/packages/app/
Found 'package.json' at '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.2/node_modules/@component-type-checker/button/package.json'.
Found peerDependency '@component-type-checker/button' with '0.0.2' version.
Resolving real path for '/home/src/projects/component-type-checker/packages/app/node_modules/@component-type-checker/components/src/index.ts', result '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.2/node_modules/@component-type-checker/components/src/index.ts'.
-======== Module name '@component-type-checker/components' was successfully resolved to '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.2/node_modules/@component-type-checker/components/src/index.ts' with Package ID '@component-type-checker/components@0.0.1+@component-type-checker/button@0.0.2'. ========
+======== Module name '@component-type-checker/components' was successfully resolved to '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.2/node_modules/@component-type-checker/components/src/index.ts' with Package ID '@component-type-checker/components/src/index.ts@0.0.1+@component-type-checker/button@0.0.2'. ========
======== Resolving module '@component-type-checker/button' from '/home/src/projects/component-type-checker/packages/app/src/app.tsx'. ========
Module resolution kind is not specified, using 'Bundler'.
Resolving in CJS mode with conditions 'import', 'types'.
@@ -181,7 +181,7 @@ File '/home/src/projects/component-type-checker/packages/app/node_modules/@compo
File '/home/src/projects/component-type-checker/packages/app/node_modules/@component-type-checker/button/src/index.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/home/src/projects/component-type-checker/packages/app/node_modules/@component-type-checker/button/src/index.ts', result '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+button@0.0.2/node_modules/@component-type-checker/button/src/index.ts'.
-======== Module name '@component-type-checker/button' was successfully resolved to '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+button@0.0.2/node_modules/@component-type-checker/button/src/index.ts' with Package ID '@component-type-checker/button@0.0.2'. ========
+======== Module name '@component-type-checker/button' was successfully resolved to '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+button@0.0.2/node_modules/@component-type-checker/button/src/index.ts' with Package ID '@component-type-checker/button/src/index.ts@0.0.2'. ========
======== Resolving module '@component-type-checker/components' from '/home/src/projects/component-type-checker/packages/sdk/src/index.ts'. ========
Module resolution kind is not specified, using 'Bundler'.
Resolving in CJS mode with conditions 'import', 'types'.
@@ -206,7 +206,7 @@ Resolving real path for '/home/src/projects/component-type-checker/packages/sdk/
Found 'package.json' at '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.1/node_modules/@component-type-checker/button/package.json'.
Found peerDependency '@component-type-checker/button' with '0.0.1' version.
Resolving real path for '/home/src/projects/component-type-checker/packages/sdk/node_modules/@component-type-checker/components/src/index.ts', result '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.1/node_modules/@component-type-checker/components/src/index.ts'.
-======== Module name '@component-type-checker/components' was successfully resolved to '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.1/node_modules/@component-type-checker/components/src/index.ts' with Package ID '@component-type-checker/components@0.0.1+@component-type-checker/button@0.0.1'. ========
+======== Module name '@component-type-checker/components' was successfully resolved to '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.1/node_modules/@component-type-checker/components/src/index.ts' with Package ID '@component-type-checker/components/src/index.ts@0.0.1+@component-type-checker/button@0.0.1'. ========
======== Resolving module '@component-type-checker/button' from '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.1/node_modules/@component-type-checker/components/src/index.ts'. ========
Module resolution kind is not specified, using 'Bundler'.
Resolving in CJS mode with conditions 'import', 'types'.
@@ -234,7 +234,7 @@ File '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-ty
File '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.1/node_modules/@component-type-checker/button/src/index.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.1/node_modules/@component-type-checker/button/src/index.ts', result '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+button@0.0.1/node_modules/@component-type-checker/button/src/index.ts'.
-======== Module name '@component-type-checker/button' was successfully resolved to '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+button@0.0.1/node_modules/@component-type-checker/button/src/index.ts' with Package ID '@component-type-checker/button@0.0.1'. ========
+======== Module name '@component-type-checker/button' was successfully resolved to '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+button@0.0.1/node_modules/@component-type-checker/button/src/index.ts' with Package ID '@component-type-checker/button/src/index.ts@0.0.1'. ========
======== Resolving module '@component-type-checker/button' from '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.2/node_modules/@component-type-checker/components/src/index.ts'. ========
Module resolution kind is not specified, using 'Bundler'.
Resolving in CJS mode with conditions 'import', 'types'.
@@ -262,20 +262,20 @@ File '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-ty
File '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.2/node_modules/@component-type-checker/button/src/index.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.2/node_modules/@component-type-checker/button/src/index.ts', result '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+button@0.0.2/node_modules/@component-type-checker/button/src/index.ts'.
-======== Module name '@component-type-checker/button' was successfully resolved to '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+button@0.0.2/node_modules/@component-type-checker/button/src/index.ts' with Package ID '@component-type-checker/button@0.0.2'. ========
+======== Module name '@component-type-checker/button' was successfully resolved to '/home/src/projects/component-type-checker/node_modules/.pnpm/@component-type-checker+button@0.0.2/node_modules/@component-type-checker/button/src/index.ts' with Package ID '@component-type-checker/button/src/index.ts@0.0.2'. ========
../../../../tslibs/TS/Lib/lib.es5.d.ts
Library 'lib.es5.d.ts' specified in compilerOptions
../../node_modules/.pnpm/@component-type-checker+button@0.0.1/node_modules/@component-type-checker/button/src/index.ts
- Imported via "@component-type-checker/button" from file '../../node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.1/node_modules/@component-type-checker/components/src/index.ts' with packageId '@component-type-checker/button@0.0.1'
+ Imported via "@component-type-checker/button" from file '../../node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.1/node_modules/@component-type-checker/components/src/index.ts' with packageId '@component-type-checker/button/src/index.ts@0.0.1'
../../node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.1/node_modules/@component-type-checker/components/src/index.ts
- Imported via "@component-type-checker/components" from file '../sdk/src/index.ts' with packageId '@component-type-checker/components@0.0.1+@component-type-checker/button@0.0.1'
+ Imported via "@component-type-checker/components" from file '../sdk/src/index.ts' with packageId '@component-type-checker/components/src/index.ts@0.0.1+@component-type-checker/button@0.0.1'
../sdk/src/index.ts
- Imported via "@component-type-checker/sdk" from file 'src/app.tsx' with packageId '@component-type-checker/sdk1@0.0.2'
+ Imported via "@component-type-checker/sdk" from file 'src/app.tsx' with packageId '@component-type-checker/sdk1/src/index.ts@0.0.2'
../../node_modules/.pnpm/@component-type-checker+button@0.0.2/node_modules/@component-type-checker/button/src/index.ts
- Imported via "@component-type-checker/button" from file '../../node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.2/node_modules/@component-type-checker/components/src/index.ts' with packageId '@component-type-checker/button@0.0.2'
- Imported via "@component-type-checker/button" from file 'src/app.tsx' with packageId '@component-type-checker/button@0.0.2'
+ Imported via "@component-type-checker/button" from file '../../node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.2/node_modules/@component-type-checker/components/src/index.ts' with packageId '@component-type-checker/button/src/index.ts@0.0.2'
+ Imported via "@component-type-checker/button" from file 'src/app.tsx' with packageId '@component-type-checker/button/src/index.ts@0.0.2'
../../node_modules/.pnpm/@component-type-checker+components@0.0.1_@component-type-checker+button@0.0.2/node_modules/@component-type-checker/components/src/index.ts
- Imported via "@component-type-checker/components" from file 'src/app.tsx' with packageId '@component-type-checker/components@0.0.1+@component-type-checker/button@0.0.2'
+ Imported via "@component-type-checker/components" from file 'src/app.tsx' with packageId '@component-type-checker/components/src/index.ts@0.0.1+@component-type-checker/button@0.0.2'
src/app.tsx
Matched by include pattern 'src' in 'tsconfig.json'
//// [/home/src/projects/component-type-checker/packages/app/dist/app.js] *new*
diff --git a/testdata/tests/cases/compiler/disablePackageDeduplication.ts b/testdata/tests/cases/compiler/disablePackageDeduplication.ts
new file mode 100644
index 0000000000..11aaf510a0
--- /dev/null
+++ b/testdata/tests/cases/compiler/disablePackageDeduplication.ts
@@ -0,0 +1,43 @@
+// @noImplicitReferences: true
+// @disablePackageDeduplication: true,false
+
+// @Filename: /node_modules/a/index.d.ts
+import X from "x";
+export function a(x: X): void;
+
+// @Filename: /node_modules/a/node_modules/x/index.d.ts
+export default class X {
+ private x: number;
+}
+
+// @Filename: /node_modules/a/node_modules/x/package.json
+{ "name": "x", "version": "1.2.3" }
+
+// @Filename: /node_modules/b/index.d.ts
+import X from "x";
+export const b: X;
+
+// @Filename: /node_modules/b/node_modules/x/index.d.ts
+content not parsed
+
+// @Filename: /node_modules/b/node_modules/x/package.json
+{ "name": "x", "version": "1.2.3" }
+
+// @Filename: /node_modules/c/index.d.ts
+import X from "x";
+export const c: X;
+
+// @Filename: /node_modules/c/node_modules/x/index.d.ts
+export default class X {
+ private x: number;
+}
+
+// @Filename: /node_modules/c/node_modules/x/package.json
+{ "name": "x", "version": "1.2.4" }
+
+// @Filename: /src/a.ts
+import { a } from "a";
+import { b } from "b";
+import { c } from "c";
+a(b); // Works
+a(c); // Error, these are from different versions of the library.