kriszyp / lmdb-js

Simple, efficient, ultra-fast, scalable data store wrapper for LMDB
Other
515 stars 44 forks source link

deno module doesn't exist #155

Open LAC-Tech opened 2 years ago

LAC-Tech commented 2 years ago

Using the url in the docs:

Deno 1.19.0
exit using ctrl+d or close()
> import * as lmdb from "https://deno.land/x/lmdb/mod.t"
Download https://deno.land/x/lmdb/mod.t
Warning Implicitly using latest version (test-build) for https://deno.land/x/lmdb/mod.t
Download https://deno.land/x/lmdb@test-build/mod.t
Uncaught TypeError: Module not found "https://deno.land/x/lmdb/mod.t".
    at async <anonymous>:2:14
kriszyp commented 2 years ago

Does it work if you explicitly use v2.2.6 (https://deno.land/x/lmdb@v2.2.6/mod.ts)?

(I didn't realize that non-semantic version tags are considered to be "latest" in Deno. And the next version is switching to using the NAPI interface for Deno, which probably will require Deno v1.22).

LAC-Tech commented 2 years ago

Kind of. Results after running deno upgrade

Deno 1.20.5
exit using ctrl+d or close()
> import * as lmdb from "https://deno.land/x/lmdb/mod.t"
Download https://deno.land/x/lmdb/mod.t
Warning Implicitly using latest version (v2.3.0) for https://deno.land/x/lmdb/mod.t
Download https://deno.land/x/lmdb@v2.3.0/mod.t
Uncaught TypeError: Module not found "https://deno.land/x/lmdb/mod.t".
    at async <anonymous>:2:14
> import * as lmdb from "https://deno.land/x/lmdb@v2.2.6/mod.ts"
Download https://deno.land/x/lmdb@v2.2.6/mod.ts
Download https://deno.land/x/lmdb@v2.2.6/deps.ts
Download https://deno.land/x/lmdb@v2.2.6/external.js
Download https://deno.land/x/lmdb@v2.2.6/level.js
Download https://deno.land/x/lmdb@v2.2.6/open.js
Download https://deno.land/x/lmdb@v2.2.6/write.js
Download https://deno.land/x/lmdb@v2.2.6/util/when.js
Download https://deno.land/x/lmdb@v2.2.6/caching.js
Download https://deno.land/x/lmdb@v2.2.6/keys.js
Download https://deno.land/x/lmdb@v2.2.6/read.js
Download https://deno.land/x/lmdb@v2.2.6/util/RangeIterable.js
Check https://deno.land/x/lmdb@v2.2.6/mod.ts
Uncaught TypeError: TS2551 [ERROR]: Property 'dlopen' does not exist on type 'typeof Deno'. 'Deno.dlopen' is an unstable API. Did you forget to run with the '--unstable' flag, or did you mean 'open'?
let lmdbLib = Deno.dlopen(libPath, {
                   ~~~~~~
    at https://deno.land/x/lmdb@v2.2.6/mod.ts:28:20

    'open' is declared here.
      export function open(
                      ~~~~
        at asset:///lib.deno.ns.d.ts:831:19
    at async <anonymous>:2:14
>
kriszyp commented 2 years ago

Yes, as the error states, you definitely have to run deno with the unstable flag to enable FFI. See https://github.com/DoctorEvidence/lmdb-js/tree/v2.2.6#deno for the all flags you will need to enable.

LAC-Tech commented 2 years ago

Thanks, that clarifies things.

kriszyp commented 2 years ago

In case you want to track the the upcoming changes, this is the PR for adding NAPI support to Deno, which lmdb-js will leverage in future versions to support the full set of lmdb capabilities: https://github.com/denoland/deno/pull/13633