ioB
ioB
DDeno
Created by ioB on 3/15/2023 in #help
Specifying config remotely or jsx on install
I'm struggling quite a lot here. I originally recommended using this command:
deno install -Afr --config https://deno.land/x/pyro/deno.jsonc -n pyro https://deno.land/x/pyro/cli.ts
deno install -Afr --config https://deno.land/x/pyro/deno.jsonc -n pyro https://deno.land/x/pyro/cli.ts
but it turns out deno doesn't support loading a remote config? That seems strange to me but sure. To work around this, I'm trying to do:
deno install -Afr --importmap https://deno.land/x/pyro/import_map.json --jsx=react-jsx -n pyro https://deno.land/x/pyro/cli.ts
deno install -Afr --importmap https://deno.land/x/pyro/import_map.json --jsx=react-jsx -n pyro https://deno.land/x/pyro/cli.ts
but it gives the following error:
error: Found argument '--jsx' which wasn't expected, or isn't valid in this context
error: Found argument '--jsx' which wasn't expected, or isn't valid in this context
I know that philosophically, Deno in the past claimed that you could always pass in command line flags instead of a config file. Any ideas on what to do here?
3 replies
DDeno
Created by ioB on 3/4/2023 in #help
solid-js with Deno
I was wondering if it was possible to use solid-js with Deno natively without something like esbuild. This is possible with react (with no config):
import * as React from "https://esm.sh/react@18.2.0"

function MyComponent(props: {name: string}) {
return <div>Hello {props.name}</div>;
}

console.log(<MyComponent name={"Dev"} />)
import * as React from "https://esm.sh/react@18.2.0"

function MyComponent(props: {name: string}) {
return <div>Hello {props.name}</div>;
}

console.log(<MyComponent name={"Dev"} />)
Currently my deno.json looks likes:
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "solid-js/h"
},
"imports": {
"solid-js/": "https://esm.sh/solid-js@1.6.11/"
}
}
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "solid-js/h"
},
"imports": {
"solid-js/": "https://esm.sh/solid-js@1.6.11/"
}
}
and my code looks like
function MyComponent(props: {name: string}) {
return <div>Hello {props.name}</div>;
}

console.log(<MyComponent name={"Dev"} />)
function MyComponent(props: {name: string}) {
return <div>Hello {props.name}</div>;
}

console.log(<MyComponent name={"Dev"} />)
but when I run it I get
$ deno run -A test.tsx
error: Uncaught SyntaxError: The requested module '/v110/solid-js@1.6.11/deno/web.js' does not provide an export named 'assign'
at <anonymous> (https://esm.sh/v110/solid-js@1.6.11/deno/h.js:2:20)
$ deno run -A test.tsx
error: Uncaught SyntaxError: The requested module '/v110/solid-js@1.6.11/deno/web.js' does not provide an export named 'assign'
at <anonymous> (https://esm.sh/v110/solid-js@1.6.11/deno/h.js:2:20)
15 replies
DDeno
Created by ioB on 3/3/2023 in #help
Running esbuild with esbuild_deno_loader
I've spent probably four or five hours trying to track down this issue, to the point where I actually started tweaking and rebuilding old versions of esbuild to try and reproduce this bug without the help of a plugin. I have no idea. I want to find what version this started happening in to file a bug report (because I think it's an esbuild issue), but I haven't had the time to do that. Here is the reproc code (it only errors with wasm):
import * as esbuild from "https://deno.land/x/esbuild@v0.15.10/wasm.js";
import { denoPlugin } from "https://deno.land/x/esbuild_deno_loader@0.6.0/mod.ts";

const result = await esbuild.build({
plugins: [denoPlugin()],
entryPoints: {
"test": new URL("./link-to-any-deno-file.ts", import.meta.url).href
},
outdir: ".",
bundle: true,
write: false,
format: "esm",
});

esbuild.stop();
import * as esbuild from "https://deno.land/x/esbuild@v0.15.10/wasm.js";
import { denoPlugin } from "https://deno.land/x/esbuild_deno_loader@0.6.0/mod.ts";

const result = await esbuild.build({
plugins: [denoPlugin()],
entryPoints: {
"test": new URL("./link-to-any-deno-file.ts", import.meta.url).href
},
outdir: ".",
bundle: true,
write: false,
format: "esm",
});

esbuild.stop();
Running this results in:
error: Cannot read file "Users/iob/Desktop/test/link-to-any-deno-file.ts": not implemented on js
error: Cannot read file "Users/iob/Desktop/test/link-to-any-deno-file.ts": not implemented on js
This is blocking any upgrade of the esbuild dependency for fresh.
11 replies
DDeno
Created by ioB on 1/16/2023 in #help
Updating digest with web crypto
For some context, I'm updating some code that was importing from std/hash (specifically std/hash/sha256) to use std/crypto since the hash submodule is long gone. I've run up against a case where I'm not really sure what I should do to move forward. The code looks something like this:
const digest = new Sha256()

for await (const chunk of generate.chunks()) {
digest.update(chunk)
}

if(some_condition) {
digest.update(bonus_chunk)
}

return digest.hex()
const digest = new Sha256()

for await (const chunk of generate.chunks()) {
digest.update(chunk)
}

if(some_condition) {
digest.update(bonus_chunk)
}

return digest.hex()
Is this possible to handle in the web crypto standard? I'm pretty sure I should just be able to aggregate the chunks into one massive uint8array or something but I feel like there is no reason to buffer the whole thing into memory. Any ideas?
30 replies