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

Deno compatibility #44

Closed
jgierer12 opened this issue Jan 5, 2019 · 4 comments
Closed

Deno compatibility #44

jgierer12 opened this issue Jan 5, 2019 · 4 comments

Comments

@jgierer12
Copy link

jgierer12 commented Jan 5, 2019

Hi,

I came across JSPM while playing around with deno (a JS/TS runtime aiming for browser compatibility and high explicitness). First of all, great work on the project, this is almost exactly what I was looking for!

Unfortunately, there are some issues which make JSPM in its current state incompatible with deno's very strict import URL requirements, namely:

  • root-relative URLs, which deno cannot resolve due to its caching system
  • extensionless URLs, which deno deliberately doesn't support

Let's look at https://dev.jspm.io/react and see what should change in order to be compatible with deno:

  • -import { dew } from "/npm:react@16.7.0/index.dew.js";
    +import { dew } from "https://dev.jspm.io/npm:react@16.7.0/index.dew.js"
     export default dew();

    Here, we simply need to replace the root-relative URL with the absolute one.

  • -import "/npm:prop-types@15/checkPropTypes?dew";
    +import "https://dev.jspm.io/npm:prop-types@15/checkPropTypes.dew.js";

    In addition to absolute URL, we have to add the explicit file extension.

  • -import "/npm:object-assign@4?dew";
    +import "https://dev.jspm.io//npm:object-assign@4<???>.js";

    This is where it gets tricky. As far as I can tell (please correct me if I'm wrong), there is currently no way to get the contents of https://dev.jspm.io/npm:object-assign@4?dew with a file extension as required by deno.
    https://dev.jspm.io/npm:object-assign@4/index.js comes close, but exports the wrapped module instead of raw dew export. Perhaps it's possible to alias /npm:object-assign@4?dew to e.g. /npm:object-assign@4.dew.js and use that?

It would be amazing for JSPM to be compatible with deno, since the lack of compatible modules is currently one of my major pain points with it. I also think that the added explicitness is a benefit on its own, regardless of the deno compatibility.

@guybedford
Copy link
Member

guybedford commented Mar 5, 2019

There would be nothing blocking this if denoland/deno#203 is fixed :)

@fusionstrings
Copy link

Is it still valid @jgierer12 @guybedford ? denoland/deno#203 is closed.

@guybedford
Copy link
Member

Deno support could be added already simply using something like the browser-based Node.js shims, certainly.

Then better handling for the Node.js core packages could be added over time along the lines of https://github.com/denolib/node.

@guybedford
Copy link
Member

Let's move tracking of Deno support to #50.

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

3 participants