Skip to content

Commit

Permalink
Deno try npm specifiers
Browse files Browse the repository at this point in the history
Npm specifiers don't work on deno deploy denoland/deploy_feedback#314
  • Loading branch information
rajsite committed Jun 6, 2023
1 parent 9496e90 commit b7165f9
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 22 deletions.
15 changes: 11 additions & 4 deletions Deno/Deno.gcomp/Support/src/runtime-helper.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import { XMLHttpRequest } from 'xhr/mod.ts';
import webviWebsockets from 'webvi-websockets/source/main.js';
import vireoHelpers from 'vireo/source/core/vireo.loader.wasm32-unknown-emscripten.release.js';
import wasmUrl from 'vireo-core-wasm-esm/release/index.js?bundle';
import webviWebsockets from 'npm:webvi-websockets';
import vireoHelpers from 'npm:vireo';

async function createInstance () {
const customGlobalWithBuiltins = Object.create(globalThis);
customGlobalWithBuiltins.NationalInstrumentsWebSockets = webviWebsockets(WebSocket);

const vireo = await vireoHelpers.createInstance({
wasmUrl
customModule: {
locateFile: function (path, prefix) {
return URL.createObjectURL(new Blob([
Deno.readFileSync(prefix + path)
], {
type: 'application/wasm'
}));
}
}
});

vireo.javaScriptInvoke.registerCustomGlobal(customGlobalWithBuiltins);
Expand Down
32 changes: 17 additions & 15 deletions Deno/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions Deno/import_map.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"imports": {
"std/": "https://deno.land/std@0.178.0/",
"vireo/": "https://unpkg.com/vireo@24.2.3/",
"vireo-core-wasm-esm/": "https://esm.sh/v112/@rajsite/vireo-core-wasm-esm@24.2.3-2/",
"webvi-websockets/": "https://esm.sh/v112/webvi-websockets@3.2.0/",
"vireo": "npm:vireo@24.2.3",
"webvi-websockets": "npm:webvi-websockets@3.2.0",
"xhr/": "https://deno.land/x/xhr@0.3.0/",
"deno_dom/": "https://deno.land/x/deno_dom@v0.1.36-alpha/"
}
Expand Down

0 comments on commit b7165f9

Please sign in to comment.