Skip to content

chore(server): ban imports of @trpc/core in adapters - #5310

Merged
KATT merged 11 commits into
nextfrom
adapters-no-core
Jan 11, 2024
Merged

KATT merged 11 commits into
nextfrom
adapters-no-core

Conversation

@KATT

@KATT KATT commented Jan 11, 2024 •

Copy link
Copy Markdown
Member

Closes #5308

🎯 Changes

  • Ban imports of @trpc/core in adapters so that we can know that adapters can be made without relying on @trpc/core directly
  • Updates our adapters to use relative import of a file
  • Files are named e.g. @trpc/server.ts so that if someone builds an adapter they get a hint that they need to import @trpc/serverin it's place of e.g.../../@trpc-server`

Next steps

See if some/all of the adapters listed in #5308 builds using this approach

@vercel

vercel Bot commented Jan 11, 2024 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Comments Updated (UTC)
next-prisma-starter ❌ Failed (Inspect) Jan 11, 2024 11:37am
og-image βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jan 11, 2024 11:37am
trpc-next-app-dir βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jan 11, 2024 11:37am
www βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jan 11, 2024 11:37am

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is just a rename of the index.ts file

cool
@github-actions

github-actions Bot commented Jan 11, 2024 •

Copy link
Copy Markdown
Contributor

Diagnostics Comparison

Details

Numbers

Metric PR next
Files 736 735 (πŸ”Ί 1)
Lines of Library 40,241 40,241 (βž– 0)
Lines of Definitions 118,689 118,643 (πŸ”Ί 46)
Lines of TypeScript 4,867 4,867 (βž– 0)
Lines of JavaScript 0 0 (βž– 0)
Lines of JSON 0 0 (βž– 0)
Lines of Other 0 0 (βž– 0)
Identifiers 174,823 174,810 (πŸ”Ί 13)
Symbols 108,847 108,837 (πŸ”Ί 10)
Types 89 89 (βž– 0)
Instantiations 0 0 (βž– 0)
Memory used 166,762 166,812 (πŸ”½πŸŸ’ -50)
Assignability cache size 0 0 (βž– 0)
Identity cache size 0 0 (βž– 0)
Subtype cache size 0 0 (βž– 0)
Strict subtype cache size 0 0 (βž– 0)

Timings and averages

Metric PR next
max (s) 4.724 4.761 (πŸ”½πŸŸ’ -0.04)
min (s) 4.724 4.761 (πŸ”½πŸŸ’ -0.04)
avg (s) 4.724 4.761 (πŸ”½πŸŸ’ -0.04)
median (s) 4.724 4.761 (πŸ”½πŸŸ’ -0.04)
length 1 1 (βž– 0)
unstable timings

Unstable

Timings are not reliable in here

Metric PR next
I/O Read time 0.04 0.04 (βž– 0)
Parse time 0.72 0.73 (πŸ”½πŸŸ’ -0.01)
ResolveTypeReference time 0.03 0.03 (βž– 0)
ResolveModule time 0.12 0.11 (πŸ”Ί 0.01)
ResolveLibrary time 0.02 0.02 (βž– 0)
Program time 1.06 1.06 (βž– 0)
Bind time 0.43 0.48 (πŸ”½πŸŸ’ -0.05)
Total time 1.49 1.54 (πŸ”½πŸŸ’ -0.05)

* ```
*/
// @trpc/server
import type { AnyRouter, inferRouterContext } from '../../@trpc-server';

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.

if this should serve as examples for other adapters maybe import the smurfed, non-deprecated, AnyTRPCRouter ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, I just wanted to keep it unchanged for now to ensure nothing broke

@KATT
KATT merged commit 2d1b3f6 into next Jan 11, 2024
@KATT
KATT deleted the adapters-no-core branch January 11, 2024 14:20
@KATT KATT mentioned this pull request Jan 11, 2024
3 of 5 tasks
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been locked because we are very unlikely to see comments on closed issues. If you think, this PR is still necessary, create a new one with the same branch. Thank you.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jan 12, 2024

This branch had an error being deployed

2 failed and 3 active deployments
Preview – www β€” 25fa0039 Deployed Jan 11, 2024 by vercel[bot]
Preview – trpc-next-app-dir β€” 25fa0039 Deployed Jan 11, 2024 by vercel[bot]
Preview – og-image β€” 25fa0039 Deployed Jan 11, 2024 by vercel[bot]
Preview – todomvc β€” 25fa0039 Deployed Jan 11, 2024 by vercel[bot]
Preview – next-prisma-starter β€” 25fa0039 Deployed Jan 11, 2024 by vercel[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(v11): make it easier to extend tRPC

2 participants