observablehq / observablehq/notebook-kit

FileAttachment metadata is missing, and missing files aren’t checked statically

Open
#27 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

desktop
Dominant language
TypeScript
Stars
371
Forks
27
Avg merge
3h 52m
Merged PRs (30d)
1

Description

We don’t currently do any static analysis of file attachments, and so FileAttachment calls are missing metadata (such as the MIME type and last-modified time), and FileAttachment calls that reference files that don’t exist don’t throw statically (but will still throw when you try to load the associated data).

You do get a warning when building:

new URL("./does-not-exist.txt", import.meta.url) doesn't exist at build time, it will remain unchanged to be resolved at runtime. If this is intended, you can use the /* @vite-ignore */ comment to suppress this warning.

Ideally these would be errors.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the build-time handling for FileAttachment calls and the existing warning for missing new URL references. Trace how attachment metadata and file existence are currently resolved, then verify that missing files and absent metadata produce errors rather than runtime failures or warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.