1.6 KiB
I will implement the Deno runtime compatibility plan as described in WASI_DENO.md.
Plan:
-
Database Migration:
-
Create a new migration
20260312000003_add_function_runtime.sql. -
Add
runtimecolumn tofunctions.functionstable (TEXT, DEFAULT 'wasm'). -
Update existing functions to have
runtime = 'wasm'.
-
-
Update Dependencies:
-
Add
deno_coretofunctions/Cargo.toml. -
Note: I will start with
deno_coreto avoid potential build OOM issues with the fulldeno_runtime. I will implement a minimal JS runtime capable of executing scripts and returning results.
-
-
Update Data Models:
-
Modify
Functionstruct infunctions/src/models.rsto include theruntimefield. -
Update
DeployRequeststruct infunctions/src/models.rsto accept an optionalruntimefield.
-
-
Implement Deno Runtime:
-
Create
functions/src/deno_runtime.rs. -
Implement
DenoRuntimestruct usingdeno_core::JsRuntime. -
Implement
executemethod that initializes the runtime, executes the provided code, and captures output.
-
-
Update Handlers:
-
Modify
deploy_functioninfunctions/src/handlers.rsto handle theruntimefield. -
Modify
invoke_functioninfunctions/src/handlers.rsto switch betweenWasmRuntimeandDenoRuntimebased on the function'sruntimecolumn.
-
-
Integration Testing:
- Update
tests/integration/functions.test.tsto include a test case for deploying and invoking a JavaScript/TypeScript function.
- Update
-
Verification:
-
Run
cargo buildto ensure dependencies compile. -
Run
npm test functions.test.tsto verify functionality.
-