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

Request: Deno port #30

Open
halvardssm opened this issue May 31, 2020 · 1 comment
Open

Request: Deno port #30

halvardssm opened this issue May 31, 2020 · 1 comment

Comments

@halvardssm
Copy link

Hi! I am very interested in porting this library to Deno (new runtime for JS/TS). Would you mind if I make a PR where I add a folder with Deno compliant code?

The code itself (as far as I can see) is not depending on any other packages or Node (except for util.inspect) so porting it should be a relatively simple task. The steps would be as follows:

  1. Add rollup (or any other bundler which transforms code to ESM syntax from CommonJs) as a dev dependency.
  2. Add to the scripts the command which transforms the code to ESM in a deno folder.
  3. Change line 5 and 3 so that they work with Deno.

After that, it should be possible using this module with Deno by simply importing it from e.g. https://raw.githubusercontent.com/iarna/iarna-toml/latest/toml.js

Let me know what you think! 😄

@iarna
Copy link
Owner

iarna commented Jun 2, 2020

That sounds fantastic! The util-inspect bits are used by the debugging parser which is only used when debugging changes to the parser code itself. (It prints traces of the parse.) It's not actually loaded when you go in through the standard entry points (eg toml.js or parse-string.js).

I would think that parse-stream.js might be a concern however? It uses Node streams. I'd be happy with initial Deno support that just skipped that and only provided parse-string support.

Longer term, a variation that's built around async iterables would be a nice compat path forward, although the lack of standard composition primitives for them makes that a little awkward. An alternative built on WHATWG streams might be better.

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

No branches or pull requests

2 participants