Skip to content

Resolve handler paths of route strings in the SST plugin - #2416

Merged
webpro merged 1 commit into
webpro-nl:mainfrom
everton-dgn:fix/sst-route-string-handler
Nov 19, 2026
Merged

webpro merged 1 commit into
webpro-nl:mainfrom
everton-dgn:fix/sst-route-string-handler

Conversation

@everton-dgn

Copy link
Copy Markdown
Contributor

A route with a string handler, like api.route("POST /graphql", "pothos/graphql.handler") in SST's pothos example, kept the .handler suffix, so pothos/graphql.ts didn't resolve and was reported as unused. The plugin already drops the suffix from handler properties, which take the same file.export string, and routes now go through the same helper. In the sst2 fixture, one route now points to a file nothing else references, so the object form can't hide it.

@pkg-pr-new

pkg-pr-new Bot commented Nov 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/knip@2416
npm i https://pkg.pr.new/@knip/language-server@2416
npm i https://pkg.pr.new/@knip/mcp@2416

commit: 29ab77b

@webpro webpro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Route strings use the same file.export form as handler properties, so sending them through the same helper is the right fix. It resolves the handlers in configs that list their routes in sst.config.ts, like the Pothos example.

One gap remains, same as before this change: the SST v3 guide layout defines routes in infra/*.ts, loaded from sst.config.ts with await import, and the plugin does not read those files yet. That is where most string routes live, so it would make a good follow-up.

@webpro
webpro merged commit 5ee6f62 into webpro-nl:main Nov 19, 2026
33 checks passed
@webpro

webpro commented Nov 20, 2026

Copy link
Copy Markdown
Member

🚀 This pull request is included in v6.47.0. See Release 6.47.0 for release notes.

Using Knip in a commercial project? Please consider becoming a sponsor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants