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 support #139

Closed
ProvocaTeach opened this issue Sep 4, 2021 · 3 comments
Closed

Deno support #139

ProvocaTeach opened this issue Sep 4, 2021 · 3 comments
Labels

Comments

@ProvocaTeach
Copy link

ProvocaTeach commented Sep 4, 2021

Hello, I am opening an issue for supporting Deno via ES module importing out-of-the-box, per discussion in issue #138 at the suggestion of @jacoscaz.

Deno is a runtime for JavaScript created by Ryan Dahl (who also built Node). Benefits of Deno include:

  • Direct support for TypeScript
  • Security by default
  • Browser-like behavior whenever possible

Members of the Quadstore team may have a better idea than I do of how far-off this is. I don’t have a great sense of how much the most popular RDF/JS projects depend on Node. However, Skypack or a similar Deno-friendly CDN may be a good way to provide stopgap support.

Some helpful Deno links:

@jacoscaz
Copy link
Collaborator

Thanks to the recent addition of separate ESM vs. CJS builds, partial support for Deno is now available through Skypack in [email protected]:

import { DataFactory } from 'https://cdn.skypack.dev/[email protected]';
import { Quadstore } from 'https://cdn.skypack.dev/[email protected]';
import { MemoryLevel } from 'https://cdn.skypack.dev/[email protected]';

const backend = new MemoryLevel();
const dataFactory = new DataFactory();
const store = new Quadstore({ backend, dataFactory });

await store.open();
await store.put(dataFactory.quad(
  dataFactory.namedNode('ex://s'),
  dataFactory.namedNode('ex://p'),
  dataFactory.namedNode('ex://o'),
));
const { items } = await store.get({});
console.log(items);
await store.close();

Further work is needed to add support for Deno in quadstore-comunica, thus enabling SPARQL queries in Deno, and likely depends on fixing this upstream issue: RubenVerborgh/SPARQL.js#139 .

@jacoscaz
Copy link
Collaborator

Found a temporary workaround by using import maps to replace Skypack's version of [email protected] with https://gist.github.com/jacoscaz/022c513ca77b0061c5bfee0356ba3b8d , which contains a small fix for the unchecked usage of require.

@jacoscaz
Copy link
Collaborator

Closing - will be a part of the upcoming 11.0.0 release!

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

No branches or pull requests

2 participants