Files
Leo Kettmeir 87a1c9f47a feat(desktop): clipboard api (#35750)
Adds `navigator.clipboard` (text only) to `deno desktop`, mirroring the
web
[Clipboard
API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard).

## What it does

- Exposes `navigator.clipboard` as a real `Clipboard` (extends
`EventTarget`),
installed as a `[SameObject]` prototype getter on `Navigator` — matching
how
the built-in `Navigator` attributes are defined (webidl-branded
receiver).
- Implements the async text methods:
- `readText(): Promise<string>` — resolves to the clipboard text, or
`""`
    when empty / non-text.
- `writeText(data): Promise<void>` — `data` goes through the `DOMString`
    converter with `requiredArguments`, matching the spec signature.
- The richer `read()` / `write()` (`ClipboardItem` / arbitrary MIME
types) are
  **omitted** rather than stubbed, since laufey has no backing for them.
- `clipboard-read` / `clipboard-write` permission gating is not applied
(laufey has no clipboard permission model), consistent with how the
desktop
  `Notification` surface degrades.
- Exposes a minimal, frozen subset of `webidl` on `internals` so
post-bootstrap
classic scripts (the `deno desktop` init script) can define web
interfaces.
- Adds the `Clipboard` interface to `lib.deno.desktop.d.ts`.

## The ops are genuinely async

laufey's clipboard calls block their calling thread. On X11 and Wayland
there
is no central clipboard store: a read is serviced by whichever
application
currently owns the selection, and `gtk_clipboard_wait_for_text` has no
timeout,
so an unresponsive owner can block for as long as it likes.

Running that on the JS thread would freeze the whole runtime — timers,
servers,
signal handlers — which is the same failure mode as the error dialog in
#36393,
except the `Promise` shape of `readText()` would have made it look
impossible.
Both ops therefore run the blocking call on their own thread and resolve
when
it returns.

## Test

Two `DESKTOP_JS` tests: `desktop_js_installs_navigator_clipboard` pins
the
class shape, the prototype getter on `Navigator`, the unreachable
constructor
and the branded receiver; `desktop_js_clipboard_awaits_the_ops` pins
that the
JS awaits the ops, since dropping an `await` would silently return a
pending
promise as the clipboard text.
2026-08-26 17:27:06 +02:00
..
2026-08-26 17:27:06 +02:00

tsc

This directory contains the typescript compiler and a small compiler host for the runtime snapshot.

How to upgrade TypeScript.

The files in this directory are mostly from the TypeScript repository. We currently (unfortunately) have a rather manual process for upgrading TypeScript. It works like this currently:

  1. Checkout denoland/TypeScript repo in a separate directory.
  2. Add Microsoft/TypeScript as a remote and fetch its latest tags
  3. Checkout a new branch based on this tag.
  4. Cherry pick the custom commit we made in a previous release to the new one.
  5. This commit has a "deno.ts" file in it. Read the instructions in it.
  6. Copy typescript.js into Deno repo.
  7. Copy d.ts files into dts directory.
  8. Review the copied files, removing and reverting what's necessary

So that might look something like this:

git clone https://github.com/denoland/TypeScript.git
cd typescript
git remote add upstream https://github.com/Microsoft/TypeScript
git fetch upstream
git checkout v3.9.7
git checkout -b branch_v3.9.7
git cherry pick <previous-release-branch-commit-we-did>
npm install
npx hereby
rsync built/local/typescript.js ~/src/deno/cli/tsc/00_typescript.js
rsync --exclude=protocol.d.ts --exclude=tsserverlibrary.d.ts --exclude=typescriptServices.d.ts built/local/*.d.ts ~/src/deno/cli/tsc/dts/