knex
knex copied to clipboard
Deno Module
Feature discussion / request
I would like to use Knex on Deno (https://deno.land/).
@felipefdl Are there any solutions for CommonJS and npm dependency support available for Deno already?
@kibertoad Not sure, probably not. Maybe it's not time to implement yet, but will be great have knex on Deno.
@felipefdl Definitely. It's not clear what needs to be done for that, as obviously full fork of Knex.js over to Deno is not really feasible or sustainable. What changes in Knex codebase would make it more compatible with Deno without breaking Node.js support?
The major problem is on import dependencies since Deno doesn't use Commonjs and doesn't use package.json as well. If Knex was written typescript, maybe it can use an alias on imports, but it isn't the case, you can use a trick, creating a file with all dependencies used by the node, and another file with all dependency used by Deno, and import by the platform. I don't know if it is a good design, but it is a point to think about.
Also, the Deno has (in construction) module to add Node Compatibility. https://deno.land/std/node/
Maybe when it is done, we can run knex without problem.
Stopping by to lend my support for this request.
I want this too
I want this three
I want this four
@OlivierCavadenti What do you think about conversion of knex to TS for 3.0?
@OlivierCavadenti What do you think about conversion of knex to TS for 3.0?
Yeah sure its a good candidate, i can take a look of this issue after that
#5144 is a good entry point for that, actually
Friendly reminder that Deno has different "primitives" (i.e. crypto, network, buffers, etc) than Node.js so presumably the Node.js SQL drivers won't work with it. Especially those that build .node
C++ modules. Here's the Deno Postgres driver for reference: https://github.com/denodrivers/postgres
Why not use the Deno drivers then?
Ok, I want this now, what is going on here?
Nothing. Feel free to send PRs :D
Nothing. Feel free to send PRs :D
Sadness, I will try but do not promise...:D
I found a way to use the knex
without any changed, that is importing the module via an online CDN site like esm.sh, but the question is coming. All of the CDN sites is just giving the module used in the browser environment, this means a module should a cross-platform module always, or the dev needs polyfill the gap to reach the cross-platform
goal.
An example, trying to use the knex
via Skypack (yep, i tried...), an error throwed as below:
error: Uncaught (in promise) Error: [Package Error] "timers" does not exist. (Imported by "tarn").
Because of the tarn
is not a 'cross-platform'
module, the timers
cannot be found via the CDN. I just think to make every module is a cross-platform
or try to polyfill everything is not good idea. Or better?
Anyway, importing module from the CDN is great way and the problem will be solved if the CND can give the module bases different environment.
The Deno 1.25 added npm support, maybe it works, i didn’t try yet.
https://deno.com/blog/v1.25
The Deno 1.25 added npm support, maybe it works, i didn’t try yet.
https://deno.com/blog/v1.25
Thanks, it looks great. I am trying!
Hi, @felipefdl ,
For now, the deno
cannot support to use node package fully. Maybe --unstable
to stable is the day. Here is the detail.
Run with deno 1.26.1 but failed, has anyone tried it yet?