-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Replaces the default module index resolver with '/index' instead of '' when handling internal routing for dts bundles #39277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
753c5b8
Adds support for declaring the bundled name of a dts module export
orta aca1c5b
Adds baselines
orta b03ebe1
Update the tests
orta f4cb096
Try to reduce the scope of the bundledPackageName error
orta 7645133
Use the flag in more baselines
orta d466b93
Get it green
orta e9b28b8
More tests
orta d657a2a
Merge master
orta 53bb670
Handle more feedback
orta 169b7aa
More test cleanup
orta dbfa7b4
Set the moduleResolution for the tsconfigs
orta 25d8b56
Merges master
orta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
tests/baselines/reference/bundledDtsLateExportRenaming.errors.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| error TS1391: The `bundledPackageName` option must be provided when using outFile and node module resolution with declaration emit. | ||
|
|
||
|
|
||
| !!! error TS1391: The `bundledPackageName` option must be provided when using outFile and node module resolution with declaration emit. | ||
| ==== tests/cases/compiler/index.ts (0 errors) ==== | ||
| export * from "./nested"; | ||
|
|
||
| ==== tests/cases/compiler/nested/base.ts (0 errors) ==== | ||
| import { B } from "./shared"; | ||
|
|
||
| export function f() { | ||
| return new B(); | ||
| } | ||
|
|
||
| ==== tests/cases/compiler/nested/derived.ts (0 errors) ==== | ||
| import { f } from "./base"; | ||
|
|
||
| export function g() { | ||
| return f(); | ||
| } | ||
|
|
||
| ==== tests/cases/compiler/nested/index.ts (0 errors) ==== | ||
| export * from "./base"; | ||
|
|
||
| export * from "./derived"; | ||
| export * from "./shared"; | ||
|
|
||
| ==== tests/cases/compiler/nested/shared.ts (0 errors) ==== | ||
| export class B {} | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| //// [tests/cases/compiler/bundledDtsLateExportRenaming.ts] //// | ||
|
|
||
| //// [index.ts] | ||
| export * from "./nested"; | ||
|
|
||
| //// [base.ts] | ||
| import { B } from "./shared"; | ||
|
|
||
| export function f() { | ||
| return new B(); | ||
| } | ||
|
|
||
| //// [derived.ts] | ||
| import { f } from "./base"; | ||
|
|
||
| export function g() { | ||
| return f(); | ||
| } | ||
|
|
||
| //// [index.ts] | ||
| export * from "./base"; | ||
|
|
||
| export * from "./derived"; | ||
| export * from "./shared"; | ||
|
|
||
| //// [shared.ts] | ||
| export class B {} | ||
|
|
||
|
|
||
|
|
||
|
|
||
| //// [out.d.ts] | ||
| declare module "nested/shared" { | ||
| export class B { | ||
| } | ||
| } | ||
| declare module "nested/base" { | ||
| import { B } from "nested/shared"; | ||
| export function f(): B; | ||
| } | ||
| declare module "nested/derived" { | ||
| export function g(): import("nested").B; | ||
| } | ||
| declare module "nested/index" { | ||
| export * from "nested/base"; | ||
| export * from "nested/derived"; | ||
| export * from "nested/shared"; | ||
| } | ||
| declare module "index" { | ||
| export * from "nested/index"; | ||
| } |
35 changes: 35 additions & 0 deletions
35
tests/baselines/reference/bundledDtsLateExportRenaming.symbols
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| === tests/cases/compiler/index.ts === | ||
| export * from "./nested"; | ||
| No type information for this code. | ||
| No type information for this code.=== tests/cases/compiler/nested/base.ts === | ||
| import { B } from "./shared"; | ||
| >B : Symbol(B, Decl(base.ts, 0, 8)) | ||
|
|
||
| export function f() { | ||
| >f : Symbol(f, Decl(base.ts, 0, 29)) | ||
|
|
||
| return new B(); | ||
| >B : Symbol(B, Decl(base.ts, 0, 8)) | ||
| } | ||
|
|
||
| === tests/cases/compiler/nested/derived.ts === | ||
| import { f } from "./base"; | ||
| >f : Symbol(f, Decl(derived.ts, 0, 8)) | ||
|
|
||
| export function g() { | ||
| >g : Symbol(g, Decl(derived.ts, 0, 27)) | ||
|
|
||
| return f(); | ||
| >f : Symbol(f, Decl(derived.ts, 0, 8)) | ||
| } | ||
|
|
||
| === tests/cases/compiler/nested/index.ts === | ||
| export * from "./base"; | ||
| No type information for this code. | ||
| No type information for this code.export * from "./derived"; | ||
| No type information for this code.export * from "./shared"; | ||
| No type information for this code. | ||
| No type information for this code.=== tests/cases/compiler/nested/shared.ts === | ||
| export class B {} | ||
| >B : Symbol(B, Decl(shared.ts, 0, 0)) | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm late to the party here, but I don't think it's right to pass the bundled package reference to
tryGetModuleNameFromPaths. These values get tested for equality with the values in thepathsvalue arrays (with*substitutions applied), which are absolute paths.bundledPkgReferencewill presumably not be an absolute path, so this will preventpathsfrom ever being used to generate a module specifier in tandem withbundledPackageName. Or, maybe that's the intent? I can't totally wrap my mind around how/why these options would ever be used together.