Skip to content
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

fix: Ensure only selected types are exported from runime module #21119

Closed
wants to merge 1 commit into from

Conversation

SevInf
Copy link
Contributor

@SevInf SevInf commented Sep 18, 2023

In #20161, in order to solve type declaration/OOM/performance issues,
we added forced exports for every type within the runime.

However, our type bundler renames certain types if the naming conflicts.
For example, if there are 2 Result types, one of them will be renamed
to Result_2.

Making renamed type public gives tsc green light for dependenig on it
when creating declaration for third-party library. This is wrong,
because rename is not guaranteed to be stable. In fact, we have the
problem with accelerate extension on a different branch: latest
Accelerate depends on Result_2, but in a branch corresponding type got
renamed to Result_3.

Internal discussion: https://prisma-company.slack.com/archives/C04TW4A2H8C/p1694778678856899

In this PR we revert to manual re-exports and ensure every type from
core/types gets re-exported without rename. Tests, fixed in #20161 are still green,
but it also ensures that only types we want will leak to third party
project.

Couple of public types with conflicting names got renamed.

/integration

In #20161, in order to solve type declaration/OOM/performance issues,
we added forced exports for every type within the runime.

However, our type bundler renames certain types if the naming conflicts.
For example, if there are 2 `Result` types, one of them will be renamed
to `Result_2`.

Making renamed type public gives `tsc` green light for dependenig on it
when creating declaration for third-party library. This is wrong,
because rename is not guaranteed to be stable. In fact, we have the
problem with `accelerate` extension on a different branch: latest
Accelerate depends on `Result_2`, but in a branch corresponding type got
renamed to `Result_3`.

Internal discussion: https://prisma-company.slack.com/archives/C04TW4A2H8C/p1694778678856899

In this PR we revert to manual re-exports and ensure every type from
`core/types` gets re-exported without rename. Tests, fixed in #20161 are still green,
but it also ensures that only types we want will leak to third party
project.

Couple of public types with conflicting names got renamed.
@SevInf SevInf requested a review from millsp September 18, 2023 15:19
@github-actions
Copy link
Contributor

size-limit report 📦

Path Size
packages/client/runtime/library.d.ts 94.95 KB (+3.05% 🔺)
packages/client/runtime/library.js 177.1 KB (0%)
packages/client/runtime/binary.js 599.47 KB (0%)
packages/client/runtime/edge.js 207.46 KB (0%)
packages/cli/build/index.js 5.07 MB (0%)

@SevInf
Copy link
Contributor Author

SevInf commented Sep 18, 2023

Note: accelerate extension would need to be rebuilt to work correctly. We could add type Result_2 = Result alias to circumvent this

@SevInf
Copy link
Contributor Author

SevInf commented Oct 25, 2023

Superseded by #21179

@SevInf SevInf closed this Oct 25, 2023
@millsp millsp deleted the fix/controlled-exports branch October 26, 2023 18:49
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.

None yet

1 participant