quokka icon indicating copy to clipboard operation
quokka copied to clipboard

Deno support

Open brandonkal opened this issue 5 years ago • 15 comments

Issue description

Deno is a secure JavaScript and TypeScript runtime https://deno.land/ created by Ryan Dahl (one of the original creators of Node) and other smart people. Deno expects a 1.0 release this month.

Many would love to see support for using Deno in Quokka. This is especially interesting for a scratchpad REPL such as Quokka because there is no node_modules mess, instead the code specifies exactly what it wishes to import.

Sample repository link

https://github.com/denoland/deno

brandonkal avatar Jan 09 '20 04:01 brandonkal

I'd love to see this soon. Some issues what I believe would be required to make this work:

  • Allow TS to be disabled (Deno handles this in runtime. Quokka runs the TS compiler itself and it seems it can only be disabled by using Babel (again no need here)
  • Allow replacing node with deno
  • Quokka can statically determine if a Typescript file is for Deno by looking at the imports. Plain TypeScript doesn't allow for importing something with a .ts extension.

brandonkal avatar Jan 10 '20 23:01 brandonkal

At the very least Quokka should support ignoring: error TS2691: An import path cannot end with a '.ts' extension.

If Quokka exposed a simple preprocess function (babel free). I could then write a function would:

  1. Remove ".ts" from imports
  2. Rewrite URL imports to use cache location for example:
import * as yaml from "https://deno.land/std/encoding/yaml.ts";

becomes

import * as yaml from "/home/<user>/.cache/deno/deps/https/deno.land/std/encoding/yaml.ts"

I really wish it was possible for me to fix this myself, but since I can't that is all that is required for basic support (where files would still run in Node).

brandonkal avatar Jan 15 '20 01:01 brandonkal

A proof-of-concept.

Screen Shot 2020-01-15 at 12 50 11 AM

Some notes:

  • Quokka ignores babel.config.mjs. Config had to be duplicated into config.json
  • Injecting a global via babel just doesn't work. Had to be factored out into a "quokka plugin".
  • Quokka refuses to resolve a plugin unless it is in node_modules
  • The implementation is limited because it is still running inside node. The Deno global shim returns bogus responses so not all Deno code will function.
  • The user has to run deno externally on the file if imported URL modules do not exist in the system cache. A tighter Quokka.js integration would be more seamless.

brandonkal avatar Jan 15 '20 09:01 brandonkal

I would LOVE to see this!!! I am writing a program in Deno right now and wish I could use Quokka.

David-Else avatar Jan 29 '20 15:01 David-Else

Also encountered error TS2691: An import path cannot end with a '.ts' extension, while using deno with qoukka

As my project is deno based, no typescript installed in project. I think the problem is quokka is trying to use ts-node to compile .ts files, which fails because deno uses import paths with .ts (ts-node was installed in ~/.quokka)

@ArtemGovorov deno has now officially release stable version v1. I hope you will consider adding support for this.

sajidali avatar May 29 '20 18:05 sajidali

@sajidali - Deno support is on our short-term list of technologies to investigate. We'll update this issue when we have more information to share.

smcenlly avatar May 29 '20 23:05 smcenlly

A quick update for this issue. We spent the last week investigating deno and there are a few things we need to be able to progress with adding support. We've raised an issue with the deno team to discuss our requirements. One of our core requirements is already known to the deno team, no public API for compilers. The other items we mention in the issue are relevant to Quokka being able to provide fast feedback on subsequent executions (i.e. as you type).

smcenlly avatar Jul 11 '20 00:07 smcenlly

Hi, @smcenlly do we have any update on this issue?

ultrox avatar Dec 31 '20 18:12 ultrox

No update from us on this issue. Unfortunately right now it's not technically possible for us to support Deno. We're still waiting for Deno to add a public API for compilers; this is a similar situation for other techs (e.g. such as babel, coffeescript support, etc.). We're watching their issue and will re-evaluate and respond to this issue when there is an update to share.

smcenlly avatar Jan 01 '21 22:01 smcenlly

@smcenlly thanks for clarifying. This issue is really hindering my personal deno adoption to tell you the truth, I bet that's the case with other wallaby/quokka users which is something that you might consider communicating to deno team.

ultrox avatar Jan 02 '21 18:01 ultrox

@smcenlly thanks for clarifying. This issue is really hindering my personal deno adoption to tell you the truth, I bet that's the case with other wallaby/quokka users which is something that you might consider communicating to deno team.

@ultrox - we completely understand, lack of good tooling in a technology can certainly affect adoption. You can +1 and watch https://github.com/denoland/deno/issues/1739 for updates. It's still marked as future milestone, which as I understand it (based on their milestones) will be after March 2021 at the earliest. We also have a couple of other requirements that we listed separately here: https://github.com/denoland/deno/issues/6694.

smcenlly avatar Jan 04 '21 22:01 smcenlly

Just wanted to +1 this as I, too, really yearn to see Quokka supported!

DaveyJake avatar Aug 20 '23 21:08 DaveyJake

Unfortunately, nothing has changed since our response above:

Unfortunately right now it's not technically possible for us to support Deno. We're still waiting for Deno to add a public API for compilers; this is a similar situation for other techs (e.g. such as babel, coffeescript support, etc.). We're watching their issue and will re-evaluate and respond to this issue when there is an update to share.

smcenlly avatar Aug 20 '23 21:08 smcenlly

Any updates on this? 😄

Moicky avatar Sep 24 '24 21:09 Moicky

Nothing has changed that would allow us to provide Deno support for Quokka. You may refer to the Deno issues mentioned above to see the latest status.

smcenlly avatar Sep 24 '24 21:09 smcenlly