Skip to content

⬆️ Upgrade @deno/doc to 0.199.0 (native v2 migration)#1204

Merged
taras merged 2 commits into
v4from
tm/upgrade-deno-doc
Jul 5, 2026
Merged

⬆️ Upgrade @deno/doc to 0.199.0 (native v2 migration)#1204
taras merged 2 commits into
v4from
tm/upgrade-deno-doc

Conversation

@taras

@taras taras commented Jul 5, 2026

Copy link
Copy Markdown
Member

Motivation

The docs site generates its API Reference with @deno/doc, pinned at 0.188.0. @deno/doc ≥ 0.195.0 replaced the flat v1 DocNode[] model with a v2 Document/Symbol/Declaration model, so staying current means migrating the rendering pipeline. This PR does that migration natively — no compatibility shim — so the codebase speaks v2 directly.

It also fixes a latent bug the version bump surfaces: v2 changed Location.line from 1-indexed to 0-indexed (deno_doc #150/#777), but the "View code" links feed it straight into GitHub's 1-indexed #L<n> anchor, so every source link pointed one line above the symbol's declaration.

Base of a 2-PR stack; #1205 (experimental APIs) stacks on this.

Approach

Two commits.

⬆️ Upgrade + native v2 migration@deno/doc 0.188.0 → 0.199.0, @deno/graph 0.89.0 → 0.100.1, and the www CI job to Deno v2.9.1 (matches #1202). The pipeline consumes v2 directly:

  • doc() returns Record<url, Document>; Document.symbols group declarations by name. DocPageSection holds a raw Declaration; render helpers take the owning symbol via type SymbolInfo = Omit<Symbol, "declarations">extract(declaration, symbol), Type({ declaration, symbol }), exportHash(declaration, symbol, i).
  • .def replaces the per-kind def fields; ClassMethodDef.def; every TsType*Def payload is .value; namespace members recurse over NamespaceDef.elements (member Symbols).
  • Dropped now-invalid kind === "import" checks; Uint8Array cast in blog-image-route.ts.

🐛 Fix off-by-one in "View code" source links — add + 1 where the GitHub #L anchor is built, in package.ts and package/node.ts. Verified: run is declared on source line 32 and the link points to #L32 (was #L31, landing on the */ above it).

Why 0.199.0 and not latest (0.202.0)? @deno/doc 0.200.0–0.202.0 ship broken wasm bindings that fail to instantiate under Deno (WebAssembly.instantiate(): Import #0 "./__wbindgen_placeholder__"), returning 500 for every docs page. 0.199.0 is the newest usable v2 release.

Validation

Ran the site locally: API pages (/api/v4/run, /api/v4/call, /api/v3/spawn) render identically to before; /x/websocket and /x/stream-helpers exercise the package/node.ts path; the run source link verified at the correct line. deno fmt --check, deno lint, and deno check main.tsx pass.

@pkg-pr-new

pkg-pr-new Bot commented Jul 5, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/effection@1204

commit: f0719fa

@codspeed-hq

codspeed-hq Bot commented Jul 5, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 6 untouched benchmarks


Comparing tm/upgrade-deno-doc (f0719fa) with v4 (56af00f)

Open in CodSpeed

taras added 2 commits July 4, 2026 23:20
Bumps `@deno/doc` 0.188.0 -> 0.199.0 and `@deno/graph` 0.89.0 -> 0.100.1, and
aligns the www CI job to Deno v2.9.1 (matches #1202).

`@deno/doc` >= 0.195.0 replaced the flat v1 `DocNode[]` model with the v2
`Document`/`Symbol`/`Declaration` model. The docs-rendering pipeline is migrated
to consume it natively:

- `doc()` returns `Record<url, Document>`; `Document.symbols` group declarations
  by name. `DocPageSection` holds a raw `Declaration`; render helpers receive
  the owning symbol via `type SymbolInfo = Omit<Symbol, "declarations">`
  (`extract(declaration, symbol)`, `Type({ declaration, symbol })`,
  `exportHash(declaration, symbol, i)`).
- `.def` replaces the per-kind def fields; `ClassMethodDef.def`; every
  `TsType*Def` payload is `.value`; namespace members recurse over
  `NamespaceDef.elements` (member Symbols).
- `kind === "import"` checks dropped; `Uint8Array` cast in blog-image-route.ts.

Note: `@deno/doc` 0.200.0-0.202.0 ship broken wasm bindings that fail to
instantiate under Deno (`__wbindgen_placeholder__`), so 0.199.0 is the newest
usable v2 release.
`@deno/doc` v2 changed `Location.line` from 1-indexed to 0-indexed (deno_doc
#150/#777). GitHub's `#L<n>` anchor is 1-indexed, so the source links generated
in package.ts / package/node.ts pointed one line above the symbol's
declaration. Add `+ 1`.
@taras taras force-pushed the tm/upgrade-deno-doc branch from 3cecf91 to f0719fa Compare July 5, 2026 03:22
@taras taras changed the title ⬆️ Upgrade @deno/doc to 0.199.0 (v2 model migration) ⬆️ Upgrade @deno/doc to 0.199.0 (native v2 migration) Jul 5, 2026

@cowboyd cowboyd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened it up and browse the API docs. All the links I checked seem to work. It wasn’t exhaustive but hopefully representative.

@taras taras merged commit 762181c into v4 Jul 5, 2026
19 checks passed
@taras taras deleted the tm/upgrade-deno-doc branch July 5, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants