Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Subtle bug or ... #493

Closed
d-adamkiewicz opened this issue Jul 5, 2018 · 9 comments
Closed

Subtle bug or ... #493

d-adamkiewicz opened this issue Jul 5, 2018 · 9 comments

Comments

@d-adamkiewicz
Copy link

See below. This was observed on several machines (Debian, Centos).

infor@debian2:~/es6test$ yarn install
yarn install v1.7.0
warning package.json: No license field
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 288.34s.
infor@debian2:~/es6test$ node -r esm test.mjs
OK
{ key: [ 'dadam', 2 ], value: { name: 'some2' } }
infor@debian2:~/es6test$ node -r esm test.mjs
/home/infor/es6test/node_modules/bytewise/index.js:1
Error: Cannot find module './util'
    at Object.<anonymous> (/home/infor/es6test/node_modules/bytewise/index.js:1)
    at Object.<anonymous> (/home/infor/es6test/node_modules/bytewise/index.js:1)

infor@debian2:~/es6test$ node --experimental-modules test.mjs
(node:1844) ExperimentalWarning: The ESM module loader is experimental.
OK
{ key: [ 'dadam', 2 ], value: { name: 'some2' } }

test.mjs:

import level from 'level';
import sublevel from 'level-sublevel/bytewise';

let db = sublevel(level('./db2', {valueEncoding: 'json'}));
let meta = db.sublevel('meta');
meta.put(["dadam", 2], {name: "some2"}, (err) => {
        if (err) {
                return console.log(err);
        }
        console.log("OK");
});
meta.createReadStream({gte:['dadam', null], lte:['dadam', undefined]}).on('data', (err, data) => {
        if (err) {
                return console.log(err);
        }
        console.log(data);
});

package.json:

{
  "dependencies": {
    "bcrypt": "^2.0.1",
    "esm": "^3.0.54",
    "hjson": "^3.1.1",
    "level": "^4.0.0",
    "level-sublevel": "^6.6.2",
    "multilevel": "^7.2.3",
    "nconf": "^0.10.0"
  },
  "scripts": {
    "test": "./node_modules/.bin/mocha -r esm --reporter spec"
  },
  "devDependencies": {
    "chai": "^4.1.2",
    "mocha": "^5.2.0"
  }
}
@dnalborczyk
Copy link
Contributor

dnalborczyk commented Jul 5, 2018

for what it's worth, also reproduces on macOS. seems to be caching related.

@d-adamkiewicz for the time being, 'til fixed, you could disable the esm cache:

ESM_OPTIONS={cache:false} node -r esm test.mjs

@jdalton
Copy link
Member

jdalton commented Jul 5, 2018

@dnalborczyk Could you publish your repro for this. I'll dig into this today.

@dnalborczyk
Copy link
Contributor

dnalborczyk commented Jul 5, 2018

comin' up ...

edit: https://github.com/dnalborczyk/esm-level-repro

I noticed a couple odd things happening, I'll write 'em up in a bit.

edit:
regarding the odds things happening:
I debugged it a little bit, maybe there's nothing wrong with it. I think the caching was just tripping ...

@jdalton
Copy link
Member

jdalton commented Jul 5, 2018

Thanks @dnalborczyk!

Your contributions have really helped me out.
Would you be interested in becoming a maintainer of esm?

@dnalborczyk
Copy link
Contributor

@jdalton Thank you for your trust! I definitely like to help driving esm forward!
I just don't know how much of any help I could be. It feels like you are light years ahead .... 😃

@jdalton
Copy link
Member

jdalton commented Jul 5, 2018

@dnalborczyk Awesome!

I could use help in test-coverage. Also, I think esm is complex enough where typings, like from TypeScript, would come in handy.

@jdalton jdalton added the bug label Jul 5, 2018
@jdalton jdalton closed this as completed in e8ddb12 Jul 5, 2018
@dnalborczyk
Copy link
Contributor

@jdalton sounds good! I have a couple ideas regarding your suggestions.

I'm currently out of the country visiting Germany. I'll be on and off during the next 2 weeks...

@dnalborczyk
Copy link
Contributor

forgot to mention, the above bug seems to be fixed in master ... 👌

@jdalton
Copy link
Member

jdalton commented Jul 6, 2018

v3.0.63 is released 🎉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants