Deno

D

Deno

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

Join

Error connecting to mongoose when using deno cli

deno-x86_64-pc-windows-msvc v1.41.1 Testing the following code using nodejs and on deno deploy works correctly: ```js import express from 'express';...

How to debug deno on Visual Studio? (Not VSCode)

Is it possible to debug deno on Visual Studio? (not vscode) I only know how to debug it using windows cmd like ```js C:\Users>deno run --allow-read --allow-env --allow-os --allow-net C:\api\index.js...
No description

How to polyfill node imports when bundling with the deno version of esbuild?

Hello, I am trying to run esbuild using https://deno.land/x/esbuild to bundle a Deno project into a single file. I am using the denoPlugins from https://deno.land/x/esbuild_deno_loader to resolve npm imports, but I need all node std lib imports to be polyfilled as well (which the plugin doesn't do because it assumes youre running the bundle using Deno). My intended compile target is cloudflare workers so i need the node imports to be polyfilled. I tried using https://www.npmjs.com/package/esbuild-plugin-polyfill-node alongside the denoPlugins but I get the error Cannot find package '@jspm/core'....

forward stream response from openapi to frontend

forward stream openapi by using deno backend as a middleware, how to receive and send stream to frontend ? using sse

Should deno install work with jsr?

What am I doing wrong? When I try to install a CLI from jsr.io and then use it, I get an error message: Install (example):
```bash deno install --allow-read --allow-run -n dx -c ./deno.json jsr:@dx/dx...

Import-IntelliSense with Fresh and VSCode doesn't work as expected

Hey. I'm fairly new to Deno and Fresh so I assume I'm simply missing something. I've created a Fresh project through the official guide, installed and enabled the Deno extension in VSCode. However when trying to use the Auto-Import feature with Intellisense it often doesn't pick up new files or creates non-optimal statements. - It doesn't pick up new files in non-standard folders. E. g. I've created a lib/ folder besides components/, islands/ and so on. Is this allowed? - Import suggestions for packages like std contain the explicit version and don't respect the import map from deno.json. So I'll get an import statement like import { basename } from "https://deno.land/std@0.211.0/path/basename.ts"; instead of import { basename } from "$std/path/basename.ts"; or import { basename } from "@std/path/basename";...

How to rewrite this code so I don't have to force deno to stop linting?

```ts import { parse } from "https://deno.land/std@0.218.2/toml/mod.ts"; import { match } from "npm:ts-pattern@5.0.8"; // suppose options.config might be either string or undefined const readToml = match(options.config)...

Deno compile optimization

Hi Everyone, I'm building a CLI tool with Deno and I was wondering - if there are any optimizations I can make for the compiled file size, - how much of the build in terms of KB is the runtime...

Is there a way to select Partial Mode on button?

I researched and I do not think it is possible, but it would be nice to do something like:
<a f-partial="/my-link" f-mode="append">Append Mode</a>
<a f-partial="/my-link" f-mode="replace">Replace Mode</a>
<a f-partial="/my-link" f-mode="append">Append Mode</a>
<a f-partial="/my-link" f-mode="replace">Replace Mode</a>
...

How to Restart Server Manually

I run Hono framework with Deno. I run the server using task script deno run -A --watch ./server/main.js. But somehow, I want to watch changes in a directory which is out of reach and restart the server when a change occur in that directory. I guess I need --watch programmatically. I tried looking in the docs but found none. So, how can I watch and restart server manually?...

Is there any reference manual for how doc comments are rendered on JSR or deno.land/x?

I guessed it's just TSDoc, but it turns out that it's not exactly TSDoc (e.g., @link to an instance method apparently does not work).

How to start using data validation in kv?

Hey fellows! I want to dive into data validation. Any experience or suggestions? Feel free to post a commented version of the repository I provided here:...

deno cache isn't working from vscode

When initializing a new fresh project from the cli script deno run -A -r https://fresh.deno.dev and opening it in vscode no dependency can be cached and the deno extension output shows: Import map diagnostics: - Invalid top-level key "lint". Only "imports" and "scopes" can be present. - Invalid top-level key "compilerOptions" ......
No description

`.read()` method in `Deno.Conn` or `Deno.FsFile` in Deno 2.0

After Deno.Reader is removed in v2.0, will we still be able to use .read() method in Deno.Conn or Deno.FsFile?

Stuck trying to install a JSR package with its dependencies and use it in a browser

I published https://jsr.io/@datasette/table to JSR - an experimental web component package - and now I want to install and use it. I'm not at all fluent with the JavaScript ecosystem so I'm likely making some very basic mistakes Here are my notes on what I've tried so far - ideally I want to use esbuild for this: https://til.simonwillison.net/javascript/jsr-esbuild The error I'm seeing is this:...

List of available demo commands

Is there a programmatic way to get a list of all possible deno commands? Something like: ```ts const commands = ['run', 'test', ...]!...

Server isolates cause Socket.IO problems

Hi guys, I have a simple socket.IO program that basically broadcasts the changes in any one client's input field to every other client's input field. But I've seen that since Deno Deploy runs the different servers on the edge, different socket.IO servers are run for users from different locations. This means that eg. someone sitting in Asia and making a change won't affect the input of someone sitting in Europe....

Puppeteer: "BadResource: Bad resource ID" on Ubuntu

Hello, i just switched my server os over to ubuntu server 23.10. When executing my script, it immediately throws an error an exits. Before, on my windows machine, the script worked completely fine. Error: ``` error: Uncaught (in promise) BadResource: Bad resource ID...
No description

Unable to use Deno.createHttpClient without deprecated flag --unstable

I expected it to be behind the newer --unstable-net flag

Multiple JsRuntimes crashe if first is not dropped before a second is created and ran

In my application, I want an op2 to take in a function which will be stored in a struct as a Global<v8::Function>. Later this function will be called. This issue is the application crashes with Memory Access Violation. However, this only occurs on the second instance of the JsRuntime. Additionally this doesn't happen for the first few call, which leads me to believe it is something with the handle be garbage collected.