Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any plan to be compatible with Deno? #9056

Closed
ghost opened this issue May 26, 2020 · 18 comments
Closed

Any plan to be compatible with Deno? #9056

ghost opened this issue May 26, 2020 · 18 comments
Labels
enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature
Milestone

Comments

@ghost
Copy link

ghost commented May 26, 2020

This is a feature request.
Do you have any plan to become typescript compatible with Deno?

Using pika.dev version of Mongoose will work?
pkg.fyi/npm:mongoose

Thanks!

@vkarpov15
Copy link
Collaborator

Haven't tried with either Deno or Pika. Will test it out and see if there's anything blocking us.

@vkarpov15 vkarpov15 added this to the 5.x Unprioritized milestone Jun 3, 2020
@vkarpov15 vkarpov15 added the enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature label Jun 3, 2020
@Green-Cat Green-Cat mentioned this issue Jun 5, 2020
@francois-pasquier
Copy link

Did anybody managed to use mongoose with deno?

I get a mongoose.connect is not a function

@vkarpov15
Copy link
Collaborator

Haven't tried it yet. Will try out Deno over the weekend and evaluate how much work it would be for us to support it.

@vkarpov15
Copy link
Collaborator

I took a look at Deno and unfortunately we're currently blocked. Here's what's happening:

  1. Do not use pika.dev's distribution of Mongoose. For some reason, they're pulling the browser version of Mongoose. So you won't be able to connect to MongoDB with Pika's version.

  2. Deno currently bugs out with the require_optional npm module, which is something that the MongoDB driver uses internally.

  3. Even without require_optional, Deno currently doesn't have a polyfill for Node's crypto module: https://deno.land/std/node/README.md . That's going to be hard for the MongoDB driver to work around.

Here's the Deno script I was working with:

import { createRequire } from "https://deno.land/std/node/module.ts";

const require = createRequire(import.meta.url);

const mongoose = require('mongoose');

console.log(mongoose.version);

Anybody know of a good workaround for using crypto in deno?

@vkarpov15 vkarpov15 modified the milestones: 5.10, 5.x Unprioritized Jul 3, 2020
@luckycreationsindia
Copy link

Anyone tried god crypto module?

https://github.com/invisal/god_crypto

Also MongoDB is available on deno platform:

https://deno.land/x/mongo@v0.12.1

@ebebbington
Copy link

@luckycreationsindia but deno_mongo is a deno plugin, thus very unstable

@hiral-kotadiya
Copy link

Anyone tried god crypto module?

https://github.com/invisal/god_crypto

Also MongoDB is available on deno platform:

https://deno.land/x/mongo@v0.12.1

Yes, MongoDB is available on deno platform, but there is very limited database features.

@vkarpov15 vkarpov15 modified the milestones: 5.x Unprioritized, 5.13 May 18, 2021
@vkarpov15 vkarpov15 modified the milestones: 5.13, 5.x Unprioritized Jun 21, 2021
@banocean
Copy link

I took a look at Deno and unfortunately we're currently blocked. Here's what's happening:

https://developer.mozilla.org/en-US/docs/Web/API/Crypto#browser_compatibility
image

@banocean
Copy link

Deno 1.15 also crypto api updates

@roj1512
Copy link

roj1512 commented Nov 1, 2021

Ehm we need Deno support.

@banocean
Copy link

banocean commented Nov 5, 2021

Ehm we need Deno support.

yes

@learner00000
Copy link

I wanna repeat the OP's question:

Any plan to be compatible with Deno?

@vkarpov15
Copy link
Collaborator

@learner00000 not currently.

@banocean
Copy link

banocean commented Mar 19, 2022

I wanna repeat the OP's question:

Any plan to be compatible with Deno?

Deno will be compatible with mongoose, before they do anything xD (deno compact mode)

@Uzlopak
Copy link
Collaborator

Uzlopak commented Apr 20, 2022

It seems, that deno can now load mongoose when using the --unstable flag.

import { createRequire } from "https://deno.land/std/node/module.ts";

const require = createRequire(import.meta.url);

const mongoose = require('mongoose');

console.log(mongoose.version);

with unstable flag

