At first glance, serving deno libraries appear simple: Just put the whole thing on GitHub or GitHub Pages. But when other factors come around (such as semantic versioning, fallback for browser compatibility, caching, CDN, etc.), things appear to be much more complicated.
I wish deno provides a cli command (such as deno serve) and an API (such as Deno.serveCode()) that does all those things in a standard and painless fashion.
The server should have the following features:
immutable for specific version.So basically something like https://github.com/denoland/deno_website2 but written in Deno?
I agree this would great to have. I don't know about all of these features (GraphQL sounds like a bit much) but certainly we should have a program in std that can serve up a directory of code that deno can link to.
I'd file this one under long term goals.
I wouldn't imagine Deno should have a built-in production-ready server (e.g. with HTTP2 push). But it should absolutely have something like go docs which serves cached dependencies. Super useful for devving on a train with a spotty connection.
That said, I'd love the Deno module server (which currently runs https://deno.land/x) to be written in Deno and have more awesome features.
EDIT: random note, where did the idea of transpiling Wasm to asm.js come from? :thinking:
@ry
I don't know about all of these features
I listed all these features because I think Deno was to be a swiss army knife for JavaScript developers (since it has so many features already).
Another reason is that it is better that Deno sets up a standard (with clear specs) about how Deno libraries should be served for everything else.
GraphQL sounds like a bit much
It may be a bit more complex than simple REST API, but I think it fits a module registry. For example: I sometimes want to list all contributors from all direct/indirect dependencies, doing so with npm registry would require me to send request back and forth, wasting precious time and bandwidth, a query language like GraphQL would allow me to do so in one request.
Of course, we cannot implement all these features immediately in day 1, so a clear roadmap and specs is necessary.
@crabmusket
random note, where did the idea of transpiling Wasm to asm.js come from?
It came from my desire to rewrite the Internet in Rust /jk
But actually, I think it would be nice if library server can provide compatible fallbacks for older browsers, that of course must include WASM too.
Still sounds a bit over ambitious to me even for std, sounds like a community things, where there are already quite a few static web servers built on Deno. Having deno_website2 as a serverless process based on Deno using Deno code of course would be nice. But that sounds like deno_website3 to me.
Outside of scope for Deno CLI. I agree with @kitsonk that it seems better suited to be a community project.
Most helpful comment
Still sounds a bit over ambitious to me even for
std, sounds like a community things, where there are already quite a few static web servers built on Deno. Havingdeno_website2as a serverless process based on Deno using Deno code of course would be nice. But that sounds likedeno_website3to me.