observablehq / framework

A static site generator for data apps, dashboards, reports, and more. Observable Framework combines JavaScript on the front-end for interactive graphics with any language on the back-end for data analysis.
https://observablehq.com/framework/
ISC License
2.56k stars 122 forks source link

Support Deno #1795

Closed felippecaso closed 1 week ago

felippecaso commented 2 weeks ago

Using Deno v2.0.4 (MacOS 15.1, zsh), when initializing a new project and including sample files, the Example dashboard is broken due to not loading launches.csv correctly:

Image

In the CLI, the error is

GET /_file/data/launches.csv?sha=<redacted>
load /data/launches.csv → [missing] error in 0ms: tempFd.createWriteStream is not a function
TypeError: tempFd.createWriteStream is not a function
    at file:///Users/usrname/foldername/node_modules/.deno/@observablehq+framework@1.12.0/node_modules/@observablehq/framework/dist/loader.js:383:34
    at eventLoopTick (ext:core/01_core.js:175:7)

Steps to reproduce

Fil commented 1 week ago

Confirmed. What's surprising is that when I log the tempFd symbol it is a FileHandle, and it should support createWriteStream: https://docs.deno.com/api/node/fs/promises/~/FileHandle.createWriteStream

Note that we don't officially support deno, so not really a bug :) But it would be nice to fix nonetheless.

Fil commented 1 week ago

minimal repro:

❯ cat test.js
import {open} from "node:fs/promises";
const a = await open("test.js", "r");
console.warn(a.createWriteStream);

with Node: [Function: createWriteStream]

with deno 2.0.6: undefined

this is a bug with deno, I'm afraid?