-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(driver-adapters): remove external wasm deps hack for napi, lift…
… `driver-adapters` from `query-engine/..` to `libs/..` (#5115) * feat(schema-engine-wasm): created wasm-compatible schema-engine-wasm skeleton * chore(schema-engine-wasm): added "make build-se-wasm" command * fix(schema-engine-wasm): replace "SchemaEngineParams" class instance with JS object via tsify. Fix build.sh script * feat(schema-engine-wasm): implement playground skeleton * fix(schema-engine-wasm): clippy * chore(schema-engine-wasm): lift "driver-adapters" from "query-engine" to "libs" folder * Delete libs/driver-adapters/executor/bench/seed.sql.gz * chore: update Cargo.lock * chore: update driver-adapters path references * chore: update query-engine-wasm path references * chore: update query-engine-wasm path references * chore: update query-engine-wasm and schema-engine-wasm path references * feat(driver-adapters): get rid of external import hack, fix paths in Napi engine scenario * Revert "Delete libs/driver-adapters/executor/bench/seed.sql.gz" This reverts commit 0360567. * chore: fix conflicts * chore: fix pnpm version to avoid pnpm/pnpm#8953 * fix: use actual dist JS file * chore: update tsup to latest --------- Co-authored-by: jkomyno <[email protected]>
- Loading branch information
Showing
80 changed files
with
85 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ jobs: | |
- name: "Setup pnpm" | ||
uses: pnpm/[email protected] | ||
with: | ||
version: 9 | ||
version: 9.15.1 | ||
|
||
- name: "Login to Docker Hub" | ||
uses: docker/login-action@v3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/usr/bin/env bash | ||
node "$(dirname "${BASH_SOURCE[0]}")/../dist/testd-qe.js" |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import fs from 'node:fs/promises' | ||
import path from 'node:path' | ||
import { __dirname, normaliseProvider } from './utils' | ||
import type { Queryable } from '@prisma/driver-adapter-utils' | ||
|
||
const relativePath = '../../../../query-engine/query-engine-wasm/pkg' | ||
|
||
const initializedModules = new Set<Queryable['provider']>() | ||
|
||
export async function getQueryEngineForProvider(provider: Queryable['provider']) { | ||
const normalisedProvider = normaliseProvider(provider) | ||
const engine = await import(`${relativePath}/${normalisedProvider}/query_engine_bg.js`) | ||
|
||
if (!initializedModules.has(provider)) { | ||
const bytes = await fs.readFile( | ||
path.resolve( | ||
__dirname, | ||
relativePath, | ||
normalisedProvider, | ||
'query_engine_bg.wasm', | ||
), | ||
) | ||
|
||
const module = new WebAssembly.Module(bytes) | ||
const instance = new WebAssembly.Instance(module, { | ||
'./query_engine_bg.js': engine, | ||
}) | ||
engine.__wbg_set_wasm(instance.exports) | ||
initializedModules.add(provider) | ||
} | ||
|
||
return engine.QueryEngine | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import fs from 'node:fs/promises' | ||
import path from 'node:path' | ||
import { __dirname, normaliseProvider } from './utils.js' | ||
import type { Queryable } from '@prisma/driver-adapter-utils' | ||
|
||
const relativePath = '../../../../schema-engine/schema-engine-wasm/pkg' | ||
|
||
const initializedModules = new Set<Queryable['provider']>() | ||
|
||
export async function getSchemaEngineForProvider(provider: Queryable['provider']) { | ||
const normalisedProvider = normaliseProvider(provider) | ||
const engine = await import(`${relativePath}/${normalisedProvider}/schema_engine_bg.js`) | ||
|
||
if (!initializedModules.has(provider)) { | ||
const bytes = await fs.readFile( | ||
path.resolve( | ||
__dirname, | ||
relativePath, | ||
normalisedProvider, | ||
'schema_engine_bg.wasm', | ||
), | ||
) | ||
|
||
const module = new WebAssembly.Module(bytes) | ||
const instance = new WebAssembly.Instance(module, { './schema_engine_bg.js': engine }) | ||
engine.__wbg_set_wasm(instance.exports) | ||
initializedModules.add(provider) | ||
} | ||
|
||
return engine.SchemaEngine | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
43 changes: 0 additions & 43 deletions
43
query-engine/driver-adapters/executor/src/query-engine-wasm.ts
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
query-engine/driver-adapters/executor/src/schema-engine-wasm.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters