feat(core): add fork of cuid
with wasm32-unknown-unknown support
#4231
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR deprecates #4217.
Is uses a
cuid
fork that is compatible withwasm32-unknown-unknown
targets (as long thejs
feature of thegetrandom
dependency is active). See diff.It closes https://github.com/prisma/team-orm/issues/350. It closes https://github.com/prisma/team-orm/issues/282.
How to test
In the
wasm32-support
branch of thecuid-rust
forkcargo test -p cuid -- collisions::test --ignored --test-threads=1
cargo test -p cuid -- collisions::single_thread --ignored --test-threads=1
nice -n -20 cargo bench
In this PR
Running
cargo tree -p prisma-schema-build --target wasm32-unknown-unknown | grep cuid
should yield:indicating that Prisma's
cuid
fork withwasm32
support is pulled in the Wasm binary for@prisma/prisma-schema-wasm
.Running
cargo tree -p query-engine-node-api -e features | grep getrandom
should yield:indicating that the napi.rs Query Engine uses the default features of
getrandom
, rather than"js"
.Running
cargo tree -p prisma-schema-build -e features --target wasm32-unknown-unknown | grep getrandom
should yield:indicating that
@prisma/prisma-schema-wasm
would use the"js"
feature ofgetrandom
.Running
cargo build -p prisma-schema-build --target wasm32-unknown-unknown && echo $?
should exit with0
.TODO:
wasm
branch in https://github.com/prisma/cuid-rust after review.