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(deps): update undici to 4.0.0 #7931

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 18 additions & 4 deletions src/packages/client/helpers/build.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const execa = require('execa')
const fs = require('fs')
const fs = require('fs-extra')
const chalk = require('chalk')
const path = require('path')
const { promisify } = require('util')
const esbuild = require('esbuild')
const copyFile = promisify(fs.copyFile)
Expand Down Expand Up @@ -31,8 +32,15 @@ async function main() {
target: 'node12',
outfile: 'generator-build/index.js',
entryPoints: ['src/generator.ts'],
external: ['_http_common']
}),
// copy wasm files, etc necessary for undici
fs.copy(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not familiar enough with esbuild. The problem is that undici uses path.resolve to establish a path to wasm files (https://github.com/nodejs/undici/blob/e705509ab22ab80aadf0fc1a394afff7dc014fdf/lib/client.js#L390-L398) and I wasn't able to find a plugin that could resolve that and copy files accordingly.

Choose a reason for hiding this comment

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

I just don't know what I'm doing myself.

path.resolve(
__dirname,
'../node_modules/@prisma/engine-core/node_modules/undici/lib/llhttp',
),
path.resolve(__dirname, '../generator-build/llhttp'),
),
])

await Promise.all([
Expand All @@ -42,7 +50,6 @@ async function main() {
target: 'node12',
outdir: 'runtime',
entryPoints: ['src/runtime/index.ts'],
external: ['_http_common']
}),
esbuild.build({
platform: 'node',
Expand All @@ -51,9 +58,16 @@ async function main() {
target: ['chrome58', 'firefox57', 'safari11', 'edge16'],
outdir: 'runtime',
entryPoints: ['src/runtime/index-browser.ts'],
external: ['_http_common']
}),
run('rollup -c'),
// copy wasm files, etc necessary for undici
fs.copy(
path.resolve(
__dirname,
'../node_modules/@prisma/engine-core/node_modules/undici/lib/llhttp',
),
path.resolve(__dirname, '../runtime/llhttp'),
),
])

await Promise.all([
Expand Down
1 change: 1 addition & 0 deletions src/packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"eslint-plugin-prettier": "3.4.0",
"execa": "5.1.1",
"flat-map-polyfill": "0.3.8",
"fs-extra": "10.0.0",
"fs-monkey": "1.0.3",
"get-own-enumerable-property-symbols": "3.0.2",
"indent-string": "4.0.0",
Expand Down