louis030195
louis0301953mo ago

how to use deno.json when using deno runtime in rust?

my code: https://github.com/mediar-ai/screenpipe/blob/main/screenpipe-core/src/pipes.rs i want to stop rewriting node api stuff and just import like in https://github.com/mediar-ai/screenpipe/pull/462/files eg
{
"imports": {
"zod": "npm:zod",
"ai": "npm:ai",
"ollama-ai-provider": "npm:ollama-ai-provider"
// also node api like fs, fetch, etc.
},
"tasks": {
"start": "deno run --allow-read --allow-write --allow-net --allow-env pipe.ts"
}
}
{
"imports": {
"zod": "npm:zod",
"ai": "npm:ai",
"ollama-ai-provider": "npm:ollama-ai-provider"
// also node api like fs, fetch, etc.
},
"tasks": {
"start": "deno run --allow-read --allow-write --allow-net --allow-env pipe.ts"
}
}
i'm assuming it's possible, any direction to do this appreciated
2 Replies
louis030195
louis030195OP3mo ago
alternatively if oyu have any docs on how to create deno extensions in rust https://github.com/denoland/deno/blob/main/ext/console/lib.rs i want to create an extension to control computer mouse and keyboard so it might not compile to wasm update: would just like to know what the best way to write rust extensions and use with deno cli so my js code has access to it
bartlomieju
bartlomieju3mo ago
Not entirely possible, the CLI code is not distrubuted as a library, so you'd effectively have to for the CLI crate and wire up all the pieces together yourself. Which is no small feat

Did you find this page helpful?