-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
chore(*): polishing upstream work on the data proxy [DPGA, 5] #13629
chore(*): polishing upstream work on the data proxy [DPGA, 5] #13629
Conversation
…/prisma into integration/chore/data-proxy-ga-5
5b1607e
to
5cf1374
Compare
await makeDir(dotPrismaClientDir) | ||
|
||
const dotPrismaClientEdgeDir = path.join(dotPrismaClientDir, 'edge') |
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.
Not needed anymore, instead of having a full folder, we just have one file.
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.
(Isomorphism is not needed because bundling for the edge means that we always bundle for the browser)
@@ -123,17 +123,8 @@ export async function buildClient({ | |||
|
|||
// we only generate the edge client if `--data-proxy` is passed | |||
if (dataProxy === true) { | |||
fileMap[path.join('edge', 'index.js')] = await JS(edgeTsClient, true) | |||
fileMap[path.join('edge', 'package.json')] = JSON.stringify( |
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.
Not needed anymore, instead of having a full folder, we just have one file.
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.
(Isomorphism is not needed because bundling for the edge means that we always bundle for the browser)
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.
Wait, so that means in isomporphic setups we will be bundling the whole client for the browser, right? In previous setup it was only enums, version info and a bunch of stubs, so significantly smaller amount of code. Is that what we want?
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.
If you deploy on Cloudflare Workers, it is by default bundled via the browser
field. The same applies to Vercel Edge Functions, they always chose browser
field. That means we cannot have such isomorphism, but just a browser
build, hence the single file. So yes, if you bundle @prisma/client/edge
into your frontend, you get the non-needed runtime with it, unfortunately. The best way to tackle this would be to have esm modules so that tree-shaking can take place (but that's a bigger project). In the meantime @prisma/client
can be used.
@@ -0,0 +1,3 @@ | |||
export const fn = () => {} | |||
|
|||
fn.prototype = fn |
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.
Polyfill for Vercel which disallows Function
.
}, | ||
plugins: [ | ||
fillPlugin({ | ||
// we remove eval and Function for vercel | ||
eval: { define: 'undefined' }, | ||
Function: { |
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.
Re-define Function
as being fn
(to rename it), and inject fn
.
58fe700
to
736ce04
Compare
}).join('\n') | ||
|
||
const schemaAnnotations = buildNFTSchemaAnnotation(engineType, relativeOutdir) | ||
const schemaAnnotations = buildNFTAnnotation('schema.prisma', relativeOutdir) |
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.
Just shrinking the code here.
…/prisma into integration/chore/data-proxy-ga-5
This PR aims to finalize the work on the Data Proxy GA. It is released as an integration version so that we can upgrade ecosystem tests and do manual QA. Small defects will be corrected here and missing tests will be written here too. Please base your review on the comments, and not the commits.
Todo:
prisma://
cannot be used with unsupported commands [DPGA, 4] #13627 (comment)Prev #13627
https://github.com/orgs/prisma/projects/70#card-82366798