Deno

D

Deno

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

Join

Is inspecting import.meta.url a reliable way to distinguish browser and deno contexts?

I have been trying to figure out a good pattern to import JSON that will work whether called in deno or the browser. This is what I was thinking: ```js let data ...

npm package, need to use deno websocket if running in deno

Anyone has any idea how to use native deno websocket with my npm package? Detecting deno is not a problem. (normal websocket from npm is broken in deno.)...

Fetching Twitter data with coroutines and puppeteer

are there any recent examples of how to fetch Twitter data (like monitoring activity for a keyword everyday) without using Twitter paid API and without getting blocked ? In Deno of course.

Custom JSX transform from local module

Is it possible to define a JSX transform within the same codebase? All of the examples show referencing it from a remote module like https:/esm.sh/preact I've tried this, but it is unable to load my local jsx-runtime module because it doesn't recognize it as bing JS or TS. https://github.com/cowboyd/deno-jsx...

Pathname prefix in serve()

Hi, I was wondering if it's possible to only handle requests coming from specific prefix within pathname like: localhost:8000/api I'm using std serve....

embed typescript playground to web page

some programming language guides like the rust book lets you directly edit and run code in their docs, would it be possible for deno to do this in client-side? i'm planning to create a blog in deno and being able to run code snippets inside posts would be helpful. https://doc.rust-lang.org/book/ch01-02-hello-world.html...

Using deno-lambda for AWS SAM

I'm having issues trying to run deno-lambda (https://github.com/hayd/deno-lambda) locally. (I haven't tried running it on AWS for real yet.)
Init failed error=fork/exec /var/task/bootstrap: no such file or directory InvokeID=
My main module filename is main.ts and it exports a handler function which I think should work. Here is how I build and run everything:...

How to monetize an app?

I would like to monetize my apps in a certain way. Mabye limit some features. How to approach monetization?

importing scoped NPM packages from other registries

In node, I can create an .npmrc that has rules like this: ``` @custom:registry=https://npm.example.com/ //npm.example.com/:_authToken=DEADBEEF...

weird error with npm import

why is this a problem? I have an npm dependency in a remote deno module that I am importing. I would make a small reproducible example, but cannot really if I do not know what is causing it...

Embedding, snapshotting, and 7-bit ascii requirement

What are the differences in how a code module is processed when using load_side_module() versus when building an extension and using .esm() and include_js_files!()? I have an embed scenario working as expected with a JavaScript module, but less efficiently than I'd like (I suppose). I'd like to make it more efficient using snapshotting, but I'm hitting roadblocks that I don't understand. (Details follow...)...

Standard setup of a monorepo that includes frontend and backend TypeScript code for one app

Hello friends, I'm new to Deno and have what I feel is a relatively simple use case, but I've struggled to find good guidance about it. My repo is here: https://github.com/timschwab/chesswar. Nothing too fancy, messing about with WebSockets and <canvas>. I used to have two repos - one for the backend server and one for the frontend server. But I decided to just join them into one repo, so I could trivially share some code and types between the server code and the client code. However this means that the VSCode workspace includes both Deno server code and frontend TypeScript, and so I don't know the right way to set target and lib....

How can I import https://github.com/ensdomains/ensjs-v3/tree/main in my deno

This is npm package. I want to use it in my deno project. How can I achive it? I am trying this: import { ENS } from "https://raw.githubusercontent.com/ensdomains/ensjs-v3/main/packages/ensjs/src/index.ts"; However, I am having error: error: Relative import path "@ethersproject/contracts" not prefixed with / or ./ or ../ at https://raw.githubusercontent.com/ensdomains/ensjs-v3/main/packages/ensjs/src/index.ts:4:8...

Testing that advanced types work

I have a bunch of pretty advanced types, with generics and inferences all over the place. What would be a good way to test that these all work as expected? In other words, I want to make sure that MyCoolType<"foo bar baz"> is equal to the type ["foo", "bar", "baz"], as an example....

How can I reattach a debugger after disconnecting?

I want to be able to start deno from a command line, but be able to attach to it from VSCode. I actually have that much working, but there is one issue - if I disconnect the debugger, I cannot reattach it. I am running like so: deno run --inspect-wait .\first_steps.ts...

Pass string from TS to dll and return the passed string. (Like echo)

Hey I am currently trying to understand the communication between a dll and my TS program. Currently I am simply trying to pass a string to the dll and have the dll give me the string back. Similar to an echo. I have been trying to follow this guide for this: https://medium.com/deno-the-complete-reference/calling-c-functions-from-windows-dll-in-deno-part-2-buffers-131226acd3d2 only somehow I can't pass the buffer in my TS program. Can someone give me a simple example of how to pass a string from TS to dll and from dll to TS? ```ts const dll = Deno.dlopen('./test.dll', { 'echo': {...

deno-deploy limits on file storage?

When deploying static files via deployctl, what are the storage limits / costs per GB? Couldn't find any reference to it.

Reading a ReadabeStream without consuming it?

Hi, I'm trying to migrate an HTTP/HTTPS proxy protocol server from Node.js to Deno. The proxy listens for TCP connections, and I need to handle HTTP and HTTPS connections differently, so the first think I do is to read the first byte of every new connection to determine if it starts with "22" (which means that it is a TLS handshake). ...

Does anyone have a working OpenCL deno example?

How can I use opencl with deno? Any examples?

absolute imports in fresh?

how do you get this accomplished?