Deno

D

Deno

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

Join

Empty output in Deno.Command

I’m trying to run the command git log —grep='.' from Deno. However, it always returns an empty output. If I delete the grep option it returns it fine. Running the same command from the CLI returns all commits. It’s weird because other “similarly looking options” seem to work fine for example —format....

How to display data from a Handler on every page?

Hi, I am having the problem, that the PageProps are not accessible in the _app.tsx and I have not figured out how to access PageProps in a component (in the /components folder). If I give a component the PageProps parameter, Deno complains that I am not giving an argument in the calling file. Can someone help me with that? It is probably something that is done all the time in a project. In the end I just want to get something with a handler from a server and then display it in a component but as I stated, I do not know how to access that because I want to display it on every page using the app-wrapper....

How do people bundle their Deno code for web?

I am currently using Deno bundle command to bundle my code for web. Is there a better alternative for bundling + type-checking folks are using? I can't find anything that looks robust and Deno-ish and ended up with a big hacky script (below). I love esbuild but it doesn't support type-checking and esbuild_deno_loader is still maturing. ``` import * as esbuild from 'https://deno.land/x/esbuild@v0.17.11/mod.js' import { denoPlugin } from 'https://deno.land/x/esbuild_deno_loader@0.6.0/mod.ts'...

Preventing `Deno.stdin` reads from blocking

In a module for reading Deno.stdin input, there is a loop that reads and parses the returned bytes. My issue is that, in case of an uncaught error/rejection, the process hangs until stdin has something to return, and once it does, only then does it exit the process and log the error information. Is there a way to make this read() non-blocking in that sense? If the user does not input anything, but an error occurs, the process should exit immediately and not have to wait for a keypress. The code below can be run from a file for demonstration....

Can I pre-cache dependencies that I specify using npm:?

Hi! Trying to figure out the right way to combine Deno's module support to make our deploys consistent. In particular, I was using esm.sh URLs, but just hit some CDN errors so that made me switch to npm: in hopes of it being more reliable. But afaict deno vendor doesn't vendor npm dependencies? What's the right combination of things to do to deploy reliably?

JSON Schema Core, $dynamicAnchor, and $vocabulary

Slightly off-topic, but I'm writing a Deno library. Anyone deeply knowledgeable on JSON Schema Core? I have this meta-schema, and I can't figure out how the heck it's supposed to work that "$ref": "meta/core" would refer to "https://json-schema.org/draft/2020-12/vocab/core" – any ideas? I feel like I'm missing something fundamental knowledge on the JSON Schema Core spec here... ```json...

Test case is leaking resources

Hi, all my tests keeps failing because of ``json error: AssertionError: Test case is leaking 2 resources: - A timer (rid 770) was started before the test started, but was fired/cleared during the test. Do not close resources in a test that were not created during that test. - A timer (rid 773) was started during the test, but not fired/cleared during the test. Clear the timer by calling clearInterval or clearTimeout`....

[have workaround] "deno" and "deno repl" aren't producing output

I typed in "deno" and nothing happened, and I thought it was finally doing the right thing when no arguments are given to a scripting language command, which is to accept input on stdin, but it seems to just be a glitch. Any idea why it's hanging for me when I type deno or deno repl? It works when I do deno run hello.js and deno help. deno --verbose isn't a thing....

Serve Fresh over HTTPS locally

How can I serve Fresh over HTTPS locally? In node I might generate certs and do ``` https.createServer({ key: fs.readFileSync(path.join(__dirname, '..', 'certs/localhost.key'), 'utf8').toString(),...

How to re-open Deno.stdin?

I'm noticing that Deno gives an error when trying to window.prompt after I've consumed stdin. ```ts // prompt.ts // echo "test" | deno run prompt.ts...

cli/tsc crashes with Uncaught TypeError

Using latest Deno (1.32.4), this only happens on certain files, but it effectively means that I cannot do type checking with Deno now. The error (somewhat opaque since this looks like generated code): ``` error: Uncaught TypeError: Cannot read properties of undefined (reading 'kind') at <anonymous> (internal:deno_tsc/tsc/00_typescript.js:19111:18)...

Fresh: <Head> component is not supported

When running deno task start with this as my pages/index.tsx file (as in the demo) I'm seeing the following error. Any ideas what might be going on?
An error occurred during route handling or page rendering. Error: <Head> component is not supported in the browser, or during suspense renders.
at Object.Head (https://deno.land/x/fresh@1.1.5/src/runtime/head.ts:15:11)
An error occurred during route handling or page rendering. Error: <Head> component is not supported in the browser, or during suspense renders.
at Object.Head (https://deno.land/x/fresh@1.1.5/src/runtime/head.ts:15:11)
...

Is there a way to vendor npm specifier imports?

deno vendor npm:express Vendored 0 modules into scripts/vendor directory...

How can I import with npm: specifiers through a proxy?

My company blocks npmjs.com and they have setup an internal Artifactory instance. With nodejs I can just setup a .npmrc file with a _registry entry and npm will continue to work. Will deno repsect the .npmrc file or is there another way to configure the registry url?

Following deno_core code execution is slower

So I have the following code, which is taken from https://github.com/denoland/deno/tree/main/core/examples and edited for simple benchmarking: ```rust use std::time::Instant; use deno_core::v8;...

Import modules from all files in directory

Considering I have multiple ts files in a folder and all of them export the same type module. Can I import them like this? import * as things from "./things/";...

Parsing Apache mime.types into dictionary Record<string, string>

This code parses the official Apache mime.types from GitHub and creates a dictionary Record<string, string> of all lines that have not been commented out. Perhaps it may help someone learning and using Deno serve so I wanted to share. ```ts /** * Run command:...

deno.land/x/module not using latest tag

I created a repository, at deno.land/x/shellgpt, and pushed some tags. The latest version is v0.2.0. When I do deno install -A --name gpt https://deno.land/x/shellgpt/mod.ts ...

Provide own default error page in Fresh

Hello! I'm seeing the following error
pragma cannot be set when runtime is automatic at https://deno.land/x/fresh@1.0.1/src/server/default_error_page.tsx:1:1
pragma cannot be set when runtime is automatic at https://deno.land/x/fresh@1.0.1/src/server/default_error_page.tsx:1:1
Can I provide my own default error page instead of this one to sidestep this error? I tried making such a page at routes/default_error_page.tsx, but that didn't work...

Smoother DX using 3rd party modules written in TypeScript in the Browser

Say, for instance, I want to use the "async" standard library's Deferred implementation in some code that runs in the Browser. Currently I manually copy the TypeScript source to a vendor folder and have my build step do the transpilation, then have my import map point to the transpiled code. Is there a way to have Deno or a complimentary tool do the transpiling with less manual intervention and allow a developer to use the original URL for the TypeScript module in their import map? [Aside: wasn't quite sure whether to post this in #help or #ideas . Kinda straddles the line to me 🤷🏻‍♂️ ]...