Deno

D

Deno

Chat about Deno, a modern runtime for JavaScript and TypeScript.

Join

how to ssr preact (without fresh)

i tried with preact render to string but it wouldnt ship any js

Synchronous read single line from Deno.stdin

Hi, how would I go about reading a single line from Deno.stdin synchronously?

How can I enable type checks while running fresh

I want to relay on the code being type checked and yelling at me when I made a mistake, but deno task start in a fresh project doesn't seem to care by default. Is there some config I can change or at least some other script I can run in parallel to check the types? (I also observed that VSCode plugin seems to indicate more type related errors than my Jetbrains IDE, does somebody know why?)...

axios gives me a CORS error, fetch doesn't. Why is that?

NODE ```ts import axios from 'axios'; let res = await axios('https://example-29544e.webflow.io').catch((err) => { console.error(err);...

securing access for deno deploy?

We are creating a page using fresh, that is only for internal usage inside our company. We would of course love to use deno deploy for it, but is there a good way to limit the access to both the rendered frontend and the API, maybe even with something similar to cloudflare access? We are currently looking into a way to add a custom middleware, butaybe there are simpler solutions, or even alternative ways of hosting the page (without going through tons of infrastructure setup)?...

Learning how this works under the hood

Recommended resources to learn how this stuff works that can be understood by a dummy without a background in computer science? For a guy like me, becoming proficient at coding amounted to more or less like learning what goes with what and remembering how to get things to happen. I'm very limited by my lack of understanding how any of this (runtimes, bundlers, compilers, etc etc) works under the hood. I want to level up....

Closing a websocket server in a unit test

Hello, I'm an author of rpc lib and I'm currently writing unit tests for it. I am facing a problem of closing a server. How should I do it without deno hanging forever? my test case: ```js import { send, App } from './mod.ts'...

Error The deployment failed Module not found

Error The deployment failed: Module not found "npm:@coingecko/cryptoformat".
Link to module: https://www.npmjs.com/package/@coingecko/cryptoformat...

File name conventions

Some of my .ts files are meant to be run from the command line. Some of them when imported do things (like read .env files) Is there a file naming convention for such things?...

split error when using std toml

here's the error: ``` $ deno run -A toml.ts error: Uncaught (in promise) TypeError: subStr.split is not a function const lines = subStr.split("\n");...

How to cancel or abort .pipeTo()?

I prefer not asking, but after I found (what I consider) an MDN easter egg, I realized this is probably not something I'm going to solve without help from runtime-implementers. https://user-images.githubusercontent.com/17692058/200146738-da3e8747-6c7f-4ec7-adb8-fbb8c8947d33.png The example is straightforward, call stream1.pipeTo(stream2) then, with full access to both stream1 and stream2 try to shutdown/cancel/close/abort/sabotage/nuke stream1, stream2 or even just the pipe itself (copy-paste example below). The big issue is that, because of the pipeTo the deno process never ends. I've tried absolutely everything I can think of, including inheriting from WritableStream, prototype pollution hacks, accessing probably-shouldnt-be-accessed-directly-symbol keys, etc and I've not got a hint of success ```js...

is it possible to change how tsx bundles to js?

So I’m wondering if it’s possible to get Deno to convert
<div class="test">Potato</div>
<div class="test">Potato</div>
to ```js { tag: "div",...

can't load external modules when run as child process with Deno.spawnChild

Hi! This is really weird, but I'm trying to run deno scripts under another deno process with Deno.spawnChild(Deno.execPath(), {...}) Problem is the subprocess deno is unable to load any remote dependencies (mongo here just an example, even std modules fail to load): error: Uncaught (in promise) TypeError: error sending request for url (https://deno.land/x/mongo@v0.30.0/mod.ts): error trying to connect: dns error: A non-recoverable error occurred during a database lookup. (os error 11003)...

turn off js with fetch?

i'd like to fetch only the html version of a website, if there is one. any ideas on how to do so?

Fresh fetch data in component

Hi I need help with Preact, I would like to do a fetch in a component using Handlers and then use that data in the same component without the component having props that would interfere with the parent component.

Supabase-slash-PostgresSQL ConnectionRefused Connection refused (os error 111) on Deno Deploy

I'm having issues with supabase on a couple of deployments, but not others using similar code (connecting to different databases, but all on supabase). The error is the same on both: ConnectionRefused: Connection refused (os error 111). The code and connection works fine from GitHub actions and from local. Any idea what's up? Supabase status is ok. I've asked for help in https://discord.com/channels/684898665143206084/826085979344470037/1037982322378690611 as well....

package to turn html into plaintext?

i want to try turning html pages into plaintext in the terminal. any ideas?

File line operations

Hello, How to perform the following file manipulations in Deno ? - Read the nth line...

FFI how to pass (or get) 128-bit bigints to (or from) Rust functions?

I want to pass bigints from Deno and get i128 or u128 in Rust. Do I have to use typed arrays for that?

Unable to view logs to debug edge function for Deno Fresh + Deno Deploy

Thanks for making Deno, and Deploy, and Fresh. I'm a huge fan. I'm building a feature to allow user-written scripts to run at the edge. I'm persisting these scripts on my 1998.social domain. This is my edge function that proxies that data to import and execute them. Visiting this edge function will load this object for the func attribute: the proxy-able edge function as a module export. The page errors with "An error occurred during route handling or page rendering."...