-
Notifications
You must be signed in to change notification settings - Fork 1.9k
chore: switch to module ESNext + moduleResolution bundler #2095
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
Open
mattzcarey
wants to merge
3
commits into
main
Choose a base branch
from
chore/bundler-tsconfig
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| // Auth configuration | ||
| export type { CreateDemoAuthOptions, DemoAuth } from './auth.js'; | ||
| export { createDemoAuth } from './auth.js'; | ||
| export type { CreateDemoAuthOptions, DemoAuth } from './auth'; | ||
| export { createDemoAuth } from './auth'; | ||
|
|
||
| // Auth server setup + demo token verifier (pass to `requireBearerAuth` from @modelcontextprotocol/express) | ||
| export type { SetupAuthServerOptions } from './authServer.js'; | ||
| export { createProtectedResourceMetadataRouter, demoTokenVerifier, getAuth, setupAuthServer } from './authServer.js'; | ||
| export type { SetupAuthServerOptions } from './authServer'; | ||
| export { createProtectedResourceMetadataRouter, demoTokenVerifier, getAuth, setupAuthServer } from './authServer'; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,4 +10,4 @@ | |
| * @experimental | ||
| */ | ||
|
|
||
| export * from './tasks/client.js'; | ||
| export * from './tasks/client'; | ||
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
Oops, something went wrong.
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.
🟡 After consolidating the quickstart tsconfigs onto
@modelcontextprotocol/tsconfig, the examples now inherittarget: esnext/lib: [esnext]from the shared base, butdocs/client-quickstart.mdstill showstarget: ES2023/lib: [ES2023]anddocs/server-quickstart.mdstill showstarget: ES2022(nolib). This is the same kind of doc/tsconfig drift the PR already fixed formodule/moduleResolution— either bump the docs toesnextor pintarget/liboverrides in the example tsconfigs to keep them aligned with what the docs advertise.Extended reasoning...
What the bug is
Before this PR,
examples/client-quickstart/tsconfig.jsonandexamples/server-quickstart/tsconfig.jsonwere standalone configs that matched thetsconfig.jsonblocks in their respective quickstart docs field-for-field ontarget/lib(client:ES2023/[ES2023]; server:ES2022/nolib). After this PR, both example tsconfigs were rewritten to"extends": "@modelcontextprotocol/tsconfig"and dropped their owntarget/libentries. The shared base atcommon/tsconfig/tsconfig.json:3-4sets"target": "esnext"and"lib": ["esnext"], and the example overrides only touchoutDir,rootDir,declaration,declarationMap,types, andpaths— nottarget/lib. So both examples now compile with an effective target ofesnext, while the docs still tell users to useES2023/ES2022.The specific code path
docs/client-quickstart.md:91-92→"target": "ES2023","lib": ["ES2023"]examples/client-quickstart/tsconfig.json→ extends@modelcontextprotocol/tsconfig, notarget/liboverride → effectiveesnext/[esnext]docs/server-quickstart.md:106→"target": "ES2022", nolibexamples/server-quickstart/tsconfig.json→ extends@modelcontextprotocol/tsconfig, notarget/liboverride → effectiveesnext/[esnext]This is a new drift introduced by the PR. The PR already fixed the
module/moduleResolutiondrift in the same doc blocks (raised in an earlier review comment), but the consolidation onto the shared base introduced fresh drift ontarget/libthat wasn't propagated.Why existing checks don't catch it
The
tsconfig.jsonblocks in both docs are plain ```json fences with nosource=attribute, so `pnpm sync:snippets --check` does not compare them against the example files. The `.ts` code snippets in the docs are `source=`-tagged and synced from the example sources — which means CI typechecks those snippets under the example's effective `target: esnext`, while the doc tells the user to compile with `ES2023`/`ES2022`.Step-by-step proof
common/tsconfig/tsconfig.json— lines 3-4 set"target": "esnext","lib": ["esnext"].examples/client-quickstart/tsconfig.jsonafter this PR — it has"extends": "@modelcontextprotocol/tsconfig"and itscompilerOptionsoverride setsoutDir,rootDir,declaration,declarationMap,types,pathsbut nottargetorlib. Effective target is thereforeesnext.docs/client-quickstart.md:91-92— it still shows"target": "ES2023","lib": ["ES2023"].examples/server-quickstart/tsconfig.jsoninheritsesnext, butdocs/server-quickstart.md:106shows"target": "ES2022"with nolib.git show HEAD~3:examples/client-quickstart/tsconfig.json), the example was standalone with"target": "ES2023","lib": ["ES2023"]— identical to the doc block. The drift is introduced here.Impact
No runtime breakage today — the quickstart code uses no post-ES2022/ES2023 syntax. The latent risk is that CI now typechecks the doc-synced
.tssnippets undertarget: esnext, so a future edit using post-ES2023 syntax (e.g., a new ECMAScript proposal) would compile cleanly in CI but fail for a user who copies the doctsconfig.jsonverbatim. It's primarily a documentation-consistency issue, the same class as themodule/moduleResolutiondrift already addressed in this PR.How to fix
Either:
tsconfig.jsonblocks to"target": "esnext"/"lib": ["esnext"]so they match the example's effective config, or"target": "ES2023"/"lib": ["ES2023"](and"target": "ES2022") overrides back into the examplecompilerOptionsso the example matches what the docs advertise.Optionally, give the doc tsconfig blocks a
source=attribute (or similar) sosync:snippetscan catch this class of drift going forward.