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

fix: add buffer #362

Merged
merged 3 commits into from
Apr 3, 2020
Merged

fix: add buffer #362

merged 3 commits into from
Apr 3, 2020

Conversation

hugomrdias
Copy link
Contributor

@hugomrdias hugomrdias commented Mar 27, 2020

This PR add buffer as a dependency.

Related to Level/level-js#191

@vweevers regarding process.nextTick should we copy immediate.js and immediate-browser.js from level-js and then remove and require in level-js from here ?

@vweevers
Copy link
Member

@vweevers regarding process.nextTick should we copy immediate.js and immediate-browser.js from level-js and then remove and require in level-js from here ?

I prefer not to change the timing behavior in node, because if folks are using process.nextTick in their app or module but this switches to setImmediate that changes the order of execution. Another but lesser concern is that we'll have to update tests that rely on the order.

@vweevers
Copy link
Member

Hm, could it be considered a semver-major change in browsers as well?

@hugomrdias
Copy link
Contributor Author

for reference from streams repo nodejs/readable-stream#414

recap:

and no i dont think it would be a breaking change in browsers nextTick injected by bundlers is mostly what immediate does.

@hugomrdias
Copy link
Contributor Author

for reference browserify and webpack use this https://github.com/defunctzombie/node-process/blob/master/browser.js#L134

@hugomrdias
Copy link
Contributor Author

can i go forward and update this PR with this ?

recap:

keep node with process.nextTick
browser with https://github.com/calvinmetcalf/immediate#readme (same as level-js)

@vweevers
Copy link
Member

vweevers commented Mar 27, 2020

They (immediate and the process polyfill) seem similar enough, yeah. Both have microtask behavior and a synchronously draining queue. They might even have borrowed code from each other :)

@vweevers
Copy link
Member

Possible issue: immediate doesn't work in web workers. See calvinmetcalf/immediate#27 and pouchdb/pouchdb#7973. Apparently this is already a problem for level-js and memdown today, so this is not a blocker, but I did want to make note of it.

Copy link
Member

@vweevers vweevers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Will merge end of week. Could do it now but because browser tests are skipped on PRs from outside contributors, I need to reserve some time to test this, level-js and memdown.

@hugomrdias
Copy link
Contributor Author

try my runner to test in the browser https://github.com/hugomrdias/playwright-test i have had serious problems with airtap not bundling correctly and the DX is much nicer. playrwright-test test/self.js --runner tape

@vweevers
Copy link
Member

vweevers commented Mar 30, 2020

I've been working on adding playwright to airtap actually 😄 (and any other browser for that matter).

What does DX mean?

@hugomrdias
Copy link
Contributor Author

I've been working on adding playwright to airtap actually 😄 (and any other browser for that matter).

cool, any feedback would be awesome or if you need any help please ping me.

@vweevers vweevers merged commit 60ec6cd into Level:master Apr 3, 2020
@vweevers
Copy link
Member

vweevers commented Apr 3, 2020

6.2.3

@Raynos
Copy link
Member

Raynos commented Apr 26, 2020

This increased the dependency count for leveldown :(

@vweevers
Copy link
Member

Yeah, it's hard to satisfy everyone's needs. Ideas?

@Raynos
Copy link
Member

Raynos commented Apr 26, 2020

I've got an idea for leveldown that I am making a PR for. It will not impact abstract-leveldown ;

@Raynos
Copy link
Member

Raynos commented Apr 26, 2020

Ok opened Level/leveldown#714

@hugomrdias
Copy link
Contributor Author

I've been working on adding playwright to airtap actually 😄 (and any other browser for that matter).

What does DX mean?

Developer Experience

@hugomrdias
Copy link
Contributor Author

Possible issue: immediate doesn't work in web workers. See calvinmetcalf/immediate#27 and pouchdb/pouchdb#7973. Apparently this is already a problem for level-js and memdown today, so this is not a blocker, but I did want to make note of it.

this seems to be related only to the use of global inside immediate

@vweevers
Copy link
Member

@hugomrdias Would you mind opening an issue in airtap to describe your experience? Unless it's about webpack, then the answer is simply "yeah, we're browserify die-hards, and you should be using another tool".

@hugomrdias
Copy link
Contributor Author

@hugomrdias Would you mind opening an issue in airtap to describe your experience? Unless it's about webpack, then the answer is simply "yeah, we're browserify die-hards, and you should be using another tool".

sure, and it’s not about webpack actually i don't care about webpack (i want to add support for more bundlers in the same way it already support multiple test runners) its about giving the developer the same experience that they have in node (everything is properly redirected to the terminal) and if they really need to run in debug mode (browser window opened) they always have a clean env, devtools opened already focused in the console (playwright needs to land support for this already talked with them and they support it). Also it supports extensions env, webworkers etc

@hugomrdias
Copy link
Contributor Author

@vweevers should we change to https://github.com/YuzuJS/setImmediate to fix the global issue in webworkers ?

@vweevers
Copy link
Member

Thanks for the airtap feedback! Agree on all points, and there's an effort underway to do all that except for extensions and webworkers (although that would be easier to implement in the next version).

@vweevers should we change to https://github.com/YuzuJS/setImmediate to fix the global issue in webworkers ?

That's a macrotask library, while immediate is a microtask library (although they use some of the same tricks, so uuuhm). I prefer the latter, to stay as close as possible to process.nextTick() behavior.

@Raynos
Copy link
Member

Raynos commented Apr 27, 2020

This increased the dependency count for leveldown :(

Opened two PRs to reduce dependencies

@vweevers
Copy link
Member

@Raynos A heads up: I'm swamped atm

@Raynos
Copy link
Member

Raynos commented Apr 27, 2020

No worries :)

@hugomrdias
Copy link
Contributor Author

@vweevers
Copy link
Member

@hugomrdias re: immediate and web workers, I suggest that whoever needs that sends a PR to immediate. Ideally we all rally behind a single module, to avoid ending up with multiple modules in node_modules that all more or less do the same thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants