-
Notifications
You must be signed in to change notification settings - Fork 235
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
feat(driver-adapters): enable Wasm on driver-adapters
, with further deduplications required later
#4456
Conversation
…asm32-unknown-unknown compilation
…github.com:prisma/prisma-engines into feat/sql-query-connector-on-wasm32-unknown-unknown
…o feat/query-core-on-wasm32-unknown-unknown
|
||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies] | ||
napi.workspace = true | ||
napi-derive.workspace = true | ||
quaint.workspace = true | ||
|
||
[target.'cfg(target_arch = "wasm32")'.dependencies] | ||
quaint = { path = "../../quaint" } | ||
js-sys.workspace = true | ||
serde-wasm-bindgen.workspace = true | ||
wasm-bindgen.workspace = true | ||
wasm-bindgen-futures.workspace = true | ||
tsify.workspace = true | ||
ducktor = "0.1.0" | ||
pin-project = "1" |
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.
I believe you should be able to use quaint's workspace version in both cases here. See doc here
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.
Thanks, I didn't know this about resolver = "2"
.
wasm-bindgen.workspace = true | ||
wasm-bindgen-futures.workspace = true | ||
tsify.workspace = true | ||
ducktor = "0.1.0" |
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.
This dependency, ducktor
, looks scary tbh. Looks unknown, a few months old with barely any tests. How much work does it remove from our plate?
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.
ducktor
was one of the shortcuts taken (I already had some code using it laying around).
Removed in d6d09d6.
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.
Looks like this change broke something:
Error: `unwrap_throw` failed
at __wbindgen_throw (file:///Users/jkomyno/work/prisma/prisma-engines/query-engine/query-engine-wasm/pkg/query_engine_bg.js:977:11)
at wasm://wasm/01063c0e:wasm-function[5374]:0x352371
at wasm://wasm/01063c0e:wasm-function[3153]:0x32513b
at wasm://wasm/01063c0e:wasm-function[93]:0x3902b
I'll take another look tomorrow.
@@ -125,10 +126,12 @@ impl QueryEngine { | |||
|
|||
let mut schema = psl::validate(datamodel.into()); | |||
let config = &mut schema.configuration; | |||
let preview_features = config.preview_features(); |
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.
looks unused?
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.
Too much code duplication between driver-adapters:napi
and driver-adapters::wasm
. Some work needs to be done to have a shared implementation.
This is currently broken, see #4456 (comment). |
driver-adapters
driver-adapters
, with further deduplications required later
This PR contributes to https://github.com/prisma/team-orm/issues/548, and depends on #4455.
Idea: add Wasm support to
driver-adapters
, which currently relies onnapi.rs
only, by splitting the wasm-specific logic into thewasm
module, and thenapi.rs
-specific logic into thenapi
module.These modules are mutually exclusive and provide almost the same public API.
The
wasm
module is compiled when the target architecture iswasm32-*
, andnapi
is used otherwise.See Slack thread for context about it.
For what is worth, I think this PR is good enough for getting the vertical slice asap, but not for integrating into
main
, as I pointed our in a few comments.