uzlopak@Battlestation:~/workspace/deno-mongoose$ deno --unstable run mongoose.js 
⚠️  ️Deno requests env access to "NODE_DEBUG". Run again with --allow-env to bypass this prompt.
   Allow? [y/n (y = yes allow, n = no deny)]  y
⚠️  ️Deno requests read access to "/home/uzlopak/workspace/deno-mongoose/package.json". Run again with --allow-read to bypass this prompt.
   Allow? [y/n (y = yes allow, n = no deny)]  y
⚠️  ️Deno requests read access to "/home/uzlopak/workspace/deno-mongoose/node_modules". Run again with --allow-read to bypass this prompt.
   Allow? [y/n (y = yes allow, n = no deny)]  y
⚠️  ️Deno requests read access to "/home/uzlopak/workspace/node_modules". Run again with --allow-read to bypass this prompt.
   Allow? [y/n (y = yes allow, n = no deny)]  y
⚠️  ️Deno requests read access to "/home/uzlopak/node_modules". Run again with --allow-read to bypass this prompt.
   Allow? [y/n (y = yes allow, n = no deny)]  y
⚠️  ️Deno requests read access to "/home/node_modules". Run again with --allow-read to bypass this prompt.
   Allow? [y/n (y = yes allow, n = no deny)]  y
⚠️  ️Deno requests read access to "/node_modules". Run again with --allow-read to bypass this prompt.
   Allow? [y/n (y = yes allow, n = no deny)]  y
⚠️  ️Deno requests env access to all. Run again with --allow-env to bypass this prompt.
   Allow? [y/n (y = yes allow, n = no deny)]  y
6.3.0

Without unstable-flag

uzlopak@Battlestation:~/workspace/deno-mongoose$ deno run mongoose.js 
Check file:///home/uzlopak/workspace/deno-mongoose/mongoose.js
error: TS2339 [ERROR]: Property 'ref' does not exist on type 'Listener'.
    this.#listener?.ref();
                    ~~~
    at https://deno.land/std@0.135.0/node/internal_binding/tcp_wrap.ts:240:21

TS2339 [ERROR]: Property 'unref' does not exist on type 'Listener'.
    this.#listener?.unref();
                    ~~~~~
    at https://deno.land/std@0.135.0/node/internal_binding/tcp_wrap.ts:243:21

TS2345 [ERROR]: Argument of type '{ type: "module"; deno: { namespace: boolean; }; argv?: unknown[] | undefined; env?: Record<string, unknown> | undefined; execArgv?: string[] | undefined; stdin?: boolean | undefined; stdout?: boolean | undefined; ... 5 more ...; workerData?: unknown; }' is not assignable to parameter of type 'WorkerOptions'.
  Object literal may only specify known properties, and 'deno' does not exist in type 'WorkerOptions'.
        deno: { namespace: true },
        ~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std@0.135.0/node/worker_threads.ts:60:9

Found 3 errors.

AbdelrahmanHafez added a commit that referenced this issue Aug 22, 2022
Use setPrototypeOf() instead of __proto__ to allow running on Deno
AbdelrahmanHafez added a commit that referenced this issue Aug 23, 2022


Revert "Use setPrototypeOf() instead of __proto__ to allow running on Deno"
AbdelrahmanHafez added a commit that referenced this issue Aug 23, 2022
use setPrototypeOf() instead of __proto__ to allow running on Deno
vkarpov15 added a commit that referenced this issue Sep 4, 2022
vkarpov15 added a commit that referenced this issue Sep 4, 2022
vkarpov15 added a commit that referenced this issue Sep 4, 2022
vkarpov15 added a commit that referenced this issue Sep 5, 2022
vkarpov15 added a commit that referenced this issue Sep 5, 2022
@vkarpov15 vkarpov15 modified the milestones: 6.x Unprioritized, 6.7 Sep 8, 2022
@vkarpov15 vkarpov15 modified the milestones: 6.7, 6.8 Oct 21, 2022
@roj1512
Copy link

roj1512 commented Nov 28, 2022

Note: There is still no Deno-first code.

@Uzlopak
Copy link
Collaborator

Uzlopak commented Nov 28, 2022

Note: will be part of the next minor release.

@roj1512
Copy link

roj1512 commented Nov 29, 2022

Oh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature
Projects
None yet
Development

No branches or pull requests

9 participants