Deno

D

Deno

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

Join

How do you get the path to a file relative to the module which is referencing it?

const GET_PROGRAM_QUERY = Deno.readFileSync("./GetProgram.gql");
const GET_PROGRAM_QUERY = Deno.readFileSync("./GetProgram.gql");
GetProgram.gql is a file in the same directory as the calling module. The above doesn't work. Any ideas?...

Investigating memory leak after adding new app dependency

Hi, I added an OpenTelemetry metrics reporting loop to a Deno program and found that Deno began leaking memory (300MB+, until it hits OOM and gets killed). This program was previously stable at 40MB RAM usage. To begin, I graphed Deno.memoryUsage() and it seems like the leaked memory is all external. How else can I investigate the issue? Anything else I can add to my typescript to observe this?...

VScode deno lint blew up again after update.

It seems every time there's an extension update VScode lint blows up and will stop recognizing top level awaits, and all kinds of other things. How can I fix the latest one?

Help debugging command that doesn't exit.

Is there a way to have Deno tell me what async tasks are still pending when a program ends? I'm using a third-party API, and AFAICT awaiting all the promises I can, but I still get to the end of my main() and deno doesn't exit. So I've got: ...

import cache not working

I can't install cache of my http imports:

Why isn't this error caught?

Basic code example: ``` try { Deno.remove("fakefile"); } catch (err) {...

client side JS

If I am using "lodash" on the client side, do I need to have a path for the browser to get it from NPM repository the way I wold if I wasn't using deno?

Using dynamic import with npm compatibility gives intermittent error "__DENO_NODE_GLOBAL_THIS_167935

This is pretty hard to google because the number at the end of the error changes everytime it happens, but basically: is this a known issue? I'll run some code (in a worker, using dynamic import pointing to npm: or a CDN and get ReferenceError: __DENO_NODE_GLOBAL_… on the first and sometimes second run, but after that it'll work.

Graphql codegen

does anyone have a solution to generate the sdk using graphq-request with Deno?

Deno Third Party Modules Web Hooks

Is there a way to see the webhook payload URL a package you have published is listening for?...

Does Deno package.json support use workspaces for module resolution?

Talking about this field: https://docs.npmjs.com/cli/v9/using-npm/workspaces If not could I somehow link to a local package in a project while it would resolve to the published version in deploy/publish context?...

Does Deno Deploy support location based analytics?

The free version does not seem to support it. Does the paid version support it?

Fresh: How to make Styles global with twindv1?

With the new twind-Plugin (v1), does anybody know how to do global styles? It was preflight before, but it does not seem to work like that anymore. I am trying for quite some time now to use injectGlobal and searching about both versions (through repos, documentations and forums) but I can not make it. Does anyone have an example or a suggestion do it in another way? 🥺 A solution would safe me hours of trial-and-error....

IPC solution for a process manager

👋 I'm at day 7 of working on Pup (https://github.com/hexagon/pup) - a universal process manager run by Deno. Next step towards 1.0.0 is to allow one instance of pup to restart a process of another instance. Something like pup - Boots up the process ecosystem defined in pup.json of the current directory...

Module imported in app successfully, but fails to deploy

etherscan.ts
import { ethers, BigNumber } from 'npm:ethers@^5'
import { ethers, BigNumber } from 'npm:ethers@^5'
util.ts...

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:...

Is it possible to know what version of a dynamically-imported module was just imported?

Right now, you can run code like import('npm:lodash'), which will get the latest version of lodash. Is it possible to know what version of lodash that resolved to, in the runtime or elsewhere? I suspect that it writes to an import map if there is one?

Why am I getting an "Uncaught DOM Exception" in the Deno CLI?

To replicate: 1. deno in the command line to initialize a Deno REPL ``` // Get an array of random bytes const arr = new Uint8Array(32)...

Better way to allow downloading of files besides serving entire file

I'm trying to allow users to download files that are in a private folder which cannot be accessed publicly. A special key is provided which allows them to download the file. Would I have to put the file into a public folder that can be accessed directly through a browser, or is there a way to use a router to serve files? I'm currently using a router to serve entire files to the client, but this creates a delay since some files can be gigabytes large and the site hangs while the file is being read + sent. I've attached a pic of how I serve files, any help would be appreciated! If I need to make a public folder called "download" instead, I can....

Share state between islands

Hi. How could I share state between island. E.g. shopping cart. I click on add product and in some other component I show the current status of the number of items in the cart. Thank you