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

Support Deno. How to get about implementing platform-deno? #1806

Open
pixeleet opened this issue Oct 29, 2023 · 10 comments
Open

Support Deno. How to get about implementing platform-deno? #1806

pixeleet opened this issue Oct 29, 2023 · 10 comments
Labels

Comments

@pixeleet
Copy link

I would be keen on getting platform-deno up and running as node compat is not 100% in Deno.
This would make Effect natively available in Deno.

@tim-smart @gcanti @fubhy @mikearnaldi
Any plans on supporting Deno so far?
What hurdles do we seen in implementing a platorm-deno?

@fubhy
Copy link
Member

fubhy commented Oct 29, 2023

The main hurdle I can see so far is that vitest doesn't play well with Deno afaik.

@pixeleet
Copy link
Author

I'm not sure I understand how and why vitest is relevant, Deno has it's own built-in test runner.
Do we need to run the Node test suite against the Deno platform?

@fubhy
Copy link
Member

fubhy commented Oct 29, 2023

As you mentioned, Deno is not 100% compat with Node. Hence, to prove that effect and @effect/platform works with Deno (and fix any possible instances where it doesn't) you'd have to run the whole test suite with Deno (because our existing test suite is based on vitest). Yes.

I've also recently opened a PR to add a test matrix that includes jsdom, edge and a Bun test run.

Note that we also had to introduce compat code to make the effect runtime work with Bun. I'd expect similar for Deno.

@tim-smart
Copy link
Member

Deno is on my list of things to do :)

The current plan:

  • Learn more about deno, package distribution strategies (will likely stick with npm to start with, to keep it simple)
  • See if deno can be added to the test suites for "effect", "@effect/platform" & the eventual "@effect/platform-deno"
  • Implement deno specific apis in a "@effect/platform-deno" package

For the first item, feedback is more than welcome from devs who have maintained cross-platform packages.

@fubhy
Copy link
Member

fubhy commented Oct 29, 2023

A quick google search revealed another package struggling with vitest on deno and attempting a polyfill approach: https://github.com/fabian-hiller/valibot/pull/179/files

Might be worth a shot. Although we might have to adjust some of our test utils in effect especially.

@pixeleet
Copy link
Author

pixeleet commented Oct 29, 2023

  • Learn more about deno, package distribution strategies (will likely stick with npm to start with, to keep it simple)

in denoland packages are ditributed simply by tagging them on git with a version and having a webhook set up to the deno registry. https://docs.deno.com/runtime/manual/advanced/publishing/#publishing-on-denoland

  • See if deno can be added to the test suites for "effect", "@effect/platform" & the eventual "@effect/platform-deno"

This is tricky, we can import @effect/platform from npm without a problem or use https://esm.sh for it, but I don't see how we would add / integrate it to the existing test suite. Deno has it's own test runner and behaves differently than say NodeJS built-in test runner or vitest.

  • Implement deno specific apis in a "@effect/platform-deno" package

Is @effect/platform entirely independent from nodejs? Can it be freely importad in Deno?

@fubhy What is this bun compat layer you mentioned?

@tim-smart
Copy link
Member

With some trial and error, the test suite for "effect" is working with deno in this PR: #1579

Will need to add the import map generation to our gen script.

@pixeleet
Copy link
Author

@tim-smart just did a quick glance on the PR, looks yummy, so essentially allowing importing TS extensions, it "just works"?

@pixeleet
Copy link
Author

pixeleet commented Nov 7, 2023

I think the testing story is covered now that deno 1.38 supports re-using packages installed by pnpm and vitest seems to work out of the box this way.

@tim-smart just merged #1579

@lishaduck
Copy link

lishaduck commented Jul 9, 2024

FYI: The linked denoland/deno#18546 has been closed as resolved as of denoland/deno#24334, and will likely land in the upcoming Deno 2 landed in Deno 1.45.
It still doesn't support Vitest fully though: denoland/deno#23882.

I can't wait to get to help with platform-deno!

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

No branches or pull requests

4 participants