From 9c3bc9574b257736e94379f71a1186ba98f6d9ba Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 12:38:12 -0500 Subject: [PATCH 01/46] docs(plans): plan the trust release from the four evaluation reports The reports in .specs/reports/ were written independently and converge on observability as the gap that matters most. Two things they demand had no issue filed at all: CI never runs the Deno/Bun/edge suites that package.json defines, so the multi-runtime claim has no evidence behind it, and explain() returns each node's needs without ever naming what produced them. Sequenced so the cheap phases land first and produce the material the observability design needs. API freeze stays out: README already declares it under 'next', and freezing a surface that is still missing its observability contract would freeze the wrong thing. Signed-off-by: Diego Resendez --- docs/plans/2026-08-16-trust-release-plan.md | 272 ++++++++++++++++++++ 1 file changed, 272 insertions(+) create mode 100644 docs/plans/2026-08-16-trust-release-plan.md diff --git a/docs/plans/2026-08-16-trust-release-plan.md b/docs/plans/2026-08-16-trust-release-plan.md new file mode 100644 index 0000000..2579db2 --- /dev/null +++ b/docs/plans/2026-08-16-trust-release-plan.md @@ -0,0 +1,272 @@ +# Trust Release Plan + +> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. + +**Goal:** Close the gaps that four independent evaluations agree on, in the order that makes each one cheap. Prove portability in CI, make derived execution explainable, ship an observability contract, and move the documentation site out of the core repository so it gets its own lifecycle. + +**Architecture:** Nothing here adds a runtime dependency. The observability work is a contract plus emission points, with exporters living outside core. The explain work is a resolver over data `explainRoute` already returns. The runtime matrix runs suites that already exist. The docs split moves a directory that is already self-contained. + +**Tech Stack:** TypeScript, legacy decorators, Vitest, Deno/Bun/Workers runtimes, JSR, Astro/Starlight, GitHub/Gitea Actions. + +--- + +## Why this order + +The four reports in `.specs/reports/` were written independently and converge on one gap. Observability is the only dimension the CTO due diligence marks as risk **Alto** on its own (§5.3, risk register), it is P0 twice in the Trust Release report (§4, §5), and it is a listed con in the lead-dev report (§4). That is GH #10, and it is the largest item here — which is exactly why it is not first. The three phases before it are cheap, unblock evidence, and produce the material that #10's design needs. + +Two things the reports demand that had **no issue filed**, both verified against the code rather than taken on the report's word: + +- **Runtime matrix in CI.** `package.json:91-93` defines `test:deno`, `test:bun` and `test:edge`. `.github/workflows/ci.yml` runs none of them. `AGENTS.md:23` already warns that `npm test` does not cover the other runtimes — and CI does not close that. The framework's headline claim has no CI evidence. Trust Release §7 (P0), CTO §8.2 and P0-6. +- **`explain()` does not explain causality.** `src/app/introspect.ts:62` returns a flat `chain` with `needs`/`provides` per node, but never the edge from a need to the node that produced it. Trust Release §2 (P0). + +One thing that **has** an issue but appears in no report: **#13 circuit breaker**. Neither the CTO report nor the Trust Release report raises it; the nearest item is "rate limiter" under the CTO's security pack (P0-3), which is a different mechanism. The issue itself already says a worked example in the docs might close it outright. It is scheduled last, as documentation. + +**API freeze is deliberately not a phase.** `README.md:276` already declares it under `**next**`. It needs the RC boundary, and freezing a public surface before #10 lands would freeze an API that is still missing its observability contract. What this plan adds instead is a stability *contract* — a statement of which areas are volatile today, which promises nothing and commits to no date (Task 6.1). + +**Out of scope: #21 and #17.** Both are claimed by `hgshreyas` with the design already settled in the issue threads. Do not touch them. + +--- + +## Phase 0: Unblock releases + +### Task 0.1: Scope the audit gate in stage and release + +**Files:** +- Modify: `.github/workflows/stage.yml` +- Modify: `.github/workflows/release.yml` + +`AGENTS.md:71` states the policy: `npm audit --omit=dev` blocks, everything else is `continue-on-error`. `ci.yml:56-59` implements it. `stage.yml:21` and `release.yml:26` run bare `npm audit`, so a dev-only advisory blocks a publish. This is drift, not a second policy. + +That drift is what stopped work twice. The `nanoid` advisory reached the tree through `tsup → postcss → nanoid` — a build-tooling path that ships to nobody. + +**Step 1:** In both files, change `npm audit` to `npm audit --omit=dev`, and add a non-blocking full `npm audit` with `continue-on-error: true` after it so the advisory is still visible in the log. + +**Step 2:** Carry a comment on the blocking step pointing at the rule, in the voice `ci.yml` already uses — the next person to read it should see a decision, not an omission. + +**Verify:** `grep -n "npm audit" .github/workflows/*.yml` — every blocking occurrence carries `--omit=dev`. + +--- + +## Phase 1: Prove portability, and publish to JSR + +These are one phase because they are one subject. The type error JSR found is on the `app.fetch` path, which is the path Deno, Bun and edge all use; a runtime matrix would have caught it first. Fixing them together means the matrix has a green baseline to protect. + +### Task 1.1: Fix the `BodyInit` hole on the Fetch path + +**Skills:** `@superpowers:test-driven-development` + +**Files:** +- Modify: `src/http/web.ts` +- Test: `test/` (the Fetch adapter suite) + +Gitea #19 reports, from a real `deno publish --dry-run`: + +``` +TS2345: Argument of type 'string | Buffer | null' is not +assignable to parameter of type 'BodyInit | null | undefined'. + --> src/http/web.ts:112:23 +``` + +`Buffer` is not a valid `BodyInit` under Deno's lib. It works at runtime because implementations are forgiving, which is what makes it worth fixing before a user reports it as a bug: it is a genuine typing hole on the runtime-agnostic path, not a JSR formality. + +**Step 1:** Write a failing test that drives a `Buffer` body through the Fetch adapter and asserts the response body round-trips byte-for-byte. + +**Step 2:** Narrow the body to a real `BodyInit` at the boundary — convert the `Buffer` to a view its type declares, rather than casting the error away. A cast would keep the hole and hide it. + +**Step 3:** Confirm the test passes and `npm run typecheck` is clean. + +### Task 1.2: Give the slow-type sites explicit return types + +**Files:** +- Modify: `src/metadata.ts` (11 sites) +- Modify: `src/params.ts` (6 sites) + +Two shapes, both mechanical: `missing-explicit-return-type` on factory functions (`routeDecorator` at `src/metadata.ts:103`, `envelope` at `src/params.ts:35`) and `missing-explicit-type` on the exported constants built from them (`export const Get = routeDecorator('GET', 'buffer')` at `src/metadata.ts:126`). + +**Do not pass `--allow-slow-types`.** That flag degrades generated declarations and makes type checking 1.5–2× slower for consumers, in the framework whose central claim is type safety. Shipping it would contradict the pitch on its own install page. + +**Step 1:** Annotate the factories first — several of the constant errors resolve on their own once the factory's return type is written down. + +**Step 2:** Annotate whatever constants remain. + +**Step 3:** `deno publish --dry-run` reports zero slow types, with no flags. + +**Verify:** `npm run typecheck` and `npm test` still clean; the public types in `dist/` are unchanged or strictly more precise. + +### Task 1.3: Runtime matrix in CI + +**Files:** +- Modify: `.github/workflows/ci.yml` + +The suites exist and CI ignores them. Add a matrix job that runs `test:deno`, `test:bun` and `test:edge` alongside the Node build. + +**Step 1:** Add a job with the three runtimes, each installing its own toolchain. Keep it a separate job from `build` so a Bun failure reports as a Bun failure and does not bury the Node lint output — the same reasoning `ci.yml:53` already applies to the audit step. + +**Step 2:** Confirm the forge difference documented at `AGENTS.md:73` does not bite: GitHub reads `pull_request` workflows from the base branch, so this workflow change cannot validate itself and must reach the base before it gates anything. + +**Step 3:** Publish the resulting capability matrix. `README.md:273` already claims all four runtimes; the matrix is what turns that claim into evidence. + +**Verify:** A deliberate break in shared code fails the Deno job and not only the Node one. + +### Task 1.4: Claim the JSR scope and publish + +**Files:** +- Modify: `deno.json` +- Modify: `.github/workflows/release.yml` + +**Blocked on Diego and not delegable:** `@green-tea` on jsr.io must be claimed with a GitHub account. + +**Step 1:** Add `name`, `version` and `exports` to `deno.json`. Decide whether all four entry points (`.`, `./deno`, `./bun`, `./edge`) are exported or only the Deno one. + +**Step 2:** Publish from the same `v*` tag that publishes to npm, using GitHub Actions OIDC. `release.yml` already holds `id-token: write` for npm Trusted Publishing, so JSR needs no new secret. + +**Step 3:** Nothing here justifies cutting a release on its own — it rides along with the next version cut that has a reason. + +--- + +## Phase 2: The shutdown cluster + +Four open issues, all consequences of the `close({ timeoutMs })` contribution that just merged (`3dcf784`). Treated as one deliverable because they are one subject: Trust Release §14 (P1, lifecycle guarantees) and CTO P0-4 (production checklist, shutdown). + +Order matters — the bug first, then the API, then the docs that describe the finished API. + +### Task 2.1: #20 — `finish()` reads its timer before declaration + +A use-before-declare bug. Smallest item in this plan and it is already shipped. Fix it, and leave a test that fails if the ordering regresses. + +### Task 2.2: #19 — shutdown deadline settable at `createApp` level + +The 10s deadline is hardcoded. Make it configurable at app level, with `close({ timeoutMs })` still overriding per call. + +Per `AGENTS.md:81`, a new option on a public interface **must** also change `src/app/types.ts`. An implementation that grows a parameter alone is unreachable for anyone consuming the package. + +### Task 2.3: #15 — graceful shutdown is Node-only + +Decide and implement: either the Fetch adapters honour the deadline, or `close()` says plainly that they do not. + +`AGENTS.md:82` governs the fallback: behaviour that differs between runtimes must be explicit. An "unavailable here" is fine; silently accepting an option that does nothing is a bug. Follow the precedent already set for `maxConnections` at `runtimes.md:37`, `src/bun.ts:59` and `src/deno.ts:34`, where the project documented the runtime gap rather than faking parity. + +### Task 2.4: #18 — docs still describe `close()` without the timeout + +Last, so it documents the finished API rather than being rewritten twice. If Phase 4 has already run, this lands in the docs repository instead. + +--- + +## Phase 3: Observability (#10) + +The one every report puts first, and the only one that needs a design document before code. + +### Task 3.1: Design document + +**Files:** +- Create: `.specs/2026-XX-XX-green-tea-observability-design.md` + +Write the design before any implementation, following the design/plan pairing already in `.specs/`. + +The issue is explicit that this is **one design, not six**: an injectable logger, structured output and tracing hooks are the same API decision, and solving them separately leaves three mechanisms that do not fit together. + +Inputs to reconcile: + +- The scope in GH #10 — injectable logger contract, JSON default with human-readable dev output, request/response logging as a composable step rather than global middleware, hooks an exporter can attach to, metrics export. +- The Trust Release event vocabulary (§4) — `request.*`, `route.*`, `step.*`, `provider.*`, `graph.*`, `websocket.*`, `stream.*` — and its context fields (`requestId`, `traceId`, `route`, `transport`, `step`, `duration`, `status`, `scope`, `runtime`). +- Trust Release §6, graph timing. Per-step timings are close to free because the graph already knows every node, but the instrumentation stays opt-in if overhead is measurable. Measure before deciding. + +Hard constraint, restated from `AGENTS.md:11`: **no new runtime dependency.** Core stays on `reflect-metadata` alone. An OpenTelemetry exporter is a separate package (`@green-tea/opentelemetry`), never a core dependency. + +Decisions the design must settle rather than leave open: + +1. Is the logger a provider like any other, or a distinct registration? +2. Do events go through one emitter or through per-category hooks? +3. Does a step failure emit `step.failed` and `request.failed`, or only the outer one? +4. Do long-lived streams and WebSockets emit per-message events, or only lifecycle ones? (The same reasoning that keeps upgrades out of the #21 gate applies.) + +### Task 3.2: Implement to the approved design + +Do not start before the design is reviewed. Write the implementation plan from the approved design, as `.specs/` already does for every other subsystem. + +### Task 3.3: Rewrite the observability paragraph in `README.md` + +`README.md:246` currently reads "**No observability layer, either.**" and points at issue #10. When #10 lands, that paragraph is wrong and it is the single most load-bearing sentence in the CTO's assessment. Rewriting it is part of the work, not follow-up. + +`AGENTS.md:83`: new public API needs a note in `README.md`. + +--- + +## Phase 4: Split the documentation site + +Verified before scheduling: `website/` is self-contained. 26 source files, no path escaping the directory, and the `@green-tea/core` mentions inside the `.md` files are example code, not build-time imports. + +The coupling to core is five lines: + +| Location | What | +|---|---| +| `.github/workflows/ci.yml:62-65` | `npm ci --prefix website`, `npm audit --prefix website`, `npm run docs:build` | +| `package.json:100-101` | `docs:dev`, `docs:build` | + +Plus two README references to update: `README.md:254` (the docs link) and `README.md:263` (`npm run docs:dev`). + +**The real work is not the move.** No workflow anywhere in `.github/workflows/` deploys the site. `website/astro.config.mjs:6` points at `green-tea.expressive-tea.io` and the deploy happens by hand today. The new repository is where that pipeline gets built for the first time. + +### Task 4.1: Create the repository and move `website/` with its history + +Preserve commit history for the moved directory rather than landing it as one squashed import. + +### Task 4.2: Build the deploy pipeline + +The thing the docs never had. Build on push to the default branch, deploy to `green-tea.expressive-tea.io`. + +### Task 4.3: Remove the website from core + +Delete the three `ci.yml` steps, the two `package.json` scripts, and `website/`. Update `README.md:254` and `README.md:263`. + +### Task 4.4: Guard the seam the split opens + +The split trades CI coupling for drift risk: docs and code can now disagree without anything failing. #18 exists precisely because docs fell behind an API change. Decide what catches that — a link check against the published package, a docs job triggered from core releases, or an explicit accepted risk written down. Do not leave it unstated. + +--- + +## Phase 5: Close #13 as documentation + +### Task 5.1: Write the circuit-breaker recipe + +**Files:** +- Create: a guide page in the docs repository + +The issue was opened to decide placement, not to commit to a core implementation, and it answers itself: core adding resilience policy would contradict the one-runtime-dependency rule. A circuit breaker fits a step — it needs whatever provides the client, it produces a guarded caller, and the graph already sequences it correctly. + +Write it as a worked example, then close #13 pointing at the page. First real content in the new repository, which is also a live test of the deploy pipeline from Task 4.2. + +--- + +## Phase 6: The stability contract + +### Task 6.1: A stability paragraph in `Honest scope` + +**Files:** +- Modify: `README.md` + +Not a roadmap, and not the API freeze. A statement of which areas are volatile *today* — present state, no dates, no delivery commitment. This is spare-time work by one person and a roadmap it cannot keep would cost more trust than it earns. + +`## Honest scope` (`README.md:240`) already carries exactly this voice: mesh is alpha, there is no observability layer, runtimes differ in what they can offer. The stability tiers belong in that section, in that register, as one paragraph. + +Roughly the split the Trust Release report proposes in §8 — graph semantics, providers, steps and controllers as the stable candidates; decorator syntax, CLI and plugin APIs as beta; mesh and distributed capabilities as experimental. Verify each claim against the code before writing it down; a stability tier asserted and then broken is worse than none. + +`README.md:266-276` keeps its `**next**` line unchanged. API freeze stays declared there and gets planned separately, near the RC. + +--- + +## Verification + +Per `AGENTS.md:28`, run before proposing any task as finished: + +```bash +npm run lint && npm run format:check && npm run typecheck && npm test +``` + +And from Phase 1 onward the runtime suites are no longer optional, because CI runs them: + +```bash +npm run test:deno && npm run test:bun && npm run test:edge +``` + +Conventional Commits focused on the *why*, every commit signed off (`git commit -s`), no AI co-authoring attribution. From 70bb9902dcb277259316bbfee416a1f0ba553d19 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 12:38:20 -0500 Subject: [PATCH 02/46] ci: scope the publish audit gate to what actually ships AGENTS.md states the rule and ci.yml implements it: npm audit --omit=dev blocks, everything else reports. stage.yml and release.yml ran a bare npm audit, so a dev-only advisory could hold a publish. That drift stopped work twice. The nanoid advisory reached the tree through tsup -> postcss -> nanoid, a build-tooling path that ships to nobody, and fixing it was a precondition for a release it could not affect. The full audit still runs with continue-on-error, so nothing goes unseen. Signed-off-by: Diego Resendez --- .github/workflows/release.yml | 5 +++++ .github/workflows/stage.yml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e43dc89..733e6e4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,12 @@ jobs: registry-url: 'https://registry.npmjs.org' - run: npm install -g npm@latest # npm >= 11.5.1 is required for OIDC trusted publishing - run: npm ci + # Same scoped gate as ci.yml: only what we ship blocks a publish. With `reflect-metadata` + # as the sole runtime dependency, a blocking advisory here is rare and genuinely reaches + # users; a build-tooling one never does. The full audit still reports. + - run: npm audit --omit=dev - run: npm audit + continue-on-error: true # `npm publish` runs prepublishOnly (lint + complexity + typecheck + test + build) first. # No NODE_AUTH_TOKEN — npm exchanges the OIDC id-token for a short-lived publish token. # A prerelease (26.7.0-beta.N) publishes under its channel tag (beta/alpha/rc) so `latest` diff --git a/.github/workflows/stage.yml b/.github/workflows/stage.yml index 993ed1c..6b1bc36 100644 --- a/.github/workflows/stage.yml +++ b/.github/workflows/stage.yml @@ -18,7 +18,12 @@ jobs: with: node-version: '22' - run: npm ci + # Same scoped gate as ci.yml: only what we ship blocks a publish. A `tsup` advisory + # reaches nobody, and holding a release candidate for one is how staging stalls on work + # that has nothing to do with the package. The full audit still reports. + - run: npm audit --omit=dev - run: npm audit + continue-on-error: true - name: Validate release candidate run: npm run prepublishOnly - name: Publish prerelease to Verdaccio From 30f33b6383c77792ef87245ff4ef96d78c1105ca Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 12:45:37 -0500 Subject: [PATCH 03/46] fix(http): narrow buffered bodies to what the runtime's Response accepts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A Node Buffer is a Uint8Array at runtime, but its declared backing store is ArrayBufferLike, which admits SharedArrayBuffer — and BodyInit takes only ArrayBuffer-backed views. Deno's lib rejected it outright at web.ts:112. This is the app.fetch path, so the hole was on Deno, Bun and edge alike; it went unnoticed because every implementation is forgiving about it at runtime. Re-views rather than copies: this is the buffered-response path, and a copy per response would cost real throughput on the runtimes that have no other adapter. byteOffset and byteLength are load-bearing there — Buffer.from hands back a window into a shared 8 KB pool, and dropping them returns the whole pool. A direct test covers that; the static-serving one covers the integration. The type is derived from Response's own constructor because BodyInit is not a global under lib es2020 plus @types/node, though Response itself is. Refs: Green-Tea/core#19 Signed-off-by: Diego Resendez --- src/http/web.ts | 32 +++++++++++++++++++++++++++++++- test/views-static.test.ts | 14 ++++++++++++++ test/web-stream.test.ts | 26 +++++++++++++++++++++++++- 3 files changed, 70 insertions(+), 2 deletions(-) diff --git a/src/http/web.ts b/src/http/web.ts index 503b99e..d8c51bd 100644 --- a/src/http/web.ts +++ b/src/http/web.ts @@ -100,6 +100,36 @@ async function acquireFetchBody( return { body: parsed.body }; } +/** + * Whatever the host runtime's `Response` accepts as a body. Derived from the constructor rather + * than written as `BodyInit`, because that name is not global under this `lib` (`es2020` plus + * `@types/node`) even though `Response` itself is — and Deno spells the same idea from its own lib. + */ +type ResponseBody = ConstructorParameters[0]; + +/** + * Narrows a buffered body to something the runtime's `Response` accepts. + * + * A Node `Buffer` is a `Uint8Array` at runtime, so every runtime here takes one — but its declared + * backing store is `ArrayBufferLike`, which admits `SharedArrayBuffer`, and `BodyInit` accepts only + * `ArrayBuffer`-backed views. Deno's lib therefore rejects it outright: this is the `app.fetch` path, + * so the mismatch reaches Deno, Bun and edge alike. Node never allocates a Buffer over a + * `SharedArrayBuffer`, which is what makes the assertion on the backing store safe to state. + * + * `byteOffset`/`byteLength` are load-bearing, not defensive. `Buffer.from` and `Buffer.allocUnsafe` + * hand back a window into a shared 8 KB pool, so re-viewing the backing store without them yields + * the whole pool — neighbouring allocations included. Today the only Buffer reaching here comes from + * `fs.promises.readFile`, which returns an exactly-sized allocation, so nothing currently trips that. + * `StaticHit.body` is typed `Buffer` though, and a pooled one is a correct value for it. + * + * Re-viewing rather than copying: this is the buffered-response path, and a copy per response would + * be a real cost on the runtimes that have no other adapter. + */ +export function toBodyInit(body: string | Buffer): ResponseBody { + if (typeof body === 'string') return body; + return new Uint8Array(body.buffer as ArrayBuffer, body.byteOffset, body.byteLength); +} + /** Converts a {@link HandleResult}'s outcome into a web `Response`, buffered or streamed. */ function outcomeToResponse(result: HandleResult): Response { const headers = mergeInjectedHeaders(result.outcome.headers, result.injected) as Record; @@ -108,7 +138,7 @@ function outcomeToResponse(result: HandleResult): Response { return new Response(asReadableStream(result.outcome.stream, result.outcome.encoder), { headers }); } - const body = [204, 205, 304].includes(result.outcome.status) ? null : result.outcome.body; + const body = [204, 205, 304].includes(result.outcome.status) ? null : toBodyInit(result.outcome.body); return new Response(body, { status: result.outcome.status, headers }); } diff --git a/test/views-static.test.ts b/test/views-static.test.ts index 80be5ba..db141e4 100644 --- a/test/views-static.test.ts +++ b/test/views-static.test.ts @@ -11,6 +11,10 @@ writeFileSync(join(root, 'index.html'), '

Home

'); writeFileSync(join(root, 'app.css'), 'body{}'); writeFileSync(join(tmpdir(), 'gt-secret.txt'), 'TOP SECRET'); +// Bytes that no text encoding round-trips: a NUL, a lone high byte, an invalid UTF-8 sequence. +const binary = Buffer.from([0x00, 0x89, 0x50, 0x4e, 0x47, 0xff, 0xfe, 0x0d, 0x0a, 0x1a, 0x0a]); +writeFileSync(join(root, 'pixel.bin'), binary); + @Route('/api') class Api { @Get('/ping') @@ -29,6 +33,16 @@ describe('static serving', () => { expect(res.headers.get('content-type')).toBe('text/css; charset=utf-8'); expect(await res.text()).toBe('body{}'); }); + // Static serving is the only path that puts a Buffer into a buffered outcome, so it is the only + // integration cover for the Buffer→BodyInit conversion in the Fetch adapter. Every other assertion + // in this file is text, which survives a conversion that mangles bytes; this one does not. + it('serves binary bytes exactly', async () => { + const res = await app.fetch(new Request('http://x/pixel.bin')); + expect(res.status).toBe(200); + const bytes = new Uint8Array(await res.arrayBuffer()); + expect(bytes.byteLength).toBe(binary.byteLength); + expect([...bytes]).toEqual([...binary]); + }); it('serves index.html for /', async () => { expect(await (await app.fetch(new Request('http://x/'))).text()).toBe('

Home

'); }); diff --git a/test/web-stream.test.ts b/test/web-stream.test.ts index ad21768..a946b2a 100644 --- a/test/web-stream.test.ts +++ b/test/web-stream.test.ts @@ -1,9 +1,33 @@ import { describe, it, expect } from 'vitest'; -import { asReadableStream } from '../src/http/web'; +import { asReadableStream, toBodyInit } from '../src/http/web'; import { sseEncoder } from '../src/encoders'; async function* nums() { yield { n: 1 }; yield { n: 2 }; } +describe('toBodyInit', () => { + it('passes a string through untouched', () => { + expect(toBodyInit('hello')).toBe('hello'); + }); + + // `Buffer.from` allocates inside a shared 8 KB pool, so these bytes sit at a non-zero byteOffset. + // A conversion that re-views the backing store without the offset and length returns the entire + // pool — every other allocation in it included. Asserting the length alone catches that. + it('re-views a pooled Buffer as its own bytes, not the whole pool', async () => { + const buf = Buffer.from([0x00, 0x89, 0xff, 0xfe, 0x0a]); + expect(buf.byteOffset).toBeGreaterThan(0); // guards the premise: this Buffer really is pooled + expect(buf.buffer.byteLength).toBeGreaterThan(buf.byteLength); + + const bytes = new Uint8Array(await new Response(toBodyInit(buf)).arrayBuffer()); + expect(bytes.byteLength).toBe(5); + expect([...bytes]).toEqual([0x00, 0x89, 0xff, 0xfe, 0x0a]); + }); + + it('does not copy — the view shares the backing store', () => { + const buf = Buffer.from([1, 2, 3]); + expect((toBodyInit(buf) as Uint8Array).buffer).toBe(buf.buffer); + }); +}); + describe('asReadableStream', () => { it('encodes each yielded value with the encoder', async () => { const rs = asReadableStream(nums(), sseEncoder); From 1c5a908fb9bb8bccb062df79f6ad818c623799a1 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 12:45:47 -0500 Subject: [PATCH 04/46] chore(types): name the decorator shapes so JSR sees no slow types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit deno publish --dry-run reported 17 slow types across metadata.ts and params.ts: two factories with inferred return types, and the fifteen exported decorators built from them. Naming RouteDecorator and ArgDecorator fixes all seventeen, since annotating each factory resolves its constants with it. Fixed rather than waived with --allow-slow-types. That flag degrades the generated declarations and makes type checking 1.5-2x slower for consumers, which is a strange thing to ship in the framework whose central claim is type safety. The two names are public API and worth having on their own: a caller can now give a decorator of either shape a name. The factories also lost their inline parameter types, which the declared return type now supplies. deno.json gains the JSR manifest. Exports mirror npm's four entry points on purpose — a docs example importing @green-tea/core/bun has to work whichever registry the reader installed from. Dry run is clean with no flags; claiming the @green-tea scope on jsr.io is the remaining step. Refs: Green-Tea/core#19 Signed-off-by: Diego Resendez --- deno.json | 15 +++++++++++ deno.lock | 3 ++- src/index.ts | 4 +-- src/metadata.ts | 69 ++++++++++++++++++++++++++++--------------------- src/params.ts | 49 +++++++++++++++++++++-------------- 5 files changed, 88 insertions(+), 52 deletions(-) diff --git a/deno.json b/deno.json index 3a2fd5b..5af1930 100644 --- a/deno.json +++ b/deno.json @@ -1,4 +1,19 @@ { + "name": "@green-tea/core", + "version": "26.8.0-beta.0", + "license": "MIT", + // JSR serves TypeScript source, not the tsup build, so these point at `src/` where npm's + // `exports` point at `dist/`. Same four entry points on purpose: a docs example that imports + // `@green-tea/core/bun` has to work whichever registry the reader installed from. + "exports": { + ".": "./src/index.ts", + "./deno": "./src/deno.ts", + "./bun": "./src/bun.ts", + "./edge": "./src/edge.ts" + }, + "publish": { + "include": ["src", "README.md", "CHANGELOG.md", "LICENSE", "deno.json"] + }, "compilerOptions": { "experimentalDecorators": true, "emitDecoratorMetadata": true, diff --git a/deno.lock b/deno.lock index 4bb7fd1..efe1539 100644 --- a/deno.lock +++ b/deno.lock @@ -55,7 +55,8 @@ "hyperid": { "uuid": "11.1.1" } - } + }, + "undici": "7.29.0" } } } diff --git a/src/index.ts b/src/index.ts index eabc7a1..2d51c16 100644 --- a/src/index.ts +++ b/src/index.ts @@ -40,7 +40,7 @@ export { Options, Html, } from './metadata'; -export type { Transport, HttpMethod } from './metadata'; +export type { Transport, HttpMethod, RouteDecorator } from './metadata'; export type { Plugin } from './plugin'; // Transformers & error signals @@ -63,7 +63,7 @@ export type { StepFn, CompiledFlow } from './flow'; // Parameter decorators export { needs, ctx, param, query, body, headers, header, inbound, abort } from './params'; -export type { Query, Headers, Context, ArgSpec } from './params'; +export type { Query, Headers, Context, ArgSpec, ArgDecorator } from './params'; // Streaming export { channel, isAsyncIterable } from './channel'; diff --git a/src/metadata.ts b/src/metadata.ts index 8a1f3ec..660225a 100644 --- a/src/metadata.ts +++ b/src/metadata.ts @@ -100,48 +100,57 @@ export function Route(prefix: string): ClassDecorator { }; } -function routeDecorator(method: HttpMethod, transport: Transport) { - return ( - path: string, - opts?: { export?: boolean; duplicates?: 'array' | 'last'; maxBodyBytes?: number; maxParts?: number }, - ): MethodDecorator => - (target, propertyKey) => { - const ctor = target.constructor; - const routes = (Reflect.getMetadata(K.routes, ctor) as RouteMeta[]) ?? []; - routes.push({ - method, - path, - handlerName: String(propertyKey), - transport, - export: opts?.export ?? false, - duplicates: opts?.duplicates, - maxBodyBytes: opts?.maxBodyBytes, - maxParts: opts?.maxParts, - }); - Reflect.defineMetadata(K.routes, routes, ctor); - }; +/** + * The shape every route decorator shares: a path, optional per-route overrides, and the + * `MethodDecorator` that records them against the controller. + * + * Named rather than inferred because JSR rejects an inferred type on a public symbol — an inferred + * one forces every consumer's type checker to re-derive it from the implementation instead of + * reading it from the declaration. It also gives callers a name for the shape. + */ +export type RouteDecorator = ( + path: string, + opts?: { export?: boolean; duplicates?: 'array' | 'last'; maxBodyBytes?: number; maxParts?: number }, +) => MethodDecorator; + +function routeDecorator(method: HttpMethod, transport: Transport): RouteDecorator { + return (path, opts) => (target, propertyKey) => { + const ctor = target.constructor; + const routes = (Reflect.getMetadata(K.routes, ctor) as RouteMeta[]) ?? []; + routes.push({ + method, + path, + handlerName: String(propertyKey), + transport, + export: opts?.export ?? false, + duplicates: opts?.duplicates, + maxBodyBytes: opts?.maxBodyBytes, + maxParts: opts?.maxParts, + }); + Reflect.defineMetadata(K.routes, routes, ctor); + }; } /** Declares a buffered `GET` route. */ -export const Get = routeDecorator('GET', 'buffer'); +export const Get: RouteDecorator = routeDecorator('GET', 'buffer'); /** Declares a buffered `HEAD` route. */ -export const Head = routeDecorator('HEAD', 'buffer'); +export const Head: RouteDecorator = routeDecorator('HEAD', 'buffer'); /** Declares a buffered `POST` route. */ -export const Post = routeDecorator('POST', 'buffer'); +export const Post: RouteDecorator = routeDecorator('POST', 'buffer'); /** Declares a buffered `PUT` route. */ -export const Put = routeDecorator('PUT', 'buffer'); +export const Put: RouteDecorator = routeDecorator('PUT', 'buffer'); /** Declares a buffered `PATCH` route. */ -export const Patch = routeDecorator('PATCH', 'buffer'); +export const Patch: RouteDecorator = routeDecorator('PATCH', 'buffer'); /** Declares a buffered `DELETE` route. */ -export const Delete = routeDecorator('DELETE', 'buffer'); +export const Delete: RouteDecorator = routeDecorator('DELETE', 'buffer'); /** Declares a buffered `OPTIONS` route. */ -export const Options = routeDecorator('OPTIONS', 'buffer'); +export const Options: RouteDecorator = routeDecorator('OPTIONS', 'buffer'); /** Declares a `GET` route streamed as Server-Sent Events. */ -export const Sse = routeDecorator('GET', 'sse'); +export const Sse: RouteDecorator = routeDecorator('GET', 'sse'); /** Declares a `GET` route whose transport is content-negotiated at request time. */ -export const Stream = routeDecorator('GET', 'negotiate'); +export const Stream: RouteDecorator = routeDecorator('GET', 'negotiate'); /** Declares a `GET` route upgraded to a WebSocket. */ -export const Ws = routeDecorator('GET', 'ws'); +export const Ws: RouteDecorator = routeDecorator('GET', 'ws'); /** Attaches a response transformer to a handler method. */ export function Transformer(fn: TransformerFn): MethodDecorator { diff --git a/src/params.ts b/src/params.ts index 495bca9..696301a 100644 --- a/src/params.ts +++ b/src/params.ts @@ -32,34 +32,45 @@ function record(target: object, methodKey: string | symbol | undefined, spec: Ar Reflect.defineMetadata(ARGS, map, ctor); } -function envelope(source: ArgSource) { - return (arg?: string | string[] | StandardSchemaV1, schema?: StandardSchemaV1): ParameterDecorator => - (target, methodKey, index) => { - const spec: ArgSpec = { index, source }; - if (Array.isArray(arg)) spec.keys = arg; - else if (typeof arg === 'string') spec.key = arg; - else if (isStandardSchema(arg)) spec.schema = arg; - else if (arg !== undefined) throw new Error(`@${source}: expected a Standard Schema or a string/array key`); +/** + * The shape every argument decorator shares: an optional key, key list or schema, an optional + * second schema, and the `ParameterDecorator` that records the resulting spec. + * + * Named for the same reason as `RouteDecorator` in `./metadata` — JSR rejects an inferred type on a + * public symbol, because consumers would have to re-derive it from the implementation on every check. + */ +export type ArgDecorator = ( + arg?: string | string[] | StandardSchemaV1, + schema?: StandardSchemaV1, +) => ParameterDecorator; - if (schema !== undefined) { - if (!isStandardSchema(schema)) throw new Error(`@${source}: second argument must be a Standard Schema`); - spec.schema = schema; - } +function envelope(source: ArgSource): ArgDecorator { + return (arg, schema) => (target, methodKey, index) => { + const spec: ArgSpec = { index, source }; + if (Array.isArray(arg)) spec.keys = arg; + else if (typeof arg === 'string') spec.key = arg; + else if (isStandardSchema(arg)) spec.schema = arg; + else if (arg !== undefined) throw new Error(`@${source}: expected a Standard Schema or a string/array key`); - record(target, methodKey, spec); - }; + if (schema !== undefined) { + if (!isStandardSchema(schema)) throw new Error(`@${source}: second argument must be a Standard Schema`); + spec.schema = schema; + } + + record(target, methodKey, spec); + }; } /** Inject a route path parameter; pass a key to pick one, or a schema/array to shape it. */ -export const param = envelope('params'); +export const param: ArgDecorator = envelope('params'); /** Inject a query-string value; pass a key to pick one, or a schema/array to shape it. */ -export const query = envelope('query'); +export const query: ArgDecorator = envelope('query'); /** Inject the request body; pass a schema to validate it. */ -export const body = envelope('body'); +export const body: ArgDecorator = envelope('body'); /** Inject request headers; pass a key to pick one, an array to pick several, or no arg for the whole bag. */ -export const headers = envelope('headers'); +export const headers: ArgDecorator = envelope('headers'); /** Inject a single request header by name (singular alias of {@link headers}); accepts a schema to validate it. */ -export const header = envelope('headers'); +export const header: ArgDecorator = envelope('headers'); /** Inject a value produced upstream by a step or provider, addressed by key. */ export function needs(key: string): ParameterDecorator { From a0fd74da341d611dff50da5c64443b6008f3513a Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 12:46:51 -0500 Subject: [PATCH 05/46] ci: run the Deno, Bun and workerd suites on every push MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit package.json has defined test:deno, test:bun and test:edge for a while and CI ran none of them, so 'runs everywhere' rested on whoever remembered to run them locally. AGENTS.md even warned that npm test does not cover the other runtimes without anything closing that gap. Its own job rather than more steps on build, so a Bun failure reads as a Bun failure instead of burying the Node lint output — the same reasoning that places the audit where it is. fail-fast is off because which *other* runtime broke is the useful half of the answer. README and AGENTS.md now say the suites gate a merge, since the claim they back is the headline one. Refs: .specs/reports/green-tea-next-beta-trust-release.md section 7 Signed-off-by: Diego Resendez --- .github/workflows/ci.yml | 31 +++++++++++++++++++++++++++++++ AGENTS.md | 2 +- README.md | 7 +++++-- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c5fe21..0d2a6f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,3 +63,34 @@ jobs: - run: npm audit --prefix website continue-on-error: true - run: npm run docs:build + + # Runs everywhere is the headline claim, so it gets tested rather than asserted. `npm test` is + # Node only: a change to shared code can pass it and still be broken on Deno or Bun, which is + # exactly why these suites exist separately. Leaving them out of CI meant the claim rested on + # whoever remembered to run them locally. + # + # Its own job, not more steps on `build`, for the reason the audit sits where it does: a Bun + # failure should read as a Bun failure instead of burying the Node lint output. + runtimes: + runs-on: ubuntu-latest + strategy: + # One runtime breaking must not cancel the others — which one else broke is the useful part + # of the answer, and a cancelled job reports as if it had never been asked. + fail-fast: false + matrix: + runtime: [deno, bun, edge] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '22' + # All three need the dependency tree: the edge suite drives workerd from a Node process, and + # Deno and Bun resolve `reflect-metadata` out of node_modules like any other import. + - run: npm ci + - if: matrix.runtime == 'deno' + uses: denoland/setup-deno@v2 + with: + deno-version: v2.x + - if: matrix.runtime == 'bun' + uses: oven-sh/setup-bun@v2 + - run: npm run test:${{ matrix.runtime }} diff --git a/AGENTS.md b/AGENTS.md index efc94bb..09d4f29 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -25,7 +25,7 @@ npm run test:bun npm run test:edge ``` -Run the first four before proposing anything as finished. The runtime suites are separate on purpose — a change to shared code that passes `npm test` may still be broken on Deno or Bun. +Run the first four before proposing anything as finished. The runtime suites stay separate commands on purpose — a change to shared code that passes `npm test` may still be broken on Deno or Bun — but they are no longer optional: CI runs all three on every push and each one gates a merge. Run them yourself for anything touching `src/http/`, the adapters, or `src/mesh/`, rather than finding out from CI. ## Two forges diff --git a/README.md b/README.md index 060ae12..cb5fa76 100644 --- a/README.md +++ b/README.md @@ -256,7 +256,10 @@ green-tea is **beta**, on the road to a release candidate. Express and Fastify h ```bash npm install -npm test # vitest (Node); test:deno / test:bun / test:edge for the other runtimes +npm test # vitest (Node only — CI additionally runs the three below on every push) +npm run test:deno # deno test } a change to shared code can pass `npm test` +npm run test:bun # bun test } and still be broken on one of these +npm run test:edge # workerd via miniflare npm run typecheck # tsc --noEmit (includes the compile-time-guarantee type test) npm run build # emit dist/ (tsup: dual ESM + CJS) npm run bench # regenerate BENCHMARKS.md @@ -270,7 +273,7 @@ npm run docs:dev # the documentation site (website/) - ✅ **streams** — SSE / ndjson / WebSocket duplex over a multicast `AsyncIterable` channel, with backpressure and cleanup. - ✅ **graph introspection** — `explain` / `graph` / `toMermaid` / `GET /__graph__`. - ✅ **mesh (walking skeleton)** — `teapot`/`teacup` distributed DI over a secret-gated WS control channel. A BEAM/OTP-style cluster, *not* microservices. -- ✅ **runs everywhere** — Node, Deno, Bun, and Cloudflare Workers over web-standard `Request`/`Response`, with identical WebSocket behaviour on all four. +- ✅ **runs everywhere** — Node, Deno, Bun, and Cloudflare Workers over web-standard `Request`/`Response`, with identical WebSocket behaviour on all four. Every CI run exercises all four; the Deno, Bun, and workerd suites gate a merge exactly as the Node one does. - ✅ **HTML** — `@Html` (string / file / template), a built-in template engine with a bring-your-own `viewEngine` hook, and `static` serving. - ✅ **router completeness for beta** — safe constrained params, deterministic precedence, explicit/automatic HEAD and OPTIONS, strict path validation, and ambiguity checks across local and mesh routes. - **next** — API freeze + first published release, mesh sub-specs (discovery, load-balancing, failover), official plugins, and a radix-tree matcher for very large route tables. From f96c2ad40172d5a5641dfad72bd17c7a1c3e2af6 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 12:47:47 -0500 Subject: [PATCH 06/46] test: pin the JSR manifest to package.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit npm and JSR publish from the same tag but read their identity from different files. Bump package.json alone and that tag ships one version to npm and the previous one to JSR, with nothing failing — the drift the deno.json manifest introduced, closed where the other publication-metadata pins already live. Also pins the entry points to npm's, so a docs example importing @green-tea/core/bun keeps working whichever registry the reader installed from. Signed-off-by: Diego Resendez --- test/package-metadata.test.ts | 37 ++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/test/package-metadata.test.ts b/test/package-metadata.test.ts index a5f1301..f9fbed2 100644 --- a/test/package-metadata.test.ts +++ b/test/package-metadata.test.ts @@ -16,7 +16,25 @@ interface PackageMetadata { readonly author?: string; } -const packageJson = JSON.parse(readFileSync(resolve(process.cwd(), 'package.json'), 'utf8')) as PackageMetadata; +interface DenoManifest { + readonly name?: string; + readonly version?: string; + readonly license?: string; + readonly exports?: Record; +} + +const read = (file: string): string => readFileSync(resolve(process.cwd(), file), 'utf8'); +const packageJson = JSON.parse(read('package.json')) as PackageMetadata & { version: string; license: string }; + +// `deno.json` is JSONC and carries comments. Only whole-line `//` comments are stripped, so this +// can never eat a `//` inside a string value — narrower than a general JSONC parser, and enough, +// versus pulling in a dependency to read one config file. +const denoJson = JSON.parse( + read('deno.json') + .split('\n') + .filter((line) => !line.trim().startsWith('//')) + .join('\n'), +) as DenoManifest; describe('package publication metadata', () => { it('links npm provenance to the public GitHub repository', () => { @@ -40,3 +58,20 @@ describe('package publication metadata', () => { expect(packageJson.author).toBe('green-tea contributors '); }); }); + +// npm and JSR are published from the same tag but read their identity from different files, so the +// two can drift silently: bump package.json alone and the next release ships one version to npm and +// the previous one to JSR, under the same tag. Nothing else notices, which is why this is here. +describe('JSR manifest agrees with package.json', () => { + it('publishes the same package at the same version', () => { + expect(denoJson.name).toBe('@green-tea/core'); + expect(denoJson.version).toBe(packageJson.version); + expect(denoJson.license).toBe(packageJson.license); + }); + + // A reader following a docs example should not have to care which registry they installed from. + it('offers the same entry points npm does', () => { + const npmEntries = Object.keys(JSON.parse(read('package.json')).exports as Record); + expect(Object.keys(denoJson.exports ?? {})).toEqual(npmEntries); + }); +}); From 91f349bef73331462ba841456293a296f3f72974 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 12:59:45 -0500 Subject: [PATCH 07/46] ci: publish to JSR from the same tag that publishes to npm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The @green-tea scope is claimed and the package is linked to this repository on jsr.io, so the OIDC id-token the job already holds for npm Trusted Publishing authenticates JSR too — no new secret. Ordered around one asymmetry: npm allows an unpublish within 72 hours, JSR versions are immutable and can never be replaced. So JSR goes last, where a failure costs a re-run rather than a version number, and a dry run gates both before either ships — JSR checks slow types and module structure that npm never looks at, and finding that out mid-release leaves the tag half-shipped. Signed-off-by: Diego Resendez --- .github/workflows/release.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 733e6e4..5f72ed3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,8 +33,23 @@ jobs: # No NODE_AUTH_TOKEN — npm exchanges the OIDC id-token for a short-lived publish token. # A prerelease (26.7.0-beta.N) publishes under its channel tag (beta/alpha/rc) so `latest` # never points at a beta; a stable version publishes under `latest`. - - name: Publish + - uses: denoland/setup-deno@v2 + with: + deno-version: v2.x + # Gate both registries before either one ships. JSR checks things npm never looks at — slow + # types, module analysis — and learning about them after npm has published leaves the tag + # half-shipped. Seconds, against a failure mode with no clean recovery. + - run: deno publish --dry-run + - name: Publish to npmjs run: | TAG=$(node -e "const v=require('./package.json').version;const m=v.match(/-([a-z]+)/);console.log(m?m[1]:'latest')") echo "dist-tag: $TAG" npm publish --access public --tag "$TAG" + # JSR last, deliberately. npm allows an unpublish within 72 hours; JSR versions are immutable + # and can never be replaced or removed. Ordered so a failure here costs a re-run, while a + # failure *after* it would cost a version number permanently. Version and entry points come + # from deno.json, which `test/package-metadata.test.ts` pins to package.json — JSR has no + # dist-tags, so a prerelease simply publishes under its own version. Auth is the same OIDC + # id-token npm just used; the package is linked to this repository on jsr.io. + - name: Publish to JSR + run: deno publish From 085eb9a67d02737f93c7616487cfd115832477b4 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 13:03:09 -0500 Subject: [PATCH 08/46] fix(app): arm the shutdown timer before finish(), and make the deadline an app option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #20. finish() called clearTimeout(timer) from above the timer's own declaration. It worked because server.close(cb) always defers, so the assignment won the race — correct by timing, and a ReferenceError waiting in the shutdown path for whoever added a synchronous call site. The issue proposed hoisting a `let timer`, but prefer-const rejects that and is right to. Swapping the two blocks fixes it without a suppression and lands somewhere better: the surviving forward reference is the timer callback reaching finish(), and setTimeout not firing synchronously is the event loop rather than a library's current behaviour. Closes #19. The 10s deadline is now settable via createApp({ shutdownTimeoutMs }), with the per-call close({ timeoutMs }) still winning. close() is usually reached from a signal handler, a test helper or a shutdown hook you do not own, where passing it per call is not available. Nothing changes for anyone passing neither. The precedence test uses a 30s app-level default, so it can only pass if the per-call value took priority. Signed-off-by: Diego Resendez --- src/app/index.ts | 50 ++++++++++++++++++++++++++++++++---------------- test/app.test.ts | 44 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 17 deletions(-) diff --git a/src/app/index.ts b/src/app/index.ts index 8bbdd2a..df45a09 100644 --- a/src/app/index.ts +++ b/src/app/index.ts @@ -103,6 +103,13 @@ export function createApp(opts: { viewEngine?: (source: string, data: unknown) => string; /** Serve a static directory as a GET/HEAD fallback (after declared routes, before 404). `true` → `./public`. */ static?: boolean | string; + /** + * How long `close()` gives in-flight work before forcing remaining connections shut, in ms + * (default: 10s). `close({ timeoutMs })` still wins per call. Set it here when `close()` is + * reached from a signal handler, a test helper or a shutdown hook you do not own, which is + * where passing it per call is not an option. + */ + shutdownTimeoutMs?: number; /** Opt in to alpha features whose API may still change. Currently gates `mesh`. */ experimental?: boolean; /** @@ -260,7 +267,8 @@ export function createApp(opts: { return server; }; - const close = (options: { timeoutMs?: number } = {}): Promise => closeApp(server, meshLinks, streams, options); + const close = (options: { timeoutMs?: number } = {}): Promise => + closeApp(server, meshLinks, streams, options, opts.shutdownTimeoutMs); return { listen, @@ -950,6 +958,7 @@ function closeApp( meshLinks: Link[], streams: Set<() => void>, options: { timeoutMs?: number }, + defaultTimeoutMs: number | undefined, ): Promise { return new Promise((resolve) => { // A mesh app booted through `app.fetch` has links but no server, and would leak every @@ -967,9 +976,31 @@ function closeApp( return resolve(); } - const timeoutMs = options.timeoutMs ?? 10_000; + const timeoutMs = options.timeoutMs ?? defaultTimeoutMs ?? 10_000; let settled = false; + // The timer is armed before `finish` exists, rather than the other way round, and the ordering + // is the point. Whichever one comes second is referenced by the other before its declaration + // runs, so what matters is which forward reference rests on a guarantee. setTimeout cannot + // invoke its callback synchronously — that is the event loop, not an implementation detail — + // so `finish` is always assigned by the time the callback can reach it. The reverse ordering + // relied on `server.close(cb)` deferring, which is Node's behaviour rather than a promise to + // us, and left a `ReferenceError` waiting in the shutdown path for whoever changed it. + const timer = setTimeout(() => { + if (settled) return; + + console.warn( + `[green-tea] graceful shutdown timed out after ${timeoutMs}ms — ` + 'forcing remaining HTTP connections closed', + ); + + // closeAllConnections() requires Node >=18.2, same floor as closeIdleConnections() + // below — `engines` in package.json only guarantees >=18, so this matters. + server.closeAllConnections(); + finish(); + }, timeoutMs); + + timer.unref?.(); + const finish = () => { if (settled) return; settled = true; @@ -981,21 +1012,6 @@ function closeApp( for (const closeStream of streams) closeStream(); server.closeIdleConnections(); - - const timer = setTimeout(() => { - if (settled) return; - - console.warn( - `[green-tea] graceful shutdown timed out after ${timeoutMs}ms — ` + 'forcing remaining HTTP connections closed', - ); - - // closeAllConnections() requires Node >=18.2, same floor as closeIdleConnections() - // above — `engines` in package.json only guarantees >=18, so this matters. - server.closeAllConnections(); - finish(); - }, timeoutMs); - - timer.unref?.(); }); } diff --git a/test/app.test.ts b/test/app.test.ts index 02ff257..6e0400f 100644 --- a/test/app.test.ts +++ b/test/app.test.ts @@ -439,6 +439,28 @@ describe('devGraph endpoint', () => { }); describe('graceful shutdown', () => { + // A module whose only route never responds, so shutdown always has something in flight to give + // up on — the deadline is the only thing that can end close(). + const hangModule = () => { + @Route('/') + class Ctl { + @Get('/hang') hang() { + return new Promise(() => {}); + } + } + @Module({ mountpoint: '/', controllers: [Ctl] }) + class M {} + return M; + }; + + const listenHanging = async (app: ReturnType): Promise => { + const server = await app.listen(0); + const port = (server.address() as any).port; + fetch(`http://127.0.0.1:${port}/hang`).catch(() => {}); + await new Promise((r) => setTimeout(r, 50)); // let the request reach the handler + return port; + }; + it('app.close() stops accepting and resolves, even with an SSE stream open', async () => { @Route('/') class Ctl { @@ -485,6 +507,28 @@ describe('graceful shutdown', () => { await app.close({ timeoutMs: 300 }); expect(Date.now() - start).toBeLessThan(600); }); + + // The app-level default exists for the case where close() is reached from a signal handler or a + // test helper nobody local owns, so it has to work with close() called bare. + it('createApp({ shutdownTimeoutMs }) applies when close() is called with no options', async () => { + const app = createApp({ modules: [hangModule()], shutdownTimeoutMs: 300 }); + await listenHanging(app); + + const start = Date.now(); + await app.close(); + expect(Date.now() - start).toBeLessThan(600); + }); + + // The interesting half of the precedence rule: an app-level default long enough to fail this + // test if it won, so the assertion can only pass if the per-call value took priority. + it('close({ timeoutMs }) overrides the app-level default', async () => { + const app = createApp({ modules: [hangModule()], shutdownTimeoutMs: 30_000 }); + await listenHanging(app); + + const start = Date.now(); + await app.close({ timeoutMs: 300 }); + expect(Date.now() - start).toBeLessThan(600); + }); }); describe('overrides', () => { From 586e14da72132d92464e7fc7de1b17b5716c6116 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 13:16:24 -0500 Subject: [PATCH 09/46] feat(runtimes): a bounded close() on the Deno and Bun adapters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #15, taking the second of the two answers it framed: app.close() stays Node-only, and each transport that owns a handle offers the same close({ timeoutMs }). app.close() returns at its `if (!server)` guard on Deno and Bun because they serve through app.fetch and never through listen(), and only the transport can drain what it accepted. The warning there now names the replacement instead of pointing at this issue. The runtimes do not agree, and the code says so rather than averaging them: Bun escalates. stop(false) drains, stop(true) forces, and the deadline moves between them like Node's closeAllConnections(). Deno cannot. Its two levers are mutually exclusive — aborting the serve signal while shutdown() is pending throws BadResource from Deno's own listener, uncaught and fatal under deno test. Measured on 2.9: abort alone is clean, abort after shutdown is not. So on Deno the deadline bounds how long close() waits, not when connections die, and both the type and the timeout warning say that outright. Silently accepting an option that does less is the failure mode AGENTS.md rules out. closeWithDeadline is shared so the two cannot drift into different meanings of the same timeoutMs, and it resolves on its own timer rather than awaiting the force call — Bun's stop(true) was measured waiting out a handler with a pending timer, which is exactly the unbounded wait the deadline exists to prevent. serveDeno now owns the AbortController it serves with, chaining any caller signal into it so neither party loses control; a test covers that. The Bun ambient said stop() returns void, which was simply wrong. Signed-off-by: Diego Resendez --- src/app/index.ts | 9 ++++-- src/bun.ts | 35 ++++++++++++++++++-- src/deno.ts | 53 +++++++++++++++++++++++++++++-- src/http/shutdown.ts | 50 +++++++++++++++++++++++++++++ test/bun/shutdown.test.ts | 51 ++++++++++++++++++++++++++++++ test/deno/shutdown.test.ts | 65 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 256 insertions(+), 7 deletions(-) create mode 100644 src/http/shutdown.ts create mode 100644 test/bun/shutdown.test.ts create mode 100644 test/deno/shutdown.test.ts diff --git a/src/app/index.ts b/src/app/index.ts index df45a09..65ff8db 100644 --- a/src/app/index.ts +++ b/src/app/index.ts @@ -965,11 +965,16 @@ function closeApp( // teapot connection otherwise — so links close before we even check for a server. closeLinks(meshLinks); + // No server means the app is served through `app.fetch` rather than `listen()`, which is how + // Deno, Bun and the edge all run. Draining is the transport's job and only the transport holds + // the handle, so `close()` is deliberately Node-only here rather than pretending otherwise; + // `serveDeno`/`serveBun` return a server with the same bounded `close({ timeoutMs })`. if (!server) { if (options.timeoutMs !== undefined) { console.warn( - '[green-tea] close({ timeoutMs }) has no effect here — this app has no ' + - 'listen()ed server (Bun/Deno run through app.fetch). See #15.', + '[green-tea] close({ timeoutMs }) has no effect here — this app has no listen()ed ' + + 'server. On Deno and Bun, call close() on the server serveDeno()/serveBun() returned; ' + + 'it takes the same option. On the edge the platform owns the lifecycle.', ); } diff --git a/src/bun.ts b/src/bun.ts index cdb34c3..1824a5f 100644 --- a/src/bun.ts +++ b/src/bun.ts @@ -3,6 +3,7 @@ import type { Channel } from './channel'; import type { App } from './app/types'; import type { WsSocket, WsRequest } from './http/ws-core'; import { decodeMessage, neutralSocket, toWsRequest, upgradeSafely } from './http/ws-adapter'; +import { closeWithDeadline } from './http/shutdown'; // Minimal ambient for the Bun globals we use — avoids a @types/bun devDep. // Mirrors the real Bun.serve / server.upgrade / ServerWebSocket signatures we call. @@ -21,10 +22,25 @@ interface BunWebSocketHandler { } interface BunServer { port: number; - stop(closeActiveConnections?: boolean): void; + // Returns a promise, verified on Bun 1.3 — the previous `void` here was simply wrong, and it + // hid the fact that this is awaitable at all. + stop(closeActiveConnections?: boolean): Promise; upgrade(request: Request, options?: { data?: unknown; headers?: Record }): boolean; requestIP(request: Request): { address: string; family: string; port: number } | null; } + +/** + * What {@link serveBun} hands back: Bun's own server, plus the bounded `close()` that + * `app.close()` cannot provide here. `app.close()` returns at its `if (!server)` guard on Bun, + * because a Bun app is served through `app.fetch` and never through `listen()`. + */ +export interface BunServeResult extends BunServer { + /** + * Drains in-flight requests, then force-closes whatever is left after `timeoutMs` (default: + * 10s). Same meaning as `app.close({ timeoutMs })` on Node. + */ + close(options?: { timeoutMs?: number }): Promise; +} interface BunServeOptions { port?: number; hostname?: string; @@ -59,8 +75,8 @@ function bunSocket(ws: BunServerWebSocket): WsSocket { * Bun.serve exposes no equivalent to Node's server.maxConnections; enforce connection caps at * the deployment platform or reverse proxy. */ -export function serveBun(app: App, options?: BunServeShortOptions): BunServer { - return Bun.serve({ +export function serveBun(app: App, options?: BunServeShortOptions): BunServeResult { + const server = Bun.serve({ ...options, fetch(request, server) { if (request.headers.get('upgrade')?.toLowerCase() === 'websocket') { @@ -97,4 +113,17 @@ export function serveBun(app: App, options?: BunServeShortOptions): BunServer { }, }, }); + + // Object.assign rather than a fresh object: Bun.serve returns more than the ambient above + // declares (reload, ref, unref, …), and rebuilding would silently drop whatever we did not name. + return Object.assign(server, { + close: (closeOptions: { timeoutMs?: number } = {}): Promise => + closeWithDeadline( + () => server.stop(false), + () => void server.stop(true), + closeOptions.timeoutMs ?? 10_000, + (ms) => + console.warn(`[green-tea] graceful shutdown timed out after ${ms}ms — forcing remaining connections closed`), + ), + }); } diff --git a/src/deno.ts b/src/deno.ts index 12a3809..cd9574a 100644 --- a/src/deno.ts +++ b/src/deno.ts @@ -1,5 +1,6 @@ import type { App } from './app/types'; import { eventSocket, toWsRequest, upgradeSafely, type EventfulSocket } from './http/ws-adapter'; +import { closeWithDeadline } from './http/shutdown'; // The project tsconfig's `lib` doesn't include `DOM`, and the installed `@types/node` (18.x) // doesn't declare a global `WebSocket` either — so we ambient-declare just the shape we use. @@ -22,6 +23,23 @@ interface DenoHttpServer { finished: Promise; shutdown(): Promise; } + +/** + * What {@link serveDeno} hands back: Deno's own server, plus the bounded `close()` that + * `app.close()` cannot provide here. `app.close()` returns at its `if (!server)` guard on Deno, + * because a Deno app is served through `app.fetch` and never through `listen()`. + */ +export interface DenoServer extends DenoHttpServer { + /** + * Drains in-flight requests, returning after at most `timeoutMs` (default: 10s). + * + * **The deadline bounds the wait, not the connections** — unlike Node's `app.close()` and Bun's + * `close()`, which force the remainder shut. Deno offers no force-close that composes with a + * drain already under way: aborting the serve signal at that point throws `BadResource` from + * Deno's own listener, uncaught. Whatever is still open when this resolves ends with the process. + */ + close(options?: { timeoutMs?: number }): Promise; +} type DenoServeHandler = (request: Request, info: DenoServeHandlerInfo) => Response | Promise; declare const Deno: { serve(options: DenoServeOptions, handler: DenoServeHandler): DenoHttpServer; @@ -34,8 +52,14 @@ declare const Deno: { * Deno.serve exposes no equivalent to Node's server.maxConnections; enforce connection caps at * the deployment platform or reverse proxy. */ -export function serveDeno(app: App, options?: DenoServeOptions): DenoHttpServer { - return Deno.serve(options ?? {}, (request, info) => { +export function serveDeno(app: App, options?: DenoServeOptions): DenoServer { + // Deno's only force-close lever is the abort signal it was served with, so the adapter has to + // own one to offer a deadline at all. A caller-supplied signal still works and still aborts the + // server — it is chained into ours rather than replaced, so neither party loses its control. + const ac = new AbortController(); + options?.signal?.addEventListener('abort', () => ac.abort(), { once: true }); + + const server = Deno.serve({ ...options, signal: ac.signal }, (request, info) => { if (request.headers.get('upgrade')?.toLowerCase() === 'websocket') { // Deno invalidates request connection metadata as soon as the upgrade is accepted. const wsRequest = toWsRequest(request, info.remoteAddr.hostname); @@ -48,4 +72,29 @@ export function serveDeno(app: App, options?: DenoServeOptions): DenoHttpServer return app.fetch(request); }); + + // Object.assign rather than a fresh object: Deno.serve returns more than the ambient above + // declares (addr, ref, unref, …), and rebuilding would silently drop whatever we did not name. + return Object.assign(server, { + close: (closeOptions: { timeoutMs?: number } = {}): Promise => + closeWithDeadline( + () => server.shutdown(), + // Nothing to force, and that is Deno's constraint rather than an omission here. Its two + // levers are mutually exclusive: aborting the serve signal after `shutdown()` is already + // pending throws `BadResource: Bad resource ID` from Deno's own abort listener, which + // surfaces uncaught — not catchable at this call site, and fatal under `deno test`. + // Measured on Deno 2.9: abort alone is clean, abort after shutdown is not. So Deno cannot + // escalate from graceful to forced the way Node's closeAllConnections() and Bun's + // stop(true) can, and the deadline here bounds how long `close()` waits, not when the + // connections die. Exiting the process after `close()` resolves is what ends them. + () => {}, + closeOptions.timeoutMs ?? 10_000, + (ms) => + console.warn( + `[green-tea] graceful shutdown timed out after ${ms}ms — returning anyway. Deno cannot ` + + 'force-close a server that is already draining, so remaining connections end when the ' + + 'process does.', + ), + ), + }); } diff --git a/src/http/shutdown.ts b/src/http/shutdown.ts new file mode 100644 index 0000000..3bb4af2 --- /dev/null +++ b/src/http/shutdown.ts @@ -0,0 +1,50 @@ +/** + * Bounds a graceful shutdown by a deadline, forcing whatever is left. + * + * Shared by the Deno and Bun adapters so the two cannot drift into different meanings of the same + * `timeoutMs`, and shaped like the Node path in `closeApp`: try to drain, and if the deadline + * passes first, force the remainder and resolve anyway. + * + * The race is the point, and it is not paranoia. Both runtimes' force calls were measured against + * a handler that never resolves and returned immediately, but `Bun.stop(true)` was also measured + * waiting out a handler with a pending timer — same call, ~2s, because it awaits pending async + * work rather than only open connections. Awaiting the force call would therefore inherit exactly + * the unbounded wait the deadline exists to prevent. Resolving on our own timer means `close()` + * returns within `timeoutMs` whatever either runtime decides to wait for. + * + * @param graceful Drain in flight work. Unbounded — that is what the deadline is for. + * @param force Stop waiting and drop what is left. Fire-and-forget; its promise is not awaited. + */ +export function closeWithDeadline( + graceful: () => Promise, + force: () => void, + timeoutMs: number, + onTimeout?: (timeoutMs: number) => void, +): Promise { + return new Promise((resolve) => { + let settled = false; + + // Armed before `finish` exists, and deliberately: setTimeout cannot invoke its callback + // synchronously, so `finish` is always assigned by the time this can reach it. The reverse + // ordering would rest on when the runtime's own promise settles. Mirrors `closeApp`. + const timer = setTimeout(() => { + if (settled) return; + onTimeout?.(timeoutMs); + force(); + finish(); + }, timeoutMs); + + timer.unref?.(); + + const finish = (): void => { + if (settled) return; + settled = true; + clearTimeout(timer); + resolve(); + }; + + // A graceful path that rejects still has to end the shutdown: the deadline covers a slow + // close, not a broken one, and leaving close() pending forever is the worse failure. + void graceful().then(finish, finish); + }); +} diff --git a/test/bun/shutdown.test.ts b/test/bun/shutdown.test.ts new file mode 100644 index 0000000..f0fc33a --- /dev/null +++ b/test/bun/shutdown.test.ts @@ -0,0 +1,51 @@ +// Real Bun integration test for the bounded close() serveBun returns. app.close() cannot do this +// job on Bun — it returns at its `if (!server)` guard, because a Bun app is served through +// app.fetch and never through listen() — so the deadline lives on the transport that owns the +// handle. See issue #15. +// +// Run with: npm run test:bun (or: bun test test/bun/) +import 'reflect-metadata'; +import { test, expect } from 'bun:test'; +import { createApp, Route, Get, Module } from '../../src/index.ts'; +import { serveBun } from '../../src/bun.ts'; + +@Route('/') +class Ctl { + @Get('/hang') + hang() { + return new Promise(() => {}); // never resolves — a stuck handler + } + @Get('/slow') + async slow() { + await Bun.sleep(200); // finite, so draining has something real to wait out + return { ok: true }; + } +} +@Module({ mountpoint: '/', controllers: [Ctl] }) +class M {} + +test('serveBun close({ timeoutMs }) gives up on a stuck handler and resolves', async () => { + const server = serveBun(createApp({ modules: [M] }), { port: 0 }); + + fetch(`http://127.0.0.1:${server.port}/hang`).catch(() => {}); + await Bun.sleep(50); // let the request actually reach the handler + + const start = Date.now(); + await server.close({ timeoutMs: 300 }); + const elapsed = Date.now() - start; + + // The assertion that matters is the upper bound: without the deadline this never returns. + expect(elapsed).toBeLessThan(2000); + expect(elapsed).toBeGreaterThanOrEqual(250); +}); + +test('serveBun close() drains an in-flight request rather than cutting it', async () => { + const server = serveBun(createApp({ modules: [M] }), { port: 0 }); + + const inFlight = fetch(`http://127.0.0.1:${server.port}/slow`).then((r) => r.json()); + await Bun.sleep(50); // the request must be *in* the handler before we close, or it never got in + + await server.close({ timeoutMs: 5000 }); + + expect(await inFlight).toEqual({ ok: true }); +}); diff --git a/test/deno/shutdown.test.ts b/test/deno/shutdown.test.ts new file mode 100644 index 0000000..8cee2da --- /dev/null +++ b/test/deno/shutdown.test.ts @@ -0,0 +1,65 @@ +// Real Deno integration test for the bounded close() serveDeno returns. app.close() cannot do this +// job on Deno — it returns at its `if (!server)` guard, because a Deno app is served through +// app.fetch and never through listen() — so the deadline lives on the transport that owns the +// handle. See issue #15. +// +// Run with: npm run test:deno +import 'reflect-metadata'; +import { createApp, Route, Get, Module } from '../../src/index.ts'; +import { serveDeno } from '../../src/deno.ts'; + +@Route('/') +class Ctl { + @Get('/hang') + hang() { + return new Promise(() => {}); // never resolves — a stuck handler + } + @Get('/slow') + async slow() { + await new Promise((r) => setTimeout(r, 200)); // finite, so draining has something real to wait out + return { ok: true }; + } +} +@Module({ mountpoint: '/', controllers: [Ctl] }) +class M {} + +const portOf = (server: { addr?: { port: number } }): number => server.addr!.port; + +// On Deno the deadline bounds the wait, not the connections — see the comment on serveDeno's +// force callback. This test asserts exactly that: close() returns on time, and does so without +// the uncaught BadResource that aborting a draining server produces. The test runner fails on +// that error even when the assertions pass, so a green run here is the real assertion. +Deno.test('serveDeno close({ timeoutMs }) returns on a stuck handler without forcing', async () => { + const server = serveDeno(createApp({ modules: [M] }), { port: 0, onListen: () => {} }); + + fetch(`http://127.0.0.1:${portOf(server)}/hang`).catch(() => {}); + await new Promise((r) => setTimeout(r, 50)); // let the request actually reach the handler + + const start = Date.now(); + await server.close({ timeoutMs: 300 }); + const elapsed = Date.now() - start; + + // The assertion that matters is the upper bound: without the deadline this never returns. + if (elapsed >= 2000) throw new Error(`close() took ${elapsed}ms — the deadline did not fire`); + if (elapsed < 250) throw new Error(`close() returned in ${elapsed}ms — it did not wait the deadline`); +}); + +Deno.test('serveDeno close() drains an in-flight request rather than cutting it', async () => { + const server = serveDeno(createApp({ modules: [M] }), { port: 0, onListen: () => {} }); + + const inFlight = fetch(`http://127.0.0.1:${portOf(server)}/slow`).then((r) => r.json()); + await new Promise((r) => setTimeout(r, 50)); // must be *in* the handler before we close + + await server.close({ timeoutMs: 5000 }); + + const body = await inFlight; + if (body.ok !== true) throw new Error(`in-flight request was cut: ${JSON.stringify(body)}`); +}); + +Deno.test('a caller-supplied signal still aborts the server', async () => { + const ac = new AbortController(); + const server = serveDeno(createApp({ modules: [M] }), { port: 0, signal: ac.signal, onListen: () => {} }); + + ac.abort(); + await server.finished; // hangs here if chaining the caller's signal into ours dropped it +}); From e4a2047a1e183d437180f4bc0a6ffd1eb05b339c Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 13:17:19 -0500 Subject: [PATCH 10/46] docs: describe the shutdown deadline, and who owns it per runtime MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #18. The three places that still described close() without a timeout — the createapp reference table, the README bullet and the dependency-injection inline comment — now say that in-flight work gets 10 seconds, then a warning and a force-close. Also documents what #18 deliberately deferred, now that #15 has decided it. runtimes.md gains the per-runtime story: app.close() is Node-only, the servers serveDeno()/serveBun() return carry the same close({ timeoutMs }), and edge has nothing to close. Including the row that matters — Node and Bun cut the remainder after the deadline, Deno returns and lets the process end it — since a deadline that means two things is worse than one that admits it. createApp({ shutdownTimeoutMs }) from #19 gets its row in the options table. Signed-off-by: Diego Resendez --- README.md | 2 +- .../docs/guides/dependency-injection.md | 3 ++- website/src/content/docs/guides/runtimes.md | 26 +++++++++++++++++++ .../src/content/docs/reference/createapp.md | 3 ++- 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cb5fa76..fa20e91 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ Beta shipped the parts a real API needs, without growing the runtime dependency - **Errors, your way.** Throw typed errors (`Unauthorized`, `NotFound`, `HttpError(status, msg, body?)`) anywhere; they convert centrally to `4xx`/`5xx`. Render them however you like — HTML, RFC 7807, content-negotiated — with a single `createApp({ onError })` hook that covers every error response. - **HTML without a view layer.** `@Html` returns a string, serves a file, or renders one with the built-in `{{ }}` template engine — swap in EJS or handlebars with `createApp({ viewEngine })`. `createApp({ static: true })` serves `./public` with path-traversal guards and no mime dependency. - **Ceilings that are already on.** `limits` caps body size (`413`), multipart parts, concurrent Node connections (default `1000`; `<= 0` leaves connections unlimited), and the request / headers / keep-alive timeouts — defaulting to `30s` / `10s` / `5s`, tighter than Node's own two-minute default. When Node's connection cap is reached, excess sockets are destroyed without an HTTP response. Deno and Bun expose no equivalent active-socket cap, so enforce one at the deployment platform or reverse proxy there. Configurable, and safe before you configure anything. -- **Graceful shutdown.** `app.close()` drains in-flight requests, closes live streams and mesh links. +- **Graceful shutdown, with a deadline.** `app.close()` drains in-flight requests and closes live streams and mesh links, then warns and force-closes whatever is still open after 10 seconds — so a stuck handler cannot hold a deploy open forever. Change the number per call with `close({ timeoutMs })` or for the whole app with `createApp({ shutdownTimeoutMs })`. `app.close()` is Node-only; on Deno and Bun the server `serveDeno()`/`serveBun()` returns carries the same `close({ timeoutMs })`. - **Testable by construction.** `createApp({ overrides: { db: fakeDb } })` swaps any node in one line. - **Dual ESM + CommonJS.** Ships both builds behind an `exports` map — `import` and `require` both resolve, with matching type declarations. diff --git a/website/src/content/docs/guides/dependency-injection.md b/website/src/content/docs/guides/dependency-injection.md index 06dacaf..9382bc2 100644 --- a/website/src/content/docs/guides/dependency-injection.md +++ b/website/src/content/docs/guides/dependency-injection.md @@ -53,7 +53,8 @@ const app = createApp({ modules: [ApiModule] }); await app.listen(3000); // GET /api/users/9 (header x-token) → { "requested": "9", "you": { "id": "...", "name": "Diego" } } -await app.close(); // graceful shutdown: drains in-flight requests, closes streams + mesh links +await app.close(); // graceful shutdown: drains in-flight, closes streams + mesh links, + // then force-closes whatever is left after 10s — app.close({ timeoutMs }) ``` ## `@Provider` — app-scope, memoized diff --git a/website/src/content/docs/guides/runtimes.md b/website/src/content/docs/guides/runtimes.md index 75e972d..c790da8 100644 --- a/website/src/content/docs/guides/runtimes.md +++ b/website/src/content/docs/guides/runtimes.md @@ -41,6 +41,32 @@ destroys excess sockets without sending an HTTP response. `Deno.serve` and `Bun. equivalent active-socket cap, so `serveDeno` and `serveBun` cannot enforce this option. Apply the connection limit at the deployment platform or reverse proxy on those runtimes. +**Shutdown belongs to whoever owns the server.** `app.close()` is Node-only. On Deno and Bun the +app is served through `app.fetch` and never through `app.listen()`, so `app.close()` has no server +to drain and returns immediately — it warns if you passed `timeoutMs`. The server `serveDeno()` and +`serveBun()` return carries the same `close({ timeoutMs })` instead: + +```ts +const server = serveBun(app, { port: 3000 }); // or serveDeno(app, { port: 3000 }) +await server.close({ timeoutMs: 5_000 }); +``` + +On Cloudflare Workers there is nothing to close: `edgeHandler` is a handler, not a server, and the +platform owns the lifecycle. + +One difference the deadline cannot hide: + +| Runtime | After the deadline | +|---|---| +| Node | warns, then `closeAllConnections()` — the remainder is cut | +| Bun | warns, then `stop(true)` — the remainder is cut | +| Deno | warns, then **returns anyway**; the remainder ends with the process | + +Deno offers no force-close that composes with a drain already under way — aborting the signal its +server was started with throws `BadResource` once `shutdown()` is pending. So on Deno the deadline +bounds how long `close()` waits, not when the connections die. Exit the process after `close()` +resolves and the effect is the same; keep serving and it is not. + **Body-size enforcement differs slightly:** on `app.fetch`, an oversized body is read in full before the `413` is returned, whereas Node aborts mid-stream once the limit is hit — so on non-Node runtimes, also bound request size at the platform/runtime layer. diff --git a/website/src/content/docs/reference/createapp.md b/website/src/content/docs/reference/createapp.md index c8f9109..77726c0 100644 --- a/website/src/content/docs/reference/createapp.md +++ b/website/src/content/docs/reference/createapp.md @@ -26,6 +26,7 @@ const app = createApp(options); | `views` | `string` | `process.cwd()` | base dir `@Html('file.html')` paths resolve against — relative paths join it, absolute paths are used as-is ([HTML & views](/docs/guides/html/)) | | `viewEngine` | `(source: string, data: unknown) => string` | built-in `render` | swap in your own template engine for `@Html(..., { template: true })`; template mode only ([HTML & views](/docs/guides/html/)) | | `static` | `boolean \| string` | — | serve a directory as a `GET`/`HEAD` fallback (after declared routes, before `404`); `true` → `./public`, a string → that dir; path-traversal-safe; needs a filesystem — Node/Deno/Bun only ([HTML & views](/docs/guides/html/)) | +| `shutdownTimeoutMs` | `number` | `10_000` | how long `close()` gives in-flight work before forcing the rest shut; `close({ timeoutMs })` still wins per call. Set it here when `close()` is reached from a signal handler or shutdown hook you do not own ([runtimes](/docs/guides/runtimes/)) | | `mesh` | `MeshConfig` | — | distributed DI — **requires `experimental: true`** ([mesh](/docs/guides/mesh/)) | | `experimental` | `boolean` | `false` | opt in to alpha features (currently gates `mesh`) | | `warnGraphDepth` | `number \| false` | `20` | warn when one route resolves to more than this many steps; `false` disables the design warning | @@ -64,7 +65,7 @@ const app = createApp(options); | Member | Returns | Notes | |---|---|---| | `listen(port)` | `Promise` | boots providers, then serves | -| `close()` | `Promise` | drains in-flight, closes streams + mesh links | +| `close({ timeoutMs? })` | `Promise` | drains in-flight, closes streams + mesh links; after the deadline (default `10s`, or `createApp({ shutdownTimeoutMs })`) it warns and force-closes what is left. Node-only — see [runtimes](/docs/guides/runtimes/) | | `ready()` | `Promise` | resolves the graph and mesh links without booting providers | | `fetch(request)` | `Promise` | Web-Standards HTTP/SSE handler for Node, Deno, Bun, and edge | | `upgrade(request, socket)` | `Promise` | neutral WebSocket upgrade used by non-Node adapters | From f97ac8098b343e61dd652d57772b00aa0b631c5b Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 13:18:06 -0500 Subject: [PATCH 11/46] docs(plans): record the #15 decision and split out shutdown extensibility The plan asked Task 2.3 to decide between two answers; the decision and what the runtimes actually allow now sit in it, so the next reader is not re-deriving either. The Deno constraint in particular was found by measurement and is not in any issue. Adds Task 2.5 for the plugin/provider teardown idea, kept out of the #15 work on purpose: it needs a new await-aware surface on PluginApi, because the existing Bus is a synchronous observer by design and cannot be made to hold up a shutdown without losing the guarantee that makes it safe. Signed-off-by: Diego Resendez --- docs/plans/2026-08-16-trust-release-plan.md | 24 ++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/docs/plans/2026-08-16-trust-release-plan.md b/docs/plans/2026-08-16-trust-release-plan.md index 2579db2..ecacc51 100644 --- a/docs/plans/2026-08-16-trust-release-plan.md +++ b/docs/plans/2026-08-16-trust-release-plan.md @@ -140,11 +140,29 @@ The 10s deadline is hardcoded. Make it configurable at app level, with `close({ Per `AGENTS.md:81`, a new option on a public interface **must** also change `src/app/types.ts`. An implementation that grows a parameter alone is unreachable for anyone consuming the package. -### Task 2.3: #15 — graceful shutdown is Node-only +### Task 2.3: #15 — graceful shutdown is Node-only — **DECIDED, DONE** -Decide and implement: either the Fetch adapters honour the deadline, or `close()` says plainly that they do not. +**Decision: `app.close()` stays Node-only; each adapter that owns a server offers the same `close({ timeoutMs })`.** The framework's line is *it handles architecture, you handle business*, and draining is owned by whoever holds the handle. -`AGENTS.md:82` governs the fallback: behaviour that differs between runtimes must be explicit. An "unavailable here" is fine; silently accepting an option that does nothing is a bug. Follow the precedent already set for `maxConnections` at `runtimes.md:37`, `src/bun.ts:59` and `src/deno.ts:34`, where the project documented the runtime gap rather than faking parity. +What the runtimes turned out to allow, measured rather than assumed: + +| Runtime | Drain | After the deadline | +|---|---|---| +| Node | `server.close()` | `closeAllConnections()` — remainder cut | +| Bun | `stop(false)` | `stop(true)` — remainder cut | +| Deno | `shutdown()` | **returns anyway** — remainder ends with the process | + +Deno cannot escalate. Aborting the serve signal while `shutdown()` is pending throws `BadResource: Bad resource ID` from Deno's own listener — uncaught, and fatal under `deno test`. Measured on Deno 2.9: abort alone is clean, abort after shutdown is not. So on Deno the deadline bounds how long `close()` waits, not when connections die, and `runtimes.md` says so in a table rather than averaging the three. + +`closeWithDeadline` (`src/http/shutdown.ts`) is shared so the two adapters cannot drift into different meanings of the same `timeoutMs`, and it resolves on its own timer rather than awaiting the force call — Bun's `stop(true)` was measured waiting out a handler with a pending timer, which is the unbounded wait the deadline exists to prevent. + +### Task 2.5: Shutdown as an extension point — **OPEN, needs its own design** + +Raised while deciding #15: shutdown should emit signals so plugins and providers register their own teardown, instead of every consumer writing `process.on('SIGTERM', …)` by hand. Same principle as the decision above — the framework owns the plumbing. + +It does **not** fit the existing `Bus`, and that is the finding worth carrying forward. `Bus.on` takes a synchronous listener (`src/bus.ts:29`) and `emit` neither awaits nor surfaces failures (`src/bus.ts:38`, `catch {}`). That is deliberate — observers must never break the pipeline — but a plugin closing a database connection needs shutdown to *wait for it*. Registering a teardown is not observing an event, and bending `Bus` to do both would cost the guarantee that makes it safe. + +So it needs: an await-aware teardown registry, a new surface on `PluginApi` (public API — `src/plugin.ts:19`), and a decision about provider cleanup. That is Trust Release §14 "Graceful lifecycle guarantees" and CTO P0-4, and it belongs in a design document rather than inside a bug-fix cluster. Sequence it with Phase 3, whose observability contract shares the same lifecycle vocabulary. ### Task 2.4: #18 — docs still describe `close()` without the timeout From 8c3844e577ad0f93c1b4147912c63a18a71cc48f Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 13:27:36 -0500 Subject: [PATCH 12/46] docs(plans): design the observability contract for #10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The issue says green-tea ships no logging, metrics or tracing contract. The mechanism is actually already there — Bus has 19 emission points across boot, pipeline, streams, mesh and plugins, and plugins already subscribe to it. What is missing is narrower and worse: no event carries request identity, so under concurrency step events cannot be attributed; durationMs is declared in the payload and written by nothing; there are no request-level events for step events to hang from; and a failing step reports as name: 'pipeline'. That reframes the work. A logger, a metrics exporter and an OpenTelemetry bridge are not three features, they are three consumers of one corrected event stream — which is a sharper reason for #10's 'one design, not six' than the issue had, and it puts most of the work in bus.ts and pipeline.ts rather than in new files. Five decisions settled with their reasoning, including why the logger cannot be an ordinary provider (it must outlive the graph to report the graph failing to boot) and why route labels carry the pattern rather than the URL (a metrics consumer labelling on raw paths takes down the backend, not the app). Three questions left open for review rather than answered alone, the sharpest being where a request span ends on a streaming route — the same boundary #21 hit, which should be answered once for both. Signed-off-by: Diego Resendez --- docs/plans/2026-08-16-observability-design.md | 140 ++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 docs/plans/2026-08-16-observability-design.md diff --git a/docs/plans/2026-08-16-observability-design.md b/docs/plans/2026-08-16-observability-design.md new file mode 100644 index 0000000..69e90df --- /dev/null +++ b/docs/plans/2026-08-16-observability-design.md @@ -0,0 +1,140 @@ +# Observability — Design + +**Issue:** [#10](https://github.com/Expressive-Tea/green-tea/issues/10) · **Status:** design, not yet implemented · **Constraint:** no new runtime dependency + +--- + +## The diagnosis is not the one in the issue + +#10 says green-tea "ships no logging, metrics or tracing contract today", and asks for an injectable logger, structured output, tracing hooks and metrics as one design. The framing is right; the starting point is wrong, and it changes what the work is. + +**The mechanism already exists.** `Bus` (`src/bus.ts`) is an in-process event emitter with 19 emission points already wired through boot, the pipeline, streams, WebSockets, mesh and plugins. Plugins already receive `bus.on` — and only `on`, so isolation is structural (`src/plugin.ts:27`). + +What is actually missing is narrower and more serious than "there is no logger": + +| # | Finding | Where | +|---|---|---| +| 1 | **No event carries request identity.** Under any concurrency, interleaved `request:step:enter` events cannot be attributed to a request. | `src/pipeline.ts:53,56` | +| 2 | **`durationMs` is declared and never set by anything.** There is no timing in the system at all. | `src/bus.ts:22`, zero writers | +| 3 | **No request-level events exist.** No `started`/`completed`/`failed`, so there is no span for step events to hang from. | — | +| 4 | **A failing step is reported as `name: 'pipeline'`**, losing which step broke. | `src/pipeline.ts:98` | +| 5 | **8 `console.warn` calls in core**, unredirectable. | `src/app/index.ts` ×6, `src/deno.ts`, `src/bun.ts` | + +So the real statement of the problem is: + +> The event stream exists but is **not correlatable and not measured**, which makes it unusable for production observability regardless of what consumes it. + +That is *why* #10 is one design and not six — a sharper reason than the issue had. A logger, a metrics exporter and an OpenTelemetry bridge are not three features; they are three **consumers of one corrected event stream**. Fix correlation and timing once, and all three become adapters outside core. Ship them separately and each grows its own private notion of "which request was that", which is the three-mechanisms failure #10 warned about. + +**Consequence for sequencing:** most of this work is in `src/bus.ts` and `src/pipeline.ts`, not in new files. + +--- + +## Decisions + +### D1 — The logger is a distinct registration, not an ordinary provider + +`createApp({ logger })`, not `@Provider({ provides: 'logger' })`. + +The deciding constraint is ordering. `boot:provider:start`/`fail` fire *while* the graph is booting (`src/app/index.ts:639-647`), and the optional-provider failure warning at `src/app/index.ts` logs during that same phase. A provider cannot log its own boot failure, and a logger that only exists after the graph resolves cannot report the graph failing to resolve. Shutdown has the same shape: `closeApp` warns after the graph is gone. + +The logger is therefore framework infrastructure with a lifetime wider than the graph. + +It is *additionally* exposed as an injectable key so steps and handlers reach it with `@needs('logger')` like anything else. One object, two access paths, no second implementation. + +**Default:** structured JSON. Human-readable when the process is interactive, decided once at boot rather than per call. **Never a dependency** — the default writes to `console` behind the same interface everyone else implements, which is what lets the 8 direct `console.warn` calls become logger calls without core gaining a logging library. + +### D2 — One emitter. Extend `Bus`; do not add a parallel hook system + +Per-category hooks would be a second mechanism competing with an emitter that already has 19 call sites and a plugin contract built on it. `LifecycleEvent` grows; nothing new is introduced. + +This also keeps the existing guarantee intact: `emit` swallows listener failures (`src/bus.ts:41`) precisely so observers can never break the pipeline. Observability must not acquire the power to take down a request. + +**This is exactly why shutdown teardown does not belong here** — see Task 2.5 in the trust-release plan. A teardown must be *awaited*; an observer must not be. Same word, opposite guarantees, so they get different surfaces. + +### D3 — A step failure emits both `request:step:error` and `request:failed` + +They answer different questions — *which step broke* and *did this request fail* — and a tracing exporter needs both: one marks the span, the other marks the trace. Emitting only the outer event is what produces a trace that says a request failed with no indication where. + +`request:step:error` must also carry the real step name. Emitting `name: 'pipeline'` (`src/pipeline.ts:98`) is a bug, not a design choice, and it is fixed as part of this. + +### D4 — Streams and WebSockets emit lifecycle events only, never per-message + +`stream:open`/`close`/`error` already exist and are the right granularity. A per-message event on a high-rate SSE or WebSocket stream is a firehose that costs more than it reports, and the cost lands on the workload least able to absorb it. + +Anyone who needs per-message visibility instruments their own handler, where they know the message semantics. Same reasoning that keeps WebSocket upgrades outside the concurrency gate in #21. + +### D5 — Request identity is generated with `crypto.randomUUID()`, and inherited when offered + +No new dependency is available, so no UUID library. `globalThis.crypto.randomUUID` is present on Node, Deno and Bun (verified locally) and is Web Crypto on workerd. + +**To validate during implementation:** Node 18 is the floor in `package.json` and CI's `build` job pins `node-version: '18'`, so a gap there fails CI rather than reaching a user. `test:edge` covers workerd the same way. + +An incoming `x-request-id` is adopted rather than replaced — a green-tea service behind a gateway must not start a second identity for the same request. A `traceparent` header, if present, is carried as `traceId` untouched; core parses nothing and implements no propagation spec. That belongs in the OpenTelemetry adapter, which owns W3C Trace Context. + +--- + +## The contract + +### Events + +Existing, unchanged in name: `boot:provider:start|ok|fail`, `request:step:enter|leave|error`, `stream:open|close|error`, `mesh:connect|disconnect|rpc:error`, `plugin:mounted`. + +Added: + +``` +request:start request:end request:failed +route:matched route:unmatched +graph:resolved graph:failed +``` + +`route:unmatched` rather than the report's `route.not_found`: a 405 is also an unmatched route and is not a 404, and naming the event after one outcome would misreport the other. + +### Payload + +`EventPayload` gains the correlation and measurement fields it lacks. Every field stays optional — mesh and boot events have no request to name, and forcing a shape on them would mean inventing values. + +```ts +interface EventPayload { + name: string; + scope?: string; + error?: unknown; + durationMs?: number; // declared today, written by nothing — this design makes it real + requestId?: string; // the correlation fix + traceId?: string; // inherited from traceparent when present; never synthesized + route?: string; // the matched pattern, not the raw URL — bounded cardinality for metrics + method?: string; + transport?: Transport; + status?: number; + runtime?: 'node' | 'deno' | 'bun' | 'edge'; +} +``` + +`route` is the **pattern** (`/users/:id`), never the concrete path. A metrics consumer that labels a counter with the raw URL produces unbounded cardinality and takes down the metrics backend rather than the app — the framework should not hand a user that shape by default. + +### Metrics + +No metrics registry in core, and no new event type for them. Per-step timings come from `durationMs` on the events already defined; a metrics adapter subscribes and aggregates. The graph already knows every node, which is what makes this close to free — but the timing instrumentation is measured before it is declared free, per Trust Release §6, and stays opt-in if the measurement says otherwise. + +--- + +## Out of scope, deliberately + +- **OpenTelemetry itself.** A separate `@green-tea/opentelemetry` package. Core exposes the stream; it never imports an exporter, and never depends on one. +- **Log shipping, sampling, redaction.** Consumer concerns. Core hands over structured records. +- **Trace context propagation.** Carried, not parsed. The adapter owns W3C Trace Context. +- **Shutdown teardown for plugins/providers.** Task 2.5, a different guarantee — see D2. + +--- + +## Open questions for review + +1. **Is `request:start`/`end` the right boundary on a streaming route?** A stream returns from `handle()` long before it finishes. Ending the request span at return means an SSE connection reports as a 2 ms request; ending it at stream close means an hour-long request. The same split #21 hit with its concurrency gate, and it should be answered the same way in both places rather than differently. +2. **Does `runSteps` measure per step, or only the pipeline total?** Per step is what makes the graph's timing story real, and it is `performance.now()` twice per step on the hot path. Benchmark before committing, `npm run bench` is already there. +3. **Does the logger receive events, or do events feed the logger?** If the default logger is just a Bus subscriber, request logging is composable exactly as #10 asks ("a composable step, not a global middleware") and there is only one path. If it is separate, there are two. Leaning subscriber; wants a second opinion. + +--- + +## Verification this design must survive + +`npm run lint && npm run format:check && npm run typecheck && npm test`, plus `test:deno`, `test:bun` and `test:edge` — all four now gate a merge. Per-request instrumentation is on the hot path, so `npm run bench` before and after, with the numbers in the implementation plan. From d324ecfcb48a50561fc30594506ceae9789d0340 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 14:06:51 -0500 Subject: [PATCH 13/46] docs(plans): settle the three open questions in the observability design MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit D6: a request span ends when the handler returns, and stream events carry its requestId. Ending it at stream close would mix 2ms buffered requests with hour-long SSE connections in one latency distribution; connection duration is already readable from stream:open/close once they can be joined. Same boundary #21 chose for its concurrency gate — the framework should not disagree with itself about when a request is over. D7: per-step timing is always on. Measured rather than argued: performance.now() at step boundaries costs 25.2ns per step against a 10.19us request, or 0.25% — below the 0.3% run-to-run CV of the project's own benchmark. A flag would buy two code paths for something the harness cannot detect. The measurement also settles Date.now(), which is both slower (28.6ns) and coarser. D8: request logging is a Bus subscriber, wrapped to fall back to console. One path, composable as #10 asks, and the wrapper closes the hole that emit() swallows listener failures by design — the Bus keeps its guarantee without buying it with silence. Signed-off-by: Diego Resendez --- docs/plans/2026-08-16-observability-design.md | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/docs/plans/2026-08-16-observability-design.md b/docs/plans/2026-08-16-observability-design.md index 69e90df..bcdc317 100644 --- a/docs/plans/2026-08-16-observability-design.md +++ b/docs/plans/2026-08-16-observability-design.md @@ -1,6 +1,6 @@ # Observability — Design -**Issue:** [#10](https://github.com/Expressive-Tea/green-tea/issues/10) · **Status:** design, not yet implemented · **Constraint:** no new runtime dependency +**Issue:** [#10](https://github.com/Expressive-Tea/green-tea/issues/10) · **Status:** reviewed, all decisions settled · **Constraint:** no new runtime dependency --- @@ -127,11 +127,33 @@ No metrics registry in core, and no new event type for them. Per-step timings co --- -## Open questions for review +### D6 — A request span ends when the handler returns, and stream events carry its `requestId` -1. **Is `request:start`/`end` the right boundary on a streaming route?** A stream returns from `handle()` long before it finishes. Ending the request span at return means an SSE connection reports as a 2 ms request; ending it at stream close means an hour-long request. The same split #21 hit with its concurrency gate, and it should be answered the same way in both places rather than differently. -2. **Does `runSteps` measure per step, or only the pipeline total?** Per step is what makes the graph's timing story real, and it is `performance.now()` twice per step on the hot path. Benchmark before committing, `npm run bench` is already there. -3. **Does the logger receive events, or do events feed the logger?** If the default logger is just a Bus subscriber, request logging is composable exactly as #10 asks ("a composable step, not a global middleware") and there is only one path. If it is separate, there are two. Leaning subscriber; wants a second opinion. +A streaming route returns from `handle()` in milliseconds while the connection lives for minutes or hours. `request:end` fires at the handler's return, so latency histograms measure time-to-first-byte and stay meaningful instead of mixing 2 ms buffered requests with hour-long SSE connections in one distribution. Connection duration is already available from `stream:open`/`stream:close`, which now carry the same `requestId` so a consumer can join the two. + +This is the same boundary #21 chose for its concurrency gate — release when `handle()` returns, treat long-lived streams like upgrades. Answering it differently in the two places would mean the framework disagreed with itself about when a request is over. + +### D7 — Per-step timing is always on, measured at step boundaries + +Measured before deciding, on the box `BENCHMARKS.md` was produced on: + +| Approach | Cost per step | Share of one request | +|---|---:|---:| +| `performance.now()` ×2 per step | 45.3 ns | 0.44% | +| **`performance.now()` at step boundaries (N+1 calls for N steps)** | **25.2 ns** | **0.25%** | +| `Date.now()` ×1 | 28.6 ns | — | + +Baseline: 98,093 req/s ≈ 10.19 µs per request. + +Two things follow. `Date.now()` loses on both axes — slower *and* coarser — so `performance.now()` is unambiguous. And a step's end is the next step's start, so a pipeline of N steps needs N+1 timestamps rather than 2N, halving the cost. + +At 0.25% per step the overhead sits **below the 0.3% run-to-run CV of the project's own benchmark**, so it is not measurable in the harness that would have to justify a flag. Making it opt-in would buy two code paths and a configuration surface in exchange for something nobody can observe. Always on. + +### D8 — Request logging is a `Bus` subscriber, wrapped so a failing logger cannot go silent + +The logger is a callable sink either way — the 8 direct diagnostics (shutdown timeout, degraded provider) are not events and need one regardless. The decision is only about request logging, and it goes through the event stream: one path, and it is composable and removable exactly as #10 asks for ("a composable step, not a global middleware"). + +The cost this closes: `emit` swallows listener failures by design (`src/bus.ts:41`), so a user-supplied logger that throws would stop writing with nobody informed. The built-in subscriber is therefore wrapped to fall back to `console` on failure. The Bus keeps its guarantee — an observer still cannot break a request — without buying it with silence. --- From 7bd11bff277b3a3ec39f70586361f9493641fca2 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 14:08:11 -0500 Subject: [PATCH 14/46] docs(plans): implementation plan for the observability contract MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Eight tasks from the reviewed design, ordered so the correction lands before anything consumes it — a logger built on uncorrelated events would grow its own notion of request identity, which is the failure the design exists to prevent. Two placement details worth having settled in writing. requestId is generated in the adapters rather than in handle(), because both read and size-check the body first, so a 413 never reaches handle() — generating there would leave exactly the failures an operator most wants to correlate without an id. And step timing takes N+1 timestamps for N steps, since one step's end is the next one's start; the design measured that against the naive 2N. Task 7 benchmarks the hot path and says outright that if the measurement disagrees with D7, the design changes rather than the number being quietly kept. Signed-off-by: Diego Resendez --- docs/plans/2026-08-16-observability-plan.md | 148 ++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 docs/plans/2026-08-16-observability-plan.md diff --git a/docs/plans/2026-08-16-observability-plan.md b/docs/plans/2026-08-16-observability-plan.md new file mode 100644 index 0000000..eddbb1e --- /dev/null +++ b/docs/plans/2026-08-16-observability-plan.md @@ -0,0 +1,148 @@ +# Observability — Implementation Plan + +> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. + +**Design:** [2026-08-16-observability-design.md](./2026-08-16-observability-design.md) — reviewed, D1–D8 settled. Do not re-decide them here. + +**Goal:** Make the existing event stream correlatable and measured, then build the logger on top of it as its first consumer. Closes [#10](https://github.com/Expressive-Tea/green-tea/issues/10). + +**Architecture:** Most of this lands in `src/bus.ts` and `src/pipeline.ts`. The `Bus` already has 19 emission points; this adds identity, timing and the request-level events those points had nothing to hang from. No new runtime dependency — `reflect-metadata` stays the only one, and the OpenTelemetry bridge lives outside core. + +**Tech Stack:** TypeScript, Vitest, Deno/Bun/workerd suites, `performance.now()`, `crypto.randomUUID()`. + +--- + +## Order + +Tasks 1–3 are the correction; 4–6 are what consumes it. Do not start 4 before 3 — a logger built on uncorrelated events would need its own notion of request identity, which is the failure the design exists to prevent. + +--- + +### Task 1: Give every request an identity, and carry it + +**Skills:** `@superpowers:test-driven-development` + +**Files:** +- Modify: `src/http/core.ts` (`NeutralRequest`, `handle`) +- Modify: `src/http/server.ts` (~line 120, the Node call into `handle`) +- Modify: `src/http/web.ts` (~line 178, the Fetch call into `handle`) +- Modify: `src/bus.ts` +- Test: `test/observability.test.ts` (new) + +**Step 1:** Extend `EventPayload` with the optional fields from the design: `requestId`, `traceId`, `route`, `method`, `transport`, `status`, `runtime`. All optional — boot and mesh events have no request to name. + +**Step 2:** Add `requestId` to `NeutralRequest` (`src/http/core.ts`). Generate it in the **adapters**, not in `handle()`, and here is why that placement matters: both adapters read and size-check the body before they reach `handle()` (`server.ts:107`, `web.ts:143` per the #21 analysis), so a 413 is rejected before `handle()` ever sees the request. Generating inside `handle()` would leave exactly the failures an operator most wants to correlate without an id. + +**Step 3:** One shared helper for generation, so the two adapters cannot diverge on the rule: adopt an incoming `x-request-id`, otherwise `crypto.randomUUID()`. Carry `traceparent` through as `traceId` **without parsing it** (D5). + +**Step 4:** Write the test that fails first: fire two concurrent requests through `app.fetch`, collect `request:step:enter` from the bus, and assert every event carries a `requestId` and that the two requests' events never share one. This is the defect the whole design exists to fix, so it is the first test. + +**Verify:** `crypto.randomUUID` on Node 18 — CI's `build` job pins `node-version: '18'`, and `test:edge` covers workerd. Do not assume; let both run. + +### Task 2: Measure steps at their boundaries + +**Files:** +- Modify: `src/pipeline.ts` (`runSteps`, ~line 48) +- Test: `test/observability.test.ts` + +**Step 1:** Take `performance.now()` once before the loop, then once per iteration — **N+1 timestamps for N steps**, because a step's end is the next step's start. Not two per step. The design measured the difference: 25.2 ns vs 45.3 ns per step (D7). + +**Step 2:** Attach `durationMs` to `request:step:leave`. The field has been declared in `EventPayload` since the beginning and written by nothing; this is what makes it real. + +**Step 3:** Always on, no flag (D7 — 0.25% of a request, below the benchmark's own 0.3% CV). + +**Verify:** a step that sleeps a known interval reports a `durationMs` in that neighbourhood. Assert a range, never an exact value. + +### Task 3: Stop losing which step failed + +**Files:** +- Modify: `src/pipeline.ts` (`runSteps`, and the catch at ~line 98) +- Test: `test/observability.test.ts` + +`request:step:error` currently emits `{ name: 'pipeline' }`, which throws away the one fact it exists to report. + +**Step 1:** Wrap each `step.run` inside `runSteps`, emit `request:step:error` with the real step name and `scope`, and rethrow unchanged. Do not swallow. + +**Step 2:** `runPipeline`'s existing catch now emits `request:failed` instead of a second `step:error` (D3). Both fire for a failing step, deliberately: one marks the span, the other the trace. + +**Verify:** a three-step pipeline whose middle step throws emits `request:step:error` naming *that* step, plus exactly one `request:failed`. + +### Task 4: The logger contract + +**Files:** +- Create: `src/logger.ts` +- Modify: `src/app/index.ts` (`createApp` options; the 6 `console.warn` calls) +- Modify: `src/deno.ts`, `src/bun.ts` (1 `console.warn` each) +- Modify: `src/index.ts` (export the type) +- Test: `test/logger.test.ts` (new) + +**Step 1:** Define the interface. Keep it to the levels core actually uses — resist inventing a hierarchy nobody calls. + +**Step 2:** Default implementation: structured JSON, human-readable when the process is interactive, decided **once at boot** rather than per call. It writes through `console`; core gains no logging dependency (D1). + +**Step 3:** `createApp({ logger })`. A distinct registration, not a provider — it has to outlive the graph to report the graph failing to boot (D1). Per `AGENTS.md`, a new public option means `src/app/types.ts` too if it appears on `App`. + +**Step 4:** Replace all 8 `console.warn` calls. `grep -rn "console\." src/` must return nothing afterwards, which is the check #10 actually asks for. + +**Step 5:** Expose the logger under an injectable key so steps and handlers reach it with `@needs('logger')`. One object, two access paths, no second implementation. + +### Task 5: Request logging as a subscriber + +**Files:** +- Modify: `src/logger.ts` +- Test: `test/logger.test.ts` + +**Step 1:** Build request logging as `bus.on(...)` over the corrected stream (D8). Composable and removable, which is what #10 means by "a composable step, not a global middleware". + +**Step 2:** Wrap the subscriber so a throwing logger falls back to `console`. `Bus.emit` swallows listener failures by design (`src/bus.ts:41`); without the wrapper a broken user logger stops writing and tells nobody. The Bus keeps its guarantee; it just stops paying for it with silence. + +**Verify:** a logger that throws on every call still produces output, and the request still succeeds. + +### Task 6: The remaining events + +**Files:** +- Modify: `src/bus.ts`, `src/http/core.ts`, `src/app/index.ts` + +**Step 1:** Add `request:start|end|failed`, `route:matched|unmatched`, `graph:resolved|failed` to `LifecycleEvent`. + +**Step 2:** `request:end` fires **when the handler returns**, not when a stream closes (D6). `stream:open`/`close` carry the same `requestId` so a consumer joins them itself. + +**Step 3:** `route:unmatched` covers 404 and 405 both — naming it after one outcome would misreport the other. + +**Step 4:** `route` on every payload is the **matched pattern**, never the concrete path. A metrics consumer labelling on raw URLs produces unbounded cardinality and takes down the metrics backend; the framework must not hand anyone that shape by default. + +### Task 7: Benchmark, and publish the number + +**Files:** +- Modify: `BENCHMARKS.md` + +`npm run bench` before and after, same box, same run. D7 predicts ~0.25% per step and predicts it is invisible against a 0.3% CV. If the measurement disagrees with the design, the design is what changes — say so rather than quietly keeping the code. + +### Task 8: Documentation + +**Files:** +- Modify: `README.md` (the *Honest scope* paragraph at ~line 246) +- Modify: `website/src/content/docs/` — a new observability guide, plus the `createapp` reference table + +`README.md:246` currently opens "**No observability layer, either.**" and links to #10. It is the single most load-bearing sentence in the CTO assessment, and rewriting it is part of this work rather than follow-up. Say what now exists and what still does not — the OpenTelemetry adapter is not in core and should not be implied to be. + +Per `AGENTS.md`, new public API needs a note in `README.md`. + +> If Phase 4 has already moved the site, the guide lands in the docs repository instead. + +--- + +## Out of scope + +`@green-tea/opentelemetry`, log shipping, sampling, redaction, W3C Trace Context parsing, and plugin/provider teardown (Task 2.5 in the trust-release plan — an awaited teardown and a non-blocking observer are opposite guarantees). + +--- + +## Verification + +```bash +npm run lint && npm run format:check && npm run complexity:check && npm run typecheck && npm test +npm run test:deno && npm run test:bun && npm run test:edge # all three gate a merge now +npm run bench # hot-path change +grep -rn "console\." src/ # must be empty +``` From 2c47ee8896100408fba21c44ac8cc86463a908f6 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 14:20:44 -0500 Subject: [PATCH 15/46] feat(observability): correlate and time the lifecycle event stream MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tasks 1-3 of the observability plan. The Bus already had 19 emission points; what it lacked was any way to tell which request an event belonged to, which made the whole stream unusable under concurrency. Every per-request event now carries requestId, traceId, route, method and transport, and request:step:leave carries durationMs — a field that has been declared in EventPayload since the beginning with nothing ever writing it. Identity is derived in the adapters rather than in handle(), because both read and size-check the body first: a 413 is answered without handle() ever seeing the request, so generating there would leave exactly the failures an operator most wants to correlate with nothing to correlate them by. An incoming x-request-id is adopted rather than replaced, and traceparent is carried verbatim — core implements no propagation spec. Timing takes N+1 readings for N steps, since one step's end is the next one's start. Measured at 25.2ns per step against a ~10.19us request. request:step:error now names the step that actually failed. It reported name: 'pipeline' before, discarding the one fact it exists to carry, because it was emitted from the outer catch where that is all that is known. The outer catch emits request:failed instead: one marks the span, the other the trace. route carries the matched pattern and never the concrete path. Labelling a metric on raw URLs gives unbounded cardinality and takes down the metrics backend rather than the app, so it is a contract, with a test. Signed-off-by: Diego Resendez --- src/app/index.ts | 9 ++ src/bus.ts | 30 ++++++- src/http/core.ts | 34 +++++++ src/http/server.ts | 5 +- src/http/types.ts | 4 + src/http/web.ts | 5 +- src/pipeline.ts | 51 +++++++++-- test/observability.test.ts | 180 +++++++++++++++++++++++++++++++++++++ 8 files changed, 305 insertions(+), 13 deletions(-) create mode 100644 test/observability.test.ts diff --git a/src/app/index.ts b/src/app/index.ts index 65ff8db..1b5037f 100644 --- a/src/app/index.ts +++ b/src/app/index.ts @@ -785,6 +785,15 @@ function buildHttpRoutes(routePlans: RoutePlan[], remoteRoutes: RouteDef[], deps bus, onError, transport: plan.transport, + // `route` is the pattern, never req.url — a metrics consumer labelling on concrete + // paths gets one label per distinct URL, and that takes down the metrics backend. + correlation: { + requestId: req.requestId, + traceId: req.traceId, + route: plan.pattern, + method: plan.method, + transport: plan.transport, + }, seed: { ...provided, req, diff --git a/src/bus.ts b/src/bus.ts index 149b890..0e6f097 100644 --- a/src/bus.ts +++ b/src/bus.ts @@ -12,16 +12,42 @@ export type LifecycleEvent = | 'mesh:connect' | 'mesh:disconnect' | 'mesh:rpc:error' - | 'plugin:mounted'; + | 'plugin:mounted' + | 'request:failed'; -/** Data carried by a lifecycle event: the subject's name plus optional scope, error and timing. */ +/** + * Data carried by a lifecycle event: the subject's name plus optional scope, error, timing and + * the fields that say which request it belongs to. + * + * Everything past `name` is optional and stays that way. Boot and mesh events have no request to + * name, and requiring a shape they cannot fill would only mean inventing values for it. + */ export interface EventPayload { name: string; scope?: string; error?: unknown; durationMs?: number; + /** Correlates every event of one request. Adopted from `x-request-id` when a gateway sent one. */ + requestId?: string; + /** A `traceparent` header carried verbatim. Core parses nothing — that is the exporter's job. */ + traceId?: string; + /** The matched *pattern* (`/users/:id`), never the concrete path — see {@link Correlation}. */ + route?: string; + method?: string; + transport?: string; + status?: number; } +/** + * The subset of {@link EventPayload} that identifies a request, spread into each of its events. + * + * `route` carries the matched pattern rather than the URL that arrived, and that is load-bearing + * rather than cosmetic: a metrics consumer that labels a counter with a concrete path gets one + * label per distinct URL, and unbounded label cardinality takes down the metrics backend rather + * than the application. Handing anyone that shape by default would be the framework's fault. + */ +export type Correlation = Pick; + /** In-process pub/sub for framework lifecycle events; observer failures are swallowed so they never break the pipeline. */ export class Bus { private readonly listeners = new Map void>>(); diff --git a/src/http/core.ts b/src/http/core.ts index 7fea20e..bb3375d 100644 --- a/src/http/core.ts +++ b/src/http/core.ts @@ -8,6 +8,13 @@ import { pickEncoder } from './stream'; import type { RouteDef, HttpOptions } from './types'; import type { StreamEncoder } from '../encoders'; +// The project tsconfig's `lib` is `es2020` with no `DOM`, so the Web Crypto global is undeclared +// even though all four supported runtimes provide it. Ambient-declare only what is called — the +// same approach `src/deno.ts` takes for the Deno globals. Deliberately *not* `node:crypto`: this +// file is the runtime-neutral core, and the web-standard global is what Deno, Bun and workerd all +// have without a compatibility flag. +declare const crypto: { randomUUID(): string }; + /** A runtime-neutral inbound request: body already parsed by the caller's ingress (Node stream, fetch Request, …). */ export interface NeutralRequest { method: string; @@ -16,6 +23,31 @@ export interface NeutralRequest { body: unknown; // already-parsed body secure: boolean; ip: string; + requestId: string; + traceId?: string; +} + +/** + * Derives a request's identity from its headers, for the adapters to stamp on a `NeutralRequest`. + * + * **Called by the adapters, not by {@link handle}**, and the placement is the point. Both adapters + * read and size-check the body before they reach `handle()` (`server.ts`, `web.ts`), so a `413` is + * answered without `handle()` ever seeing the request. Generating identity in here would leave + * precisely the failures an operator most wants to correlate with nothing to correlate them by. + * + * An `x-request-id` from a gateway is adopted rather than replaced — a service behind a proxy must + * not open a second identity for a request that already has one. `traceparent` is carried through + * untouched: core implements no propagation spec, and W3C Trace Context belongs to the exporter. + */ +export function correlateRequest(headers: Record): { + requestId: string; + traceId?: string; +} { + const first = (value: string | string[] | undefined): string | undefined => (Array.isArray(value) ? value[0] : value); + const incoming = first(headers['x-request-id'])?.trim(); + const traceId = first(headers.traceparent)?.trim(); + + return { requestId: incoming || crypto.randomUUID(), traceId: traceId || undefined }; } /** The neutral shape of a response: a fully buffered body, or a stream to pipe frame-by-frame. */ @@ -143,6 +175,8 @@ export async function handle( body: req.body, protocol: req.secure ? 'https' : 'http', ip: req.ip, + requestId: req.requestId, + traceId: req.traceId, }); } catch (error) { result = renderError(error, { method: req.method, url: req.url, headers: req.headers }, opts?.onError); diff --git a/src/http/server.ts b/src/http/server.ts index e0c48dd..694b8bd 100644 --- a/src/http/server.ts +++ b/src/http/server.ts @@ -10,7 +10,7 @@ import { readBody, deriveSecure, deriveIp } from './request'; import { pipeStream } from './stream'; import { attachWs } from './ws'; import { mergeInjectedHeaders } from './headers'; -import { handle } from './core'; +import { handle, correlateRequest } from './core'; import type { RouteDef, WsRouteDef, MatchedRoute, MeshControl, HttpOptions } from './types'; interface HandlerConfig { @@ -85,6 +85,8 @@ function createRequestHandler(cfg: HandlerConfig) { // Install the security-header patch BEFORE any routing/response so every path // (200, 404, error, stream) writes headers through the same patched writeHead. const secure = deriveSecure(req, trustProxy); + // Derived before the body is read, so a 413 rejected below still carries an identity. + const correlation = correlateRequest(req.headers); const injected: Record = { ...buildSecurityHeaders(opts?.security ?? true, secure) }; patchResponseHeaders(res, injected); @@ -118,6 +120,7 @@ function createRequestHandler(cfg: HandlerConfig) { } const result = await handle(routes, opts, { + ...correlation, method, url, headers: req.headers, diff --git a/src/http/types.ts b/src/http/types.ts index fbb5806..6b1af32 100644 --- a/src/http/types.ts +++ b/src/http/types.ts @@ -38,6 +38,10 @@ export type RouteHandler = (req: { body: unknown; protocol: 'http' | 'https'; ip: string; + /** Correlates every lifecycle event this request emits; see `correlateRequest` in `./core`. */ + requestId: string; + /** An incoming `traceparent`, carried verbatim for an exporter to interpret. */ + traceId?: string; }) => Promise; /** A registered HTTP route: method, path pattern, streaming transport, and handler. */ diff --git a/src/http/web.ts b/src/http/web.ts index d8c51bd..0ad8326 100644 --- a/src/http/web.ts +++ b/src/http/web.ts @@ -1,5 +1,5 @@ import type { StreamEncoder } from '../encoders'; -import { handle, computeInjected, type HandleResult } from './core'; +import { handle, computeInjected, correlateRequest, type HandleResult } from './core'; import { mergeInjectedHeaders } from './headers'; import { parseRequestBody } from './server'; import { normalizeRequestPath, resolveRoute } from './router'; @@ -154,6 +154,8 @@ export function buildFetch(routes: RouteDef[], opts: HttpOptions | undefined) { const url = new URL(request.url); const path = url.pathname + url.search; const headers = headersToRecord(request.headers); + // Derived before the body is read, so a 413 rejected below still carries an identity. + const correlation = correlateRequest(headers); let matched: ReturnType; try { @@ -176,6 +178,7 @@ export function buildFetch(routes: RouteDef[], opts: HttpOptions | undefined) { } const result = await handle(routes, opts, { + ...correlation, method: request.method, url: path, headers, diff --git a/src/pipeline.ts b/src/pipeline.ts index 680e25b..40363bc 100644 --- a/src/pipeline.ts +++ b/src/pipeline.ts @@ -1,4 +1,4 @@ -import { Bus } from './bus'; +import { Bus, type Correlation } from './bus'; import { renderError, type ErrorRenderer } from './transformers'; import { isAsyncIterable } from './channel'; import type { TransformerFn, Transport } from './metadata'; @@ -45,15 +45,44 @@ export function isStreamResult(result: PipelineResult): result is StreamResult { * `request:step:enter`/`leave` on the bus. The single place steps are executed — every * transport (HTTP, ws, mesh) goes through here so observability is uniform by construction. */ -export async function runSteps(steps: PipelineStep[], seed: Record, bus: Bus): Promise { +export async function runSteps( + steps: PipelineStep[], + seed: Record, + bus: Bus, + correlation: Correlation = {}, +): Promise { // context is intentionally `any`: each step merges arbitrary keys into the accumulator const context: any = seed; + // One timestamp per boundary, not one pair per step: a step's end is the next one's start, so + // N steps need N+1 readings rather than 2N. Measured at 25.2ns vs 45.3ns per step, against a + // ~10.19us request — 0.25%, below the 0.3% run-to-run CV of the project's own benchmark, which + // is why this is always on instead of hiding behind a flag nobody could tune with evidence. + let mark = performance.now(); for (const step of steps) { - bus.emit('request:step:enter', { name: step.name, scope: step.origin }); - const output = await step.run(context); - Object.assign(context, output); - bus.emit('request:step:leave', { name: step.name, scope: step.origin }); + bus.emit('request:step:enter', { name: step.name, scope: step.origin, ...correlation }); + + try { + const output = await step.run(context); + Object.assign(context, output); + } catch (error) { + // Emitted here, where the step that failed is still known. The outer catch in runPipeline + // only sees "something in the pipeline threw" and used to report `name: 'pipeline'`, which + // threw away the one fact the event exists to carry. Rethrown unchanged — this observes. + const now = performance.now(); + bus.emit('request:step:error', { + name: step.name, + scope: step.origin, + error, + durationMs: now - mark, + ...correlation, + }); + throw error; + } + + const now = performance.now(); + bus.emit('request:step:leave', { name: step.name, scope: step.origin, durationMs: now - mark, ...correlation }); + mark = now; } return context; @@ -72,13 +101,14 @@ export async function runPipeline(args: { bus: Bus; transport: Transport; onError?: ErrorRenderer; + correlation?: Correlation; }): Promise { - const { steps, handler, transformer, seed, bus, transport, onError } = args; + const { steps, handler, transformer, seed, bus, transport, onError, correlation = {} } = args; // context is intentionally `any`: each step merges arbitrary keys into the accumulator let context: any = { ...seed }; try { - context = await runSteps(steps, context, bus); + context = await runSteps(steps, context, bus, correlation); const result = await handler(context); const streaming = isAsyncIterable(result); const contract = TRANSPORT_RETURN[transport]; @@ -95,7 +125,10 @@ export async function runPipeline(args: { const transformed = transformer(result); return { status: transformed.status ?? 200, headers: transformed.headers ?? {}, body: transformed.body }; } catch (error) { - bus.emit('request:step:error', { name: 'pipeline', error }); + // Both fire for a failing step, deliberately: `request:step:error` above marks the span, + // this marks the trace. A tracing exporter needs each, and only emitting the outer one is + // what produces a trace that says a request failed without saying where. + bus.emit('request:failed', { name: correlation.route ?? 'pipeline', error, ...correlation }); const req = (context.req ?? {}) as { method?: string; url?: string; headers?: Record }; return renderError( error, diff --git a/test/observability.test.ts b/test/observability.test.ts new file mode 100644 index 0000000..c4e3a50 --- /dev/null +++ b/test/observability.test.ts @@ -0,0 +1,180 @@ +import { describe, it, expect } from 'vitest'; +import { createApp, Provider, Step, Route, Get, Module, needs } from '../src/index'; +import type { EventPayload } from '../src/bus'; + +@Provider({ provides: 'db' }) +class Db { + provide() { + return { db: { name: 'db' } }; + } +} + +// Yields inside the step so two concurrent requests genuinely interleave their events rather +// than each running to completion before the other starts. Without that, the correlation bug +// this file exists to catch would not even show up. +@Step({ provides: 'user', needs: ['db'] }) +class LoadUser { + async run() { + await new Promise((r) => setTimeout(r, 10)); + return { user: { id: 'u1' } }; + } +} + +@Step({ provides: 'profile', needs: ['user'] }) +class LoadProfile { + async run() { + await new Promise((r) => setTimeout(r, 10)); + return { profile: { theme: 'dark' } }; + } +} + +@Route('/api') +class Ctl { + @Get('/me') + me(@needs('profile') profile: unknown) { + return { profile }; + } +} + +@Module({ mountpoint: '/', providers: [Db], steps: [LoadUser, LoadProfile], controllers: [Ctl] }) +class M {} + +describe('event correlation', () => { + it('attributes every step event to the request that caused it', async () => { + const app = createApp({ modules: [M] }); + const seen: EventPayload[] = []; + app.bus.on('request:step:enter', (p) => seen.push(p)); + app.bus.on('request:step:leave', (p) => seen.push(p)); + + // Concurrent on purpose: this is the only condition under which the defect appears. + await Promise.all([ + app.fetch(new Request('http://x/api/me')), + app.fetch(new Request('http://x/api/me')), + ]); + + expect(seen.length).toBeGreaterThan(0); + expect(seen.every((event) => typeof event.requestId === 'string' && event.requestId.length > 0)).toBe(true); + + // Two requests, two identities, and no event belonging to both. + const ids = new Set(seen.map((event) => event.requestId)); + expect(ids.size).toBe(2); + + // Each request must show its own complete run of the pipeline, which is the whole point of + // correlating: counting events globally would pass even with the ids shuffled. + // A step is named by what it `provides`, not by its class. + for (const id of ids) { + const forRequest = seen.filter((event) => event.requestId === id); + expect(forRequest.filter((e) => e.name === 'user')).toHaveLength(2); // enter + leave + expect(forRequest.filter((e) => e.name === 'profile')).toHaveLength(2); + } + }); + + it('labels events with the route pattern, never the concrete path', async () => { + @Route('/things') + class Things { + // Needs a step on purpose: green-tea prunes steps no handler depends on, so a route that + // needs nothing emits no step events and the assertion below would have nothing to read. + @Get('/:id') + one(@needs('user') user: unknown) { + return { user }; + } + } + @Module({ mountpoint: '/', providers: [Db], steps: [LoadUser, LoadProfile], controllers: [Things] }) + class ParamModule {} + + const app = createApp({ modules: [ParamModule] }); + const seen: EventPayload[] = []; + app.bus.on('request:step:leave', (p) => seen.push(p)); + + await app.fetch(new Request('http://x/things/42')); + await app.fetch(new Request('http://x/things/1337')); + + expect(seen.length).toBeGreaterThan(0); + // Two distinct URLs, one label. Labelling on the raw path is what gives a metrics backend + // unbounded cardinality, so this is a contract and not an implementation detail. + expect(new Set(seen.map((e) => e.route))).toEqual(new Set(['/things/:id'])); + }); + + it('times each step and reports it on leave', async () => { + const app = createApp({ modules: [M] }); + const seen: EventPayload[] = []; + app.bus.on('request:step:leave', (p) => seen.push(p)); + + await app.fetch(new Request('http://x/api/me')); + + // Both steps sleep 10ms. Assert a range, never a value — a clock is not a promise. + expect(seen).toHaveLength(2); + for (const event of seen) { + expect(event.durationMs).toBeGreaterThan(5); + expect(event.durationMs).toBeLessThan(500); + } + }); + it('adopts an incoming x-request-id instead of starting a second identity', async () => { + const app = createApp({ modules: [M] }); + const seen: EventPayload[] = []; + app.bus.on('request:step:enter', (p) => seen.push(p)); + + await app.fetch(new Request('http://x/api/me', { headers: { 'x-request-id': 'from-the-gateway' } })); + + expect(seen.length).toBeGreaterThan(0); + expect(seen.every((event) => event.requestId === 'from-the-gateway')).toBe(true); + }); + + it('carries traceparent through as traceId without parsing it', async () => { + const app = createApp({ modules: [M] }); + const traceparent = '00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01'; + const seen: EventPayload[] = []; + app.bus.on('request:step:enter', (p) => seen.push(p)); + + await app.fetch(new Request('http://x/api/me', { headers: { traceparent } })); + + expect(seen.length).toBeGreaterThan(0); + // Verbatim: core implements no propagation spec, that belongs to the exporter. + expect(seen.every((event) => event.traceId === traceparent)).toBe(true); + }); +}); + +describe('failure reporting', () => { + @Step({ provides: 'ok' }) + class Fine { + run() { + return { ok: true }; + } + } + @Step({ provides: 'boom', needs: ['ok'] }) + class Boom { + run(): never { + throw new Error('step exploded'); + } + } + @Route('/bad') + class BadCtl { + @Get('/go') + go(@needs('boom') b: unknown) { + return { b }; + } + } + @Module({ mountpoint: '/', steps: [Fine, Boom], controllers: [BadCtl] }) + class BadModule {} + + it('names the step that failed, and marks the request failed once', async () => { + const app = createApp({ modules: [BadModule] }); + const stepErrors: EventPayload[] = []; + const requestFailures: EventPayload[] = []; + app.bus.on('request:step:error', (p) => stepErrors.push(p)); + app.bus.on('request:failed', (p) => requestFailures.push(p)); + + await app.fetch(new Request('http://x/bad/go')); + + // The defect this replaces reported every failure as name: 'pipeline'. + expect(stepErrors).toHaveLength(1); + expect(stepErrors[0].name).toBe('boom'); + expect((stepErrors[0].error as Error).message).toBe('step exploded'); + + // Both fire, on purpose: one marks the span, the other the trace. + expect(requestFailures).toHaveLength(1); + expect(requestFailures[0].route).toBe('/bad/go'); + expect(requestFailures[0].requestId).toBe(stepErrors[0].requestId); + }); + +}); From 633ef58032c13a1ebd5ed78798e3156694ef8b63 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 14:26:16 -0500 Subject: [PATCH 16/46] perf(observability): do not build event payloads for an empty room MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The correlation work regressed the in-process hot path from 4.52us to 5.43us per request, ~20%. The design predicted 0.25% per step and was wrong by more than an order of magnitude, so recording what the measurement actually said: spreading correlation into payloads ~197ns <- the cost crypto.randomUUID() ~170ns in place try/catch inside the step loop ~2.6ns <- not the cost emit() cannot avoid the first: its argument is already built by the time it is called. Only the caller can decline to build it, so Bus.hasListeners lets it, and runSteps hoists the check out of the loop since listeners are registered at boot. An application subscribing to nothing now pays a branch instead of four payloads and three clock reads for an audience of nobody. That recovers half. 4.96us remains against 4.52us — ~10% in process, ~4.5% against the 10.19us of a real socketed request. Two ways to shave the rest were measured and both rejected in comments: a lazy requestId is defeated by the first spread, and a boot-prefix counter is 5x cheaper but trades the standard identifier shape for ~1.7%. Neither earns its complexity yet. The remaining cost is the feature, not an accident: correlation only exists if something carries it. Signed-off-by: Diego Resendez --- src/bus.ts | 15 +++++++++++++++ src/http/core.ts | 7 +++++++ src/pipeline.ts | 41 +++++++++++++++++++++++++++-------------- 3 files changed, 49 insertions(+), 14 deletions(-) diff --git a/src/bus.ts b/src/bus.ts index 0e6f097..5a3d229 100644 --- a/src/bus.ts +++ b/src/bus.ts @@ -60,6 +60,21 @@ export class Bus { return () => listenerSet.delete(listener); } + /** + * Whether anything is listening to `event` — for skipping the *construction* of a payload nobody + * will read. + * + * Not a micro-optimisation looking for a problem. A correlated payload is built by spreading the + * request's identity into it, and that spread was measured at ~197 ns per request on a two-step + * pipeline — against a ~4.5 µs in-process request, on a path where the overwhelmingly common + * case is an application that subscribes to nothing at all. `emit` cannot help: its argument is + * already built by the time it is called. Only the caller can decline to build it. + */ + hasListeners(event: LifecycleEvent): boolean { + const listenerSet = this.listeners.get(event); + return listenerSet !== undefined && listenerSet.size > 0; + } + /** Dispatch `payload` to every listener of `event`; a throwing listener is isolated and does not affect the others. */ emit(event: LifecycleEvent, payload: EventPayload): void { for (const listener of this.listeners.get(event) ?? []) { diff --git a/src/http/core.ts b/src/http/core.ts index bb3375d..d59999c 100644 --- a/src/http/core.ts +++ b/src/http/core.ts @@ -47,6 +47,13 @@ export function correlateRequest(headers: Record }; return renderError( error, From dabab1812bd1e729ae836be6082d53dff566927a Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 14:42:13 -0500 Subject: [PATCH 17/46] perf(observability): hoist a per-request closure out of correlateRequest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `first` helper was declared inside correlateRequest, so it was allocated on every request. It captures nothing, so module scope is where it always belonged. Measured at 0.16us against a ~4.4us in-process request — 45% of the entire remaining observability overhead, from one line. Total overhead is now +0.24us rather than +0.44us, which against the 10.19us of a real socketed request is ~2.4%. Ablation of what is left, so the next person does not repeat it: randomUUID is 0.16us of the 0.24 and the other 0.08 is the header read, the extra properties and three hasListeners lookups. Building the correlation literal per request costs nothing measurable — V8 keeps it on the stack — so do not go optimising that one. Signed-off-by: Diego Resendez --- src/http/core.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/http/core.ts b/src/http/core.ts index d59999c..37528f1 100644 --- a/src/http/core.ts +++ b/src/http/core.ts @@ -27,6 +27,11 @@ export interface NeutralRequest { traceId?: string; } +// Module scope, not a local inside `correlateRequest`. Declared there it was a closure allocated +// on every single request, which measured at 0.16 us against a ~4.4 us one — 45% of the whole +// observability overhead, for a helper that captures nothing. +const first = (value: string | string[] | undefined): string | undefined => (Array.isArray(value) ? value[0] : value); + /** * Derives a request's identity from its headers, for the adapters to stamp on a `NeutralRequest`. * @@ -43,7 +48,6 @@ export function correlateRequest(headers: Record (Array.isArray(value) ? value[0] : value); const incoming = first(headers['x-request-id'])?.trim(); const traceId = first(headers.traceparent)?.trim(); From 7b0a3d4e246f737bd9db2e6dad6257368002790f Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 14:45:17 -0500 Subject: [PATCH 18/46] docs(observability): record why randomUUID is the fast option, not the lazy one MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Benchmarked the alternatives rather than leaving the question open. Every supported runtime already batches entropy behind randomUUID, so the intuitive replacements lose: Math.random() twice into base36 is 3.5x slower at 265ns because the string work dominates, an unbatched getRandomValues is 472ns, and a uint32 pool through toString(36) is 114ns. The only cross-runtime improvement is a hand-rolled entropy pool with a hex lookup table at 50ns, which saves 26ns — 0.26% of a real 10.19us request. Not worth owning an entropy pool for. Buffer.toString('hex') matches it but is Node-only, which this file cannot be. Table left in the code so the next person does not re-run it. Signed-off-by: Diego Resendez --- src/http/core.ts | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/http/core.ts b/src/http/core.ts index 37528f1..cace5ff 100644 --- a/src/http/core.ts +++ b/src/http/core.ts @@ -51,13 +51,19 @@ export function correlateRequest(headers: Record toString(36) from a pool 114 ns + // Math.random() x2 -> base36 265 ns 3.5x SLOWER; string work dominates + // getRandomValues per call, unbatched 472 ns + // + // The only cross-runtime win is 26 ns, against ~10.19 us for a real socketed request. A hand- + // rolled entropy pool is not worth 0.26%. A lazy getter is separately useless: the adapters and + // the payload builders both spread this object, and the first spread materialises it. return { requestId: incoming || crypto.randomUUID(), traceId: traceId || undefined }; } From df460f01ddc1f08d92abf9fec5f226d8b88a3f35 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 14:51:16 -0500 Subject: [PATCH 19/46] feat(observability): an injectable logger, and a lint rule that keeps core off console MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task 4. createApp({ logger }) accepts any Logger; the default writes structured JSON, or a readable line on a TTY, decided once at construction rather than per record. It writes through console, which is what lets core have a logging contract while reflect-metadata stays the only runtime dependency. Four levels, because four have callers. Core's diagnostics were all warn — every one of the eight console.warn calls — and request logging adds info and error. No trace, no fatal: a level nothing emits is a decision handed to the user for no reason. Registered rather than declared as a provider. Provider boot failures are reported while the graph is still resolving and shutdown warnings after it is gone, so a logger that lives in the graph cannot cover either end. It is also registered as a builtin provider, so @needs('logger') reaches the same object — one instance, two access paths — and exposed on App so serveDeno/serveBun report through the application's logger instead of past it. The [green-tea] prefix moves out of the prose into a `name` field: an aggregator filters on a field and cannot filter on a substring of a sentence. Context that was interpolated into messages is now structured alongside them. #10 asks that nothing in core call console directly. That is now a lint rule scoped to src/ rather than a grep somebody has to remember, with src/logger.ts exempted because being the console sink is its entire job. Verified it fails on a planted console.log. Signed-off-by: Diego Resendez --- eslint.config.mjs | 8 +++ src/app/index.ts | 75 +++++++++++++++------ src/app/types.ts | 7 ++ src/bun.ts | 5 +- src/deno.ts | 8 +-- src/index.ts | 5 ++ src/logger.ts | 80 +++++++++++++++++++++++ test/logger.test.ts | 154 ++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 316 insertions(+), 26 deletions(-) create mode 100644 src/logger.ts create mode 100644 test/logger.test.ts diff --git a/eslint.config.mjs b/eslint.config.mjs index 565e909..82e9744 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -23,4 +23,12 @@ export default tseslint.config( ], }, }, + { + // Nothing in core writes to console directly — every diagnostic goes through the injectable + // `Logger`, or an application cannot redirect it. This is the rule form of a check that was + // otherwise a `grep` somebody has to remember to run. + files: ['src/**/*.ts'], + ignores: ['src/logger.ts'], // the default logger *is* the console sink; that is its whole job + rules: { 'no-console': 'error' }, + }, ); diff --git a/src/app/index.ts b/src/app/index.ts index 1b5037f..6d5c6ff 100644 --- a/src/app/index.ts +++ b/src/app/index.ts @@ -1,5 +1,6 @@ import type http from 'http'; import { Bus } from '../bus'; +import { createDefaultLogger, type Logger } from '../logger'; import { Container } from '../container'; import { topoSort, subgraphFor, GraphNode, nearest } from '../graph'; import { toMermaid, toDOT, graphHtml, type GraphView } from '../graph-viz'; @@ -110,6 +111,16 @@ export function createApp(opts: { * where passing it per call is not an option. */ shutdownTimeoutMs?: number; + /** + * Where every framework diagnostic is written (default: structured JSON, human-readable on a TTY). + * + * Registered here rather than declared as a provider, and the ordering is why: provider boot + * events and the failures they report happen *while* the graph resolves, so a provider cannot + * report its own boot failing, and shutdown warnings happen after the graph is gone. The logger + * has to outlive the graph on both ends. It is also reachable from a step or handler as + * `@needs('logger')` — one object, two access paths. + */ + logger?: Logger; /** Opt in to alpha features whose API may still change. Currently gates `mesh`. */ experimental?: boolean; /** @@ -127,6 +138,7 @@ export function createApp(opts: { } const bus = new Bus(); + const logger = opts.logger ?? createDefaultLogger(); const container = new Container(); let server: http.Server | undefined; const streams = new Set<() => void>(); @@ -137,7 +149,7 @@ export function createApp(opts: { const registry = collectModules(opts.modules, viewsCtx); const { providerNodes, stepNodes, runners, providerMeta, routePlans } = registry; mountPlugins(opts.plugins, bus, registry); - provideBuiltins(registry); + provideBuiltins(registry, logger); // For each route, resolve which providers/steps feed it via topo order. // MVP: every route depends on every declared step + provider in the app graph. @@ -150,7 +162,7 @@ export function createApp(opts: { const meshLinks: Link[] = []; const finalize = (): void => { - ({ orderedProviders, orderedSteps } = finalizeGraph(registry, opts.warnGraphDepth)); + ({ orderedProviders, orderedSteps } = finalizeGraph(registry, logger, opts.warnGraphDepth)); booted = true; }; @@ -166,7 +178,7 @@ export function createApp(opts: { // can only be built here, after finalize(), and never at construction time. const prepareGraph = async (): Promise => { if (opts.mesh && !booted) { - const spliced = await spliceRemoteScopes(opts.mesh, bus, registry); + const spliced = await spliceRemoteScopes(opts.mesh, bus, registry, logger); remoteRoutes = spliced.remoteRoutes; meshLinks.push(...spliced.meshLinks); finalize(); @@ -214,7 +226,7 @@ export function createApp(opts: { registry, opts.overrides, () => orderedProviders, - { runners, container, providerMeta, bus }, + { runners, container, providerMeta, bus, logger }, degradedProviders, ready, ); @@ -268,7 +280,7 @@ export function createApp(opts: { }; const close = (options: { timeoutMs?: number } = {}): Promise => - closeApp(server, meshLinks, streams, options, opts.shutdownTimeoutMs); + closeApp(server, meshLinks, streams, options, opts.shutdownTimeoutMs, logger); return { listen, @@ -284,6 +296,7 @@ export function createApp(opts: { openapi, degraded: () => [...degradedProviders], bus, + logger, }; } @@ -450,7 +463,17 @@ function mountPlugins(plugins: Plugin[] | undefined, bus: Bus, registry: Registr } /** Auto-provides a shared {@link Rooms} instance unless the user already declared a `rooms` provider. */ -function provideBuiltins(registry: Registry): void { +function provideBuiltins(registry: Registry, logger: Logger): void { + // `logger` is registered as an ordinary provider *in addition to* being framework infrastructure, + // so a step or handler reaches it with `@needs('logger')` like any other dependency. It is the + // same object createApp holds, not a second one — core cannot depend on the graph for something + // it must use while the graph is still resolving. + if (!registry.runners.has('logger')) { + registry.providerNodes.push({ name: 'logger', needs: [], provides: ['logger'], origin: 'builtin' }); + registry.providerMeta.set('logger', { optional: false }); + registry.setRunner('logger', () => ({ logger })); + } + if (registry.runners.has('rooms')) return; const roomsInstance = new Rooms(); registry.providerNodes.push({ name: 'rooms', needs: [], provides: ['rooms'], origin: 'builtin' }); @@ -469,6 +492,7 @@ const DEEP_GRAPH_WARN = 20; */ function finalizeGraph( registry: Registry, + logger: Logger, warnDepth: number | false = DEEP_GRAPH_WARN, ): { orderedProviders: GraphNode[]; orderedSteps: GraphNode[] } { const { providerNodes, stepNodes, routePlans } = registry; @@ -488,10 +512,11 @@ function finalizeGraph( const depth = closure.filter((node) => stepNodes.includes(node)).length; if (warnDepth !== false && depth > warnDepth) { - console.warn( - `[green-tea] ${plan.method} ${plan.pattern} resolves to ${depth} steps — an unusually deep dependency chain. ` + + logger.warn( + `${plan.method} ${plan.pattern} resolves to ${depth} steps — an unusually deep dependency chain. ` + `It runs fine (per-request cost is linear), but ${warnDepth}+ steps on one route usually means a step ` + `is doing too much or the graph wants splitting. If it's intentional, ignore this.`, + { route: plan.pattern, method: plan.method, depth, threshold: warnDepth }, ); } } @@ -524,6 +549,7 @@ async function spliceRemoteScopes( mesh: MeshConfig, bus: Bus, registry: Registry, + logger: Logger, ): Promise<{ remoteRoutes: RouteDef[]; meshLinks: Link[] }> { const remoteRoutes: RouteDef[] = []; const meshLinks: Link[] = []; @@ -584,8 +610,8 @@ async function spliceRemoteScopes( compilePattern(plan.pattern).shape === compilePattern(route.pattern).shape, ) ) { - console.warn( - `[green-tea] mesh: route '${display}' is exported by teapot ${teapot.url} but also declared locally — ` + + logger.warn( + `mesh: route '${display}' is exported by teapot ${teapot.url} but also declared locally — ` + 'the local route takes precedence and the remote one will not be reached. ' + 'Remove one if that is not what you meant.', ); @@ -630,9 +656,10 @@ async function bootProviders( container: Container; providerMeta: Map; bus: Bus; + logger: Logger; }, ): Promise { - const { runners, container, providerMeta, bus } = deps; + const { runners, container, providerMeta, bus, logger } = deps; const degraded: string[] = []; for (const node of orderedProviders) { @@ -653,7 +680,10 @@ async function bootProviders( // optional: warn, leave it unregistered; routes needing it fail at request time // ponytail: full partial-degradation is out of scope (spec §10); warn is enough here degraded.push(node.name); - console.warn(`[green-tea] optional provider '${node.name}' failed: ${(error as Error).message}`); + logger.warn(`optional provider '${node.name}' failed: ${(error as Error).message}`, { + provider: node.name, + error, + }); } } @@ -676,6 +706,7 @@ function makeAppBooter( container: Container; providerMeta: Map; bus: Bus; + logger: Logger; }, degradedProviders: string[], /** Resolves the graph (splices remote mesh scopes, finalizes). Must precede providers: remote nodes join the topo sort. */ @@ -688,8 +719,9 @@ function makeAppBooter( degradedProviders.push(...(await bootProviders(getOrderedProviders(), deps))); if (degradedProviders.length) { - console.warn( - `[green-tea] started with ${degradedProviders.length} degraded optional provider(s): ${degradedProviders.join(', ')} — routes that need them will fail at request time.`, + deps.logger.warn( + `started with ${degradedProviders.length} degraded optional provider(s): ${degradedProviders.join(', ')} — routes that need them will fail at request time.`, + { degraded: degradedProviders }, ); } }; @@ -968,6 +1000,7 @@ function closeApp( streams: Set<() => void>, options: { timeoutMs?: number }, defaultTimeoutMs: number | undefined, + logger: Logger, ): Promise { return new Promise((resolve) => { // A mesh app booted through `app.fetch` has links but no server, and would leak every @@ -980,10 +1013,10 @@ function closeApp( // `serveDeno`/`serveBun` return a server with the same bounded `close({ timeoutMs })`. if (!server) { if (options.timeoutMs !== undefined) { - console.warn( - '[green-tea] close({ timeoutMs }) has no effect here — this app has no listen()ed ' + - 'server. On Deno and Bun, call close() on the server serveDeno()/serveBun() returned; ' + - 'it takes the same option. On the edge the platform owns the lifecycle.', + logger.warn( + 'close({ timeoutMs }) has no effect here — this app has no listen()ed server. On Deno ' + + 'and Bun, call close() on the server serveDeno()/serveBun() returned; it takes the ' + + 'same option. On the edge the platform owns the lifecycle.', ); } @@ -1003,9 +1036,9 @@ function closeApp( const timer = setTimeout(() => { if (settled) return; - console.warn( - `[green-tea] graceful shutdown timed out after ${timeoutMs}ms — ` + 'forcing remaining HTTP connections closed', - ); + logger.warn(`graceful shutdown timed out after ${timeoutMs}ms — forcing remaining HTTP connections closed`, { + timeoutMs, + }); // closeAllConnections() requires Node >=18.2, same floor as closeIdleConnections() // below — `engines` in package.json only guarantees >=18, so this matters. diff --git a/src/app/types.ts b/src/app/types.ts index d13c3b5..52e857d 100644 --- a/src/app/types.ts +++ b/src/app/types.ts @@ -1,5 +1,6 @@ import type http from 'http'; import type { Bus } from '../bus'; +import type { Logger } from '../logger'; import type { GraphNode } from '../graph'; import type { GraphView } from '../graph-viz'; import type { HttpMethod, Transport } from '../metadata'; @@ -62,6 +63,12 @@ export interface App { /** Names of optional providers that failed to boot and are running degraded (empty until {@link App.listen}). */ degraded(): string[]; bus: Bus; + /** + * Where framework diagnostics are written — the one passed to `createApp({ logger })`, or the + * default. Exposed so the Deno and Bun adapters report through the application's logger rather + * than reaching past it to `console`, and so a plugin or a test can read what core would write. + */ + logger: Logger; } /** Internal per-route plan: match criteria, its resolved provider/step closure, and the compiled handler. */ diff --git a/src/bun.ts b/src/bun.ts index 1824a5f..0857809 100644 --- a/src/bun.ts +++ b/src/bun.ts @@ -123,7 +123,10 @@ export function serveBun(app: App, options?: BunServeShortOptions): BunServeResu () => void server.stop(true), closeOptions.timeoutMs ?? 10_000, (ms) => - console.warn(`[green-tea] graceful shutdown timed out after ${ms}ms — forcing remaining connections closed`), + app.logger.warn(`graceful shutdown timed out after ${ms}ms — forcing remaining connections closed`, { + timeoutMs: ms, + runtime: 'bun', + }), ), }); } diff --git a/src/deno.ts b/src/deno.ts index cd9574a..809acce 100644 --- a/src/deno.ts +++ b/src/deno.ts @@ -90,10 +90,10 @@ export function serveDeno(app: App, options?: DenoServeOptions): DenoServer { () => {}, closeOptions.timeoutMs ?? 10_000, (ms) => - console.warn( - `[green-tea] graceful shutdown timed out after ${ms}ms — returning anyway. Deno cannot ` + - 'force-close a server that is already draining, so remaining connections end when the ' + - 'process does.', + app.logger.warn( + `graceful shutdown timed out after ${ms}ms — returning anyway. Deno cannot force-close ` + + 'a server that is already draining, so remaining connections end when the process does.', + { timeoutMs: ms, runtime: 'deno' }, ), ), }); diff --git a/src/index.ts b/src/index.ts index 2d51c16..22d1f79 100644 --- a/src/index.ts +++ b/src/index.ts @@ -58,6 +58,7 @@ export { // Bus & flow export { Bus } from './bus'; +export type { LifecycleEvent, EventPayload, Correlation } from './bus'; export { flow, Flow } from './flow'; export type { StepFn, CompiledFlow } from './flow'; @@ -65,6 +66,10 @@ export type { StepFn, CompiledFlow } from './flow'; export { needs, ctx, param, query, body, headers, header, inbound, abort } from './params'; export type { Query, Headers, Context, ArgSpec, ArgDecorator } from './params'; +// Observability +export { createDefaultLogger } from './logger'; +export type { Logger, LogLevel, LogFields } from './logger'; + // Streaming export { channel, isAsyncIterable } from './channel'; export type { Channel } from './channel'; diff --git a/src/logger.ts b/src/logger.ts new file mode 100644 index 0000000..5cd9beb --- /dev/null +++ b/src/logger.ts @@ -0,0 +1,80 @@ +/** + * The logging contract. Four levels, because four have callers: core diagnostics are all `warn` + * today, request logging adds `info` and `error`, and the graph diagnostics add `debug`. No + * `trace`, no `fatal`, no `silent` — a level nothing emits is a decision handed to the user for + * no reason. + */ +export type LogLevel = 'debug' | 'info' | 'warn' | 'error'; + +/** Structured context attached to a log record. Flattened into the JSON output alongside the message. */ +export type LogFields = Record; + +/** + * What `createApp({ logger })` accepts, and what core writes every diagnostic through. + * + * Message first, fields second, so a call reads as a sentence and the structured part stays + * optional. Bridging a `pino`- or `winston`-style logger is a four-line adapter in either + * direction; core defines the shape it needs rather than adopting anyone's. + */ +export interface Logger { + debug(message: string, fields?: LogFields): void; + info(message: string, fields?: LogFields): void; + warn(message: string, fields?: LogFields): void; + error(message: string, fields?: LogFields): void; +} + +/** + * Whether output should be human-readable rather than JSON. + * + * Decided once, when the logger is built, and never per call — the answer cannot change while the + * process runs, and asking on every record would put a syscall-shaped question on a path that is + * supposed to be cheap. `process` is absent on the edge, so the guard is not defensive padding: + * unattended is the correct default there, and JSON is the unattended format. + */ +function isInteractive(): boolean { + const proc = (globalThis as { process?: { stdout?: { isTTY?: boolean } } }).process; + return Boolean(proc?.stdout?.isTTY); +} + +const CONSOLE_METHOD: Record = { + debug: 'debug', + info: 'info', + warn: 'warn', + error: 'error', +}; + +function renderPretty(level: LogLevel, message: string, fields?: LogFields): string { + const pairs = fields + ? Object.entries(fields) + .filter(([, value]) => value !== undefined) + .map(([key, value]) => `${key}=${typeof value === 'string' ? value : JSON.stringify(value)}`) + : []; + + return `[green-tea] ${level.toUpperCase()} ${message}${pairs.length ? ' ' + pairs.join(' ') : ''}`; +} + +function renderJson(level: LogLevel, message: string, fields?: LogFields): string { + // `name` rather than the `[green-tea]` prefix the messages used to carry inline: a log + // aggregator filters on a field, and cannot filter on a substring of prose. + return JSON.stringify({ level, time: new Date().toISOString(), name: 'green-tea', msg: message, ...fields }); +} + +/** + * The logger used when `createApp` is given none: structured JSON, or human-readable on a TTY. + * + * Writes through `console`, which is the whole reason core can have a logging contract without a + * logging dependency — `reflect-metadata` stays the only runtime dependency, and anything richer + * (transports, sampling, rotation) is a `Logger` a user passes in. + */ +export function createDefaultLogger(pretty: boolean = isInteractive()): Logger { + const write = (level: LogLevel, message: string, fields?: LogFields): void => { + console[CONSOLE_METHOD[level]](pretty ? renderPretty(level, message, fields) : renderJson(level, message, fields)); + }; + + return { + debug: (message, fields) => write('debug', message, fields), + info: (message, fields) => write('info', message, fields), + warn: (message, fields) => write('warn', message, fields), + error: (message, fields) => write('error', message, fields), + }; +} diff --git a/test/logger.test.ts b/test/logger.test.ts new file mode 100644 index 0000000..1fb52c8 --- /dev/null +++ b/test/logger.test.ts @@ -0,0 +1,154 @@ +import { describe, it, expect, vi, afterEach } from 'vitest'; +import { createApp, createDefaultLogger, Route, Get, Step, Module, Provider, needs } from '../src/index'; +import type { Logger, LogFields } from '../src/index'; + +/** Captures every call so a test can assert on what core wrote rather than on console output. */ +function recordingLogger(): Logger & { records: Array<{ level: string; message: string; fields?: LogFields }> } { + const records: Array<{ level: string; message: string; fields?: LogFields }> = []; + const at = + (level: string) => + (message: string, fields?: LogFields): void => { + records.push({ level, message, fields }); + }; + + return { records, debug: at('debug'), info: at('info'), warn: at('warn'), error: at('error') }; +} + +afterEach(() => { + vi.restoreAllMocks(); +}); + +describe('default logger', () => { + it('writes one JSON object per record when not on a TTY', () => { + const spy = vi.spyOn(console, 'warn').mockImplementation(() => {}); + createDefaultLogger(false).warn('something happened', { route: '/x', count: 2 }); + + expect(spy).toHaveBeenCalledTimes(1); + const written = JSON.parse(spy.mock.calls[0][0] as string); + expect(written).toMatchObject({ level: 'warn', name: 'green-tea', msg: 'something happened', route: '/x', count: 2 }); + // A log aggregator filters on a field; it cannot filter on a substring of prose. + expect(written.msg).not.toContain('[green-tea]'); + expect(typeof written.time).toBe('string'); + }); + + it('writes a readable line instead when interactive', () => { + const spy = vi.spyOn(console, 'warn').mockImplementation(() => {}); + createDefaultLogger(true).warn('something happened', { route: '/x' }); + + const written = spy.mock.calls[0][0] as string; + expect(written).toBe('[green-tea] WARN something happened route=/x'); + }); + + it('routes each level to the matching console method', () => { + const spies = { + debug: vi.spyOn(console, 'debug').mockImplementation(() => {}), + info: vi.spyOn(console, 'info').mockImplementation(() => {}), + warn: vi.spyOn(console, 'warn').mockImplementation(() => {}), + error: vi.spyOn(console, 'error').mockImplementation(() => {}), + }; + const logger = createDefaultLogger(false); + logger.debug('d'); + logger.info('i'); + logger.warn('w'); + logger.error('e'); + + for (const spy of Object.values(spies)) expect(spy).toHaveBeenCalledTimes(1); + }); +}); + +describe('createApp({ logger })', () => { + @Route('/') + class Ctl { + @Get('/ok') + ok() { + return { ok: true }; + } + } + @Module({ mountpoint: '/', controllers: [Ctl] }) + class M {} + + it('sends framework diagnostics to the supplied logger, not to console', async () => { + const consoleWarn = vi.spyOn(console, 'warn').mockImplementation(() => {}); + const logger = recordingLogger(); + const app = createApp({ modules: [M], logger }); + + // close({ timeoutMs }) on an app that never listen()ed is one of the diagnostics core emits. + await app.close({ timeoutMs: 100 }); + + expect(logger.records).toHaveLength(1); + expect(logger.records[0].level).toBe('warn'); + expect(logger.records[0].message).toContain('has no listen()ed server'); + // The point of the contract: nothing reached console behind the logger's back. + expect(consoleWarn).not.toHaveBeenCalled(); + }); + + it('exposes the logger on the app so adapters and plugins share it', () => { + const logger = recordingLogger(); + expect(createApp({ modules: [M], logger }).logger).toBe(logger); + }); + + it('warns about a deep dependency chain through the logger, with structured fields', () => { + const logger = recordingLogger(); + + @Step({ provides: 's0' }) + class S0 { + run() { + return { s0: 0 }; + } + } + @Step({ provides: 's1', needs: ['s0'] }) + class S1 { + run() { + return { s1: 1 }; + } + } + @Route('/deep') + class DeepCtl { + @Get('/go') + go(@needs('s1') s: unknown) { + return { s }; + } + } + @Module({ mountpoint: '/', steps: [S0, S1], controllers: [DeepCtl] }) + class DeepModule {} + + createApp({ modules: [DeepModule], logger, warnGraphDepth: 1 }); + + const warned = logger.records.find((r) => r.message.includes('unusually deep')); + expect(warned).toBeDefined(); + // Structured, so a dashboard can group by route instead of parsing the sentence. + expect(warned!.fields).toMatchObject({ route: '/deep/go', method: 'GET', depth: 2, threshold: 1 }); + }); +}); + +describe('logger as a dependency', () => { + it('is injectable with @needs("logger") and is the same instance', async () => { + const logger = recordingLogger(); + let seen: unknown; + + @Provider({ provides: 'noop' }) + class Noop { + provide() { + return { noop: 1 }; + } + } + @Route('/') + class Ctl { + @Get('/log') + log(@needs('logger') injected: Logger) { + seen = injected; + injected.info('from a handler', { where: 'handler' }); + return { ok: true }; + } + } + @Module({ mountpoint: '/', providers: [Noop], controllers: [Ctl] }) + class M {} + + const app = createApp({ modules: [M], logger }); + await app.fetch(new Request('http://x/log')); + + // One object, two access paths — not a second logger wired into the graph. + expect(seen).toBe(logger); + expect(logger.records).toContainEqual({ level: 'info', message: 'from a handler', fields: { where: 'handler' } }); + }); +}); From e052d5ba8f3ab4922d42bd43531e6125b909d0b3 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 14:57:42 -0500 Subject: [PATCH 20/46] feat(observability): request-level events, and request logging that reads them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tasks 5 and 6, in that order rather than the plan's: request logging is a subscriber, so the events it subscribes to had to exist first. handle() now emits request:start, request:end, route:matched and route:unmatched. request:end fires when the handler returns, not when a stream it produced finishes — a streaming route is done here in milliseconds while its connection may live for hours, and ending the span at close would put hour-long SSE connections and 2ms buffered replies in one latency distribution. The stream events already describe the connection and now share the requestId. route:unmatched covers 404 and 405 both. Naming it after one outcome, as the report's route.not_found does, would misreport the other. logRequests(bus, logger) is the consumer: info per completed request, error per failed one, and it returns an unsubscribe so it is removable rather than merely optional. createApp({ logRequests: true }) turns it on and is off by default, because a framework that writes to stdout uninvited is one you have to configure before you can use it. withConsoleFallback wraps it, since Bus.emit isolates listener failures by design and a user logger that throws would otherwise stop writing with nothing to say so. A test proves both halves: the request still succeeds, and the failure still surfaces. The bus reaches handle() through HttpOptions so the Node and Fetch adapters share one channel instead of growing separate ones. Cost, measured: nothing. First attempt wrapped dispatch in a second async frame and that alone cost 0.43us per request — a promise and two microtask ticks, an order of magnitude more than the four Map lookups it was there to arrange. handle() is no longer async and hands back dispatch's own promise when nothing subscribes; 4.716-4.791us against 4.736-4.793 before, which is the same number. Signed-off-by: Diego Resendez --- src/app/index.ts | 14 +++++- src/bus.ts | 8 +++- src/http/core.ts | 103 +++++++++++++++++++++++++++++++++++++++++++- src/http/types.ts | 7 +++ src/index.ts | 2 +- src/logger.ts | 74 +++++++++++++++++++++++++++++++ test/logger.test.ts | 101 ++++++++++++++++++++++++++++++++++++++++++- 7 files changed, 303 insertions(+), 6 deletions(-) diff --git a/src/app/index.ts b/src/app/index.ts index 6d5c6ff..281f8be 100644 --- a/src/app/index.ts +++ b/src/app/index.ts @@ -1,6 +1,6 @@ import type http from 'http'; import { Bus } from '../bus'; -import { createDefaultLogger, type Logger } from '../logger'; +import { createDefaultLogger, logRequests, type Logger } from '../logger'; import { Container } from '../container'; import { topoSort, subgraphFor, GraphNode, nearest } from '../graph'; import { toMermaid, toDOT, graphHtml, type GraphView } from '../graph-viz'; @@ -121,6 +121,15 @@ export function createApp(opts: { * `@needs('logger')` — one object, two access paths. */ logger?: Logger; + /** + * Log one line per completed request, and one per failed one (default: off). + * + * Off by default because a framework that writes to stdout without being asked is a framework + * you have to configure before you can use it. On, it is a subscriber to the lifecycle stream + * like any other consumer — `logRequests(app.bus, app.logger)` does the same thing by hand and + * hands back an unsubscribe, so nothing here is reachable only through this flag. + */ + logRequests?: boolean; /** Opt in to alpha features whose API may still change. Currently gates `mesh`. */ experimental?: boolean; /** @@ -139,6 +148,7 @@ export function createApp(opts: { const bus = new Bus(); const logger = opts.logger ?? createDefaultLogger(); + if (opts.logRequests) logRequests(bus, logger); const container = new Container(); let server: http.Server | undefined; const streams = new Set<() => void>(); @@ -234,6 +244,7 @@ export function createApp(opts: { const staticResolver = opts.static ? buildStaticResolver(opts.static) : undefined; const fetchOpts: HttpOptions = { + bus, limits: opts.limits, tls: opts.tls, trustProxy: opts.trustProxy, @@ -264,6 +275,7 @@ export function createApp(opts: { const wsRoutes = buildWsRoutes(routePlans, deps); server = createHttpServer(httpRoutes, wsRoutes, bus, meshControl, { + bus, limits: opts.limits, streams, tls: opts.tls, diff --git a/src/bus.ts b/src/bus.ts index 5a3d229..f293bec 100644 --- a/src/bus.ts +++ b/src/bus.ts @@ -13,7 +13,13 @@ export type LifecycleEvent = | 'mesh:disconnect' | 'mesh:rpc:error' | 'plugin:mounted' - | 'request:failed'; + | 'request:start' + | 'request:end' + | 'request:failed' + | 'route:matched' + // Covers a 404 *and* a 405 — the report's `route.not_found` names one outcome and would + // misreport the other, and "no route ran" is the fact a consumer actually wants. + | 'route:unmatched'; /** * Data carried by a lifecycle event: the subject's name plus optional scope, error, timing and diff --git a/src/http/core.ts b/src/http/core.ts index cace5ff..fa99e72 100644 --- a/src/http/core.ts +++ b/src/http/core.ts @@ -7,6 +7,7 @@ import { resolveRoute, allowedMethods, normalizeRequestPath, parseQuery } from ' import { pickEncoder } from './stream'; import type { RouteDef, HttpOptions } from './types'; import type { StreamEncoder } from '../encoders'; +import type { Bus } from '../bus'; // The project tsconfig's `lib` is `es2020` with no `DOM`, so the Web Crypto global is undeclared // even though all four supported runtimes provide it. Ambient-declare only what is called — the @@ -153,15 +154,91 @@ async function unmatchedOutcome( return errorOutcome(error, req, injected, opts, allow.length ? { allow: allow.join(', ') } : {}); } +/** What `dispatch` learned along the way that `handle` needs in order to describe the request afterwards. */ +interface Trace { + route?: string; +} + /** * Runtime-neutral request handler: security/CORS headers, preflight short-circuit, route match / 404 / 405, * route-handler invocation with error rendering, and the buffered-vs-stream decision. Does no I/O — the * caller (a Node adapter, a fetch adapter, …) reads/writes the actual request/response. + * + * Wraps {@link dispatch} with the request-level lifecycle events. `request:end` fires when the handler + * returns, **not** when a stream it produced finishes: a route that returns an `AsyncIterable` is done + * here in milliseconds while its connection may live for hours, and ending the span at close would put + * hour-long SSE connections and 2 ms buffered replies in one latency distribution, ruining both. + * `stream:open`/`stream:close` already describe the connection, and now carry the same `requestId`. */ -export async function handle( +export function handle( routes: RouteDef[], opts: HttpOptions | undefined, req: NeutralRequest, +): Promise { + const bus = opts?.bus; + + // Deliberately not `async`. Wrapping `dispatch` in a second async frame costs a promise and two + // microtask ticks per request — measured at 0.43 us, an order of magnitude more than the four + // Map lookups this branch avoids. An unobserved app returns dispatch's own promise untouched. + if ( + bus === undefined || + !( + bus.hasListeners('request:start') || + bus.hasListeners('request:end') || + bus.hasListeners('route:matched') || + bus.hasListeners('route:unmatched') + ) + ) { + return dispatch(routes, opts, req, undefined, undefined); + } + + return observedDispatch(routes, opts, req, bus); +} + +async function observedDispatch( + routes: RouteDef[], + opts: HttpOptions | undefined, + req: NeutralRequest, + bus: Bus, +): Promise { + const watchingEnd = bus.hasListeners('request:end'); + const startedAt = watchingEnd ? performance.now() : 0; + const trace: Trace = {}; + + if (bus.hasListeners('request:start')) + bus.emit('request:start', { + name: `${req.method} ${req.url}`, + method: req.method, + requestId: req.requestId, + traceId: req.traceId, + }); + + const result = await dispatch(routes, opts, req, bus, trace); + + if (watchingEnd) { + // A preflight is a 204 the router never routed; a stream has no status of its own and is a 200 + // by the time anything is piped. + const status = 'preflight' in result ? 204 : result.outcome.kind === 'buffered' ? result.outcome.status : 200; + bus.emit('request:end', { + name: trace.route ?? `${req.method} ${req.url}`, + method: req.method, + route: trace.route, + status, + durationMs: performance.now() - startedAt, + requestId: req.requestId, + traceId: req.traceId, + }); + } + + return result; +} + +async function dispatch( + routes: RouteDef[], + opts: HttpOptions | undefined, + req: NeutralRequest, + bus: Bus | undefined, + trace: Trace | undefined, ): Promise { const injected = computeInjected(opts, req); let path: string; @@ -178,7 +255,29 @@ export async function handle( const matched = resolveRoute(routes, req.method, path); - if (!matched) return unmatchedOutcome(routes, opts, req, path, injected); + if (!matched) { + if (bus?.hasListeners('route:unmatched')) + bus.emit('route:unmatched', { + name: `${req.method} ${path}`, + method: req.method, + requestId: req.requestId, + traceId: req.traceId, + }); + + return unmatchedOutcome(routes, opts, req, path, injected); + } + + if (trace) trace.route = matched.def.pattern; + + if (bus?.hasListeners('route:matched')) + bus.emit('route:matched', { + name: matched.def.pattern, + route: matched.def.pattern, + method: req.method, + transport: matched.def.transport, + requestId: req.requestId, + traceId: req.traceId, + }); let result: PipelineResult; diff --git a/src/http/types.ts b/src/http/types.ts index 6b1af32..4e9d61f 100644 --- a/src/http/types.ts +++ b/src/http/types.ts @@ -4,6 +4,7 @@ import type { ErrorRenderer } from '../transformers'; import type { TlsOptions, SecurityOptions, CorsOptions } from '../security'; import type { WsRequest, WsSocket } from './ws-core'; import type { StaticResolver } from '../views'; +import type { Bus } from '../bus'; /** Per-request and per-server resource ceilings applied by the server. */ export interface RequestLimits { @@ -17,6 +18,12 @@ export interface RequestLimits { /** Options controlling server construction: limits, TLS, proxy trust, security headers, CORS, and body parsing. */ export interface HttpOptions { + /** + * Lifecycle events go here. Carried on the options rather than as a parameter so `handle()` — + * the one place both the Node and Fetch adapters meet — can emit without either adapter growing + * a separate channel for it. + */ + bus?: Bus; limits?: RequestLimits; streams?: Set<() => void>; tls?: TlsOptions; diff --git a/src/index.ts b/src/index.ts index 22d1f79..031a099 100644 --- a/src/index.ts +++ b/src/index.ts @@ -67,7 +67,7 @@ export { needs, ctx, param, query, body, headers, header, inbound, abort } from export type { Query, Headers, Context, ArgSpec, ArgDecorator } from './params'; // Observability -export { createDefaultLogger } from './logger'; +export { createDefaultLogger, logRequests, withConsoleFallback } from './logger'; export type { Logger, LogLevel, LogFields } from './logger'; // Streaming diff --git a/src/logger.ts b/src/logger.ts index 5cd9beb..81e2344 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -1,3 +1,5 @@ +import type { EventPayload } from './bus'; + /** * The logging contract. Four levels, because four have callers: core diagnostics are all `warn` * today, request logging adds `info` and `error`, and the graph diagnostics add `debug`. No @@ -59,6 +61,78 @@ function renderJson(level: LogLevel, message: string, fields?: LogFields): strin return JSON.stringify({ level, time: new Date().toISOString(), name: 'green-tea', msg: message, ...fields }); } +/** + * Wraps a logger so a throwing one cannot go silent. + * + * `Bus.emit` isolates listener failures on purpose — an observer must never be able to break a + * request — but that guarantee has a cost when the observer is the logger itself: a user logger + * that throws would simply stop writing, with nothing to say so. Falling back to `console` keeps + * the Bus's promise without paying for it in silence. + * + * Exported because request logging is not the only thing that should survive a broken logger. + */ +export function withConsoleFallback(logger: Logger): Logger { + const guard = + (level: LogLevel) => + (message: string, fields?: LogFields): void => { + try { + logger[level](message, fields); + } catch (error) { + console.error( + renderJson('error', 'the configured logger threw; falling back to console', { + level, + originalMessage: message, + error: error instanceof Error ? error.message : String(error), + ...fields, + }), + ); + } + }; + + return { debug: guard('debug'), info: guard('info'), warn: guard('warn'), error: guard('error') }; +} + +/** + * Subscribes request logging to the lifecycle stream: `info` per completed request, `error` per + * failed one. Returns an unsubscribe function, so it is as removable as it is composable — which + * is what "a composable step, not a global middleware" has to mean in practice. + * + * Reads the stream rather than being called from the request path, so there is exactly one account + * of what happened to a request. A second path would eventually disagree with the first. + */ +export function logRequests(bus: BusLike, logger: Logger): () => void { + const safe = withConsoleFallback(logger); + const offEnd = bus.on('request:end', (event) => { + safe.info(`${event.method ?? ''} ${event.route ?? event.name} ${event.status ?? ''}`.trim(), { + requestId: event.requestId, + traceId: event.traceId, + route: event.route, + method: event.method, + status: event.status, + durationMs: event.durationMs, + }); + }); + const offFailed = bus.on('request:failed', (event) => { + safe.error(`${event.method ?? ''} ${event.route ?? event.name} failed`.trim(), { + requestId: event.requestId, + traceId: event.traceId, + route: event.route, + method: event.method, + error: event.error instanceof Error ? event.error.message : event.error, + }); + }); + + return () => { + offEnd(); + offFailed(); + }; +} + +/** The slice of {@link Bus} request logging needs — `on` only, matching what a plugin is handed. */ +interface BusLike { + on(event: 'request:end' | 'request:failed', listener: (payload: EventPayload) => void): () => void; +} + /** * The logger used when `createApp` is given none: structured JSON, or human-readable on a TTY. * diff --git a/test/logger.test.ts b/test/logger.test.ts index 1fb52c8..665bcbc 100644 --- a/test/logger.test.ts +++ b/test/logger.test.ts @@ -1,5 +1,5 @@ import { describe, it, expect, vi, afterEach } from 'vitest'; -import { createApp, createDefaultLogger, Route, Get, Step, Module, Provider, needs } from '../src/index'; +import { createApp, createDefaultLogger, logRequests, Route, Get, Step, Module, Provider, needs } from '../src/index'; import type { Logger, LogFields } from '../src/index'; /** Captures every call so a test can assert on what core wrote rather than on console output. */ @@ -121,6 +121,105 @@ describe('createApp({ logger })', () => { }); }); +describe('request logging', () => { + @Route('/api') + class Ctl { + @Get('/ok') + ok() { + return { ok: true }; + } + @Get('/boom') + boom(): never { + throw new Error('handler exploded'); + } + } + @Module({ mountpoint: '/', controllers: [Ctl] }) + class M {} + + it('is off unless asked for', async () => { + const logger = recordingLogger(); + const app = createApp({ modules: [M], logger }); + + await app.fetch(new Request('http://x/api/ok')); + + // A framework that writes to stdout uninvited is one you must configure before using. + expect(logger.records).toHaveLength(0); + }); + + it('logs one info per completed request, with the pattern and a duration', async () => { + const logger = recordingLogger(); + const app = createApp({ modules: [M], logger, logRequests: true }); + + await app.fetch(new Request('http://x/api/ok')); + + expect(logger.records).toHaveLength(1); + const [record] = logger.records; + expect(record.level).toBe('info'); + expect(record.fields).toMatchObject({ route: '/api/ok', method: 'GET', status: 200 }); + expect(typeof record.fields!.requestId).toBe('string'); + expect(record.fields!.durationMs).toBeGreaterThanOrEqual(0); + }); + + it('logs an error for a failed request, correlated with it', async () => { + const logger = recordingLogger(); + const app = createApp({ modules: [M], logger, logRequests: true }); + + await app.fetch(new Request('http://x/api/boom')); + + const failed = logger.records.find((r) => r.level === 'error'); + expect(failed).toBeDefined(); + expect(failed!.fields).toMatchObject({ route: '/api/boom', error: 'handler exploded' }); + + // Same request, so the failure and the completion carry one identity between them. + const completed = logger.records.find((r) => r.level === 'info'); + expect(completed!.fields!.requestId).toBe(failed!.fields!.requestId); + }); + + it('unsubscribes, so it is removable and not just optional', async () => { + const logger = recordingLogger(); + const app = createApp({ modules: [M], logger }); + const stop = logRequests(app.bus, logger); + + await app.fetch(new Request('http://x/api/ok')); + expect(logger.records).toHaveLength(1); + + stop(); + await app.fetch(new Request('http://x/api/ok')); + expect(logger.records).toHaveLength(1); + }); + + it('keeps writing, and keeps serving, when the logger throws on every call', async () => { + const consoleError = vi.spyOn(console, 'error').mockImplementation(() => {}); + const exploding: Logger = { + debug: () => { + throw new Error('logger is broken'); + }, + info: () => { + throw new Error('logger is broken'); + }, + warn: () => { + throw new Error('logger is broken'); + }, + error: () => { + throw new Error('logger is broken'); + }, + }; + const app = createApp({ modules: [M], logger: exploding, logRequests: true }); + + const res = await app.fetch(new Request('http://x/api/ok')); + + // The request is unharmed: Bus.emit isolates listener failures by design. + expect(res.status).toBe(200); + expect(await res.json()).toEqual({ ok: true }); + + // And the failure is not silent, which is what the wrapper buys on top of that guarantee. + expect(consoleError).toHaveBeenCalled(); + const written = JSON.parse(consoleError.mock.calls[0][0] as string); + expect(written.msg).toContain('the configured logger threw'); + expect(written.error).toBe('logger is broken'); + }); +}); + describe('logger as a dependency', () => { it('is injectable with @needs("logger") and is the same instance', async () => { const logger = recordingLogger(); From 92987d0a245477c99bbec3a9e4bb08fffca61197 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 15:06:54 -0500 Subject: [PATCH 21/46] docs(observability): document the contract, and retire the sentence that denied it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task 8. README.md led its Honest scope section with "No observability layer, either." — the single most load-bearing sentence in the CTO assessment, and now false. It says what exists instead, and keeps being explicit about what does not: no metrics registry and no OpenTelemetry exporter in core, because core has one runtime dependency and intends to keep it. Adds a guide covering the parts that are contracts rather than implementation details, since those are the ones a reader gets wrong: route labels carry the pattern and never the concrete path (labelling metrics on raw URLs is how you take down a metrics backend), request:end fires when the handler returns rather than when a stream closes, and streams emit lifecycle events only. The plugins guide was titled "Plugins & observability" and carried a partial event list that had already drifted. It now covers plugins and points at the guide for the vocabulary, with the correlation note it was missing. Includes the measured cost, because a performance claim without a number is marketing: -3.9% on JSON hello, -2.1% on a three-step pipeline, and the reason the shallower route loses more. Signed-off-by: Diego Resendez --- README.md | 6 +- website/astro.config.mjs | 3 +- .../src/content/docs/guides/observability.md | 143 ++++++++++++++++++ website/src/content/docs/guides/plugins.md | 12 +- .../src/content/docs/reference/createapp.md | 5 +- 5 files changed, 163 insertions(+), 6 deletions(-) create mode 100644 website/src/content/docs/guides/observability.md diff --git a/README.md b/README.md index fa20e91..77cf5a2 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,7 @@ Beta shipped the parts a real API needs, without growing the runtime dependency - **Errors, your way.** Throw typed errors (`Unauthorized`, `NotFound`, `HttpError(status, msg, body?)`) anywhere; they convert centrally to `4xx`/`5xx`. Render them however you like — HTML, RFC 7807, content-negotiated — with a single `createApp({ onError })` hook that covers every error response. - **HTML without a view layer.** `@Html` returns a string, serves a file, or renders one with the built-in `{{ }}` template engine — swap in EJS or handlebars with `createApp({ viewEngine })`. `createApp({ static: true })` serves `./public` with path-traversal guards and no mime dependency. - **Ceilings that are already on.** `limits` caps body size (`413`), multipart parts, concurrent Node connections (default `1000`; `<= 0` leaves connections unlimited), and the request / headers / keep-alive timeouts — defaulting to `30s` / `10s` / `5s`, tighter than Node's own two-minute default. When Node's connection cap is reached, excess sockets are destroyed without an HTTP response. Deno and Bun expose no equivalent active-socket cap, so enforce one at the deployment platform or reverse proxy there. Configurable, and safe before you configure anything. +- **Observability without an integration.** Every request carries an id and a trace id through every lifecycle event, each step reports its own duration, and `createApp({ logger })` accepts any logger — the default writes structured JSON. Nothing in core writes to `console`. Metrics and tracing exporters read the same stream from outside core. - **Graceful shutdown, with a deadline.** `app.close()` drains in-flight requests and closes live streams and mesh links, then warns and force-closes whatever is still open after 10 seconds — so a stuck handler cannot hold a deploy open forever. Change the number per call with `close({ timeoutMs })` or for the whole app with `createApp({ shutdownTimeoutMs })`. `app.close()` is Node-only; on Deno and Bun the server `serveDeno()`/`serveBun()` returns carries the same `close({ timeoutMs })`. - **Testable by construction.** `createApp({ overrides: { db: fakeDb } })` swaps any node in one line. - **Dual ESM + CommonJS.** Ships both builds behind an `exports` map — `import` and `require` both resolve, with matching type declarations. @@ -243,7 +244,9 @@ green-tea is **beta**, on the road to a release candidate. Express and Fastify h **Bring your own auth (and friends).** green-tea ships transport security — TLS/wss, secure-by-default headers, CORS — but **not** authentication, authorization, rate-limiting, CSRF, or sessions. You compose those as steps and plugins (the `Authenticate` step in the quick look is the pattern). Unlike Express/Fastify, there is no off-the-shelf plugin ecosystem for them yet. -**No observability layer, either.** There is no built-in logger, no metrics export, and no tracing hooks; core does not depend on a logging library and does not intend to. Today you compose those as steps and providers like anything else. A first-class contract — an injectable logger, structured output, and hooks an OpenTelemetry exporter can attach to — is [tracked as one design](https://github.com/Expressive-Tea/green-tea/issues/10), because doing it piecemeal produces three mechanisms that don't fit together. If your team's definition of production-ready includes shipping traces on day one, this is the gap to know about. +**Observability is a contract, not an integration.** Core emits a correlated lifecycle event stream — every request gets an id (an incoming `x-request-id` is adopted, not replaced), every event carries it, and each step reports its own duration. `createApp({ logger })` takes any logger; the default writes structured JSON, or a readable line on a TTY. Nothing in core writes to `console`, which is enforced by a lint rule rather than a promise. `createApp({ logRequests: true })` logs a line per request, off by default. + +**What is not here:** no metrics registry, and **no OpenTelemetry exporter in core** — that is a separate package, because core has one runtime dependency and intends to keep it. A `traceparent` header is carried through untouched for an exporter to interpret; core implements no propagation spec. If your definition of production-ready includes shipping traces on day one, you are writing the exporter, and the stream it needs is the part that now exists. **Runtimes differ in what they can offer.** Node ≥ 18, Deno, and Bun run everything. On the edge (Cloudflare Workers) there is no `app.listen()`, no filesystem — so `@Html` file/template modes and `static` serving are unavailable — and mesh does not run there at all (the teapot's secret comparison needs `node:crypto`'s `timingSafeEqual`, which `nodejs_compat` doesn't provide). Workers also require the `nodejs_compat` flag. @@ -276,6 +279,7 @@ npm run docs:dev # the documentation site (website/) - ✅ **runs everywhere** — Node, Deno, Bun, and Cloudflare Workers over web-standard `Request`/`Response`, with identical WebSocket behaviour on all four. Every CI run exercises all four; the Deno, Bun, and workerd suites gate a merge exactly as the Node one does. - ✅ **HTML** — `@Html` (string / file / template), a built-in template engine with a bring-your-own `viewEngine` hook, and `static` serving. - ✅ **router completeness for beta** — safe constrained params, deterministic precedence, explicit/automatic HEAD and OPTIONS, strict path validation, and ambiguity checks across local and mesh routes. +- ✅ **observability** — a correlated lifecycle event stream (request id, trace id, route pattern, per-step timings) and an injectable `Logger`. Exporters live outside core. - **next** — API freeze + first published release, mesh sub-specs (discovery, load-balancing, failover), official plugins, and a radix-tree matcher for very large route tables. ## Versioning diff --git a/website/astro.config.mjs b/website/astro.config.mjs index 08a4657..cce1f39 100644 --- a/website/astro.config.mjs +++ b/website/astro.config.mjs @@ -55,7 +55,8 @@ export default defineConfig({ { label: 'File uploads', slug: 'guides/uploads' }, { label: 'HTML & views', slug: 'guides/html' }, { label: 'Transport security', slug: 'guides/security' }, - { label: 'Plugins & observability', slug: 'guides/plugins' }, + { label: 'Plugins', slug: 'guides/plugins' }, + { label: 'Observability', slug: 'guides/observability' }, { label: 'Graph introspection', slug: 'guides/introspection' }, { label: 'OpenAPI', slug: 'guides/openapi' }, { label: 'Runtimes', slug: 'guides/runtimes' }, diff --git a/website/src/content/docs/guides/observability.md b/website/src/content/docs/guides/observability.md new file mode 100644 index 0000000..45a19fa --- /dev/null +++ b/website/src/content/docs/guides/observability.md @@ -0,0 +1,143 @@ +--- +title: Observability +description: A correlated lifecycle event stream, an injectable logger, and where exporters go. +--- + +green-tea does not integrate with an observability vendor. It emits a **correlated event stream** and +lets you read it. A logger, a metrics exporter and a tracing bridge are three consumers of that one +stream — not three features, which is why they are one design. + +The rule that shapes all of it: core has one runtime dependency, `reflect-metadata`, and keeps it. +Nothing here imports an exporter. + +## Correlation + +Every request gets an id. Every event it causes carries that id. + +```ts +app.bus.on('request:step:leave', (event) => { + event.requestId; // "9f0c…" — the same value on every event of this request + event.route; // "/users/:id" — the pattern, never the concrete path + event.durationMs; // how long this step took +}); +``` + +Without that id the stream is unusable under any concurrency: two requests interleave their step +events and nothing tells you which is which. + +**An incoming `x-request-id` is adopted, not replaced.** A service behind a gateway must not open a +second identity for a request that already has one. + +**A `traceparent` header is carried through untouched** as `traceId`. Core parses nothing and +implements no propagation spec — W3C Trace Context belongs to the exporter that understands it. + +### `route` is the pattern, always + +`route` is `/users/:id`, never `/users/42`. This is a contract, not an implementation detail: a +metrics consumer that labels a counter with the concrete path gets one label per distinct URL, and +unbounded label cardinality takes down the metrics backend rather than the application. + +## The events + +| Event | When | +|---|---| +| `request:start` / `request:end` | a request enters and leaves the handler | +| `request:failed` | the request produced an error | +| `route:matched` / `route:unmatched` | a route matched, or none did (covers **404 and 405**) | +| `request:step:enter` / `:leave` / `:error` | one step of the pipeline | +| `boot:provider:start` / `:ok` / `:fail` | a provider booting | +| `stream:open` / `:close` / `:error` | an SSE, ndjson or WebSocket connection | +| `mesh:connect` / `:disconnect` / `:rpc:error` | mesh links | +| `plugin:mounted` | a plugin registered | + +### Where a streaming request ends + +`request:end` fires **when the handler returns**, not when a stream it produced finishes. + +A streaming route returns in milliseconds while its connection may live for hours. Ending the +request span at stream close would put hour-long SSE connections and 2 ms buffered replies in one +latency distribution, ruining both. The connection is described by `stream:open` / `stream:close`, +which carry the same `requestId` — so you can join the two yourself, and you get a meaningful +latency histogram either way. + +### Streams do not emit per message + +Lifecycle only. A per-message event on a high-rate stream is a firehose that costs more than it +reports, and the cost lands on the workload least able to absorb it. Instrument your own handler if +you need it, where you know what the messages mean. + +## The logger + +```ts +const app = createApp({ modules: [AppModule], logger: myLogger }); +``` + +Any object with `debug`, `info`, `warn` and `error` — each taking a message and optional structured +fields. Bridging `pino` or `winston` is a few lines in either direction; core defines the shape it +needs rather than adopting anyone's. + +Given none, the default writes structured JSON, or a human-readable line when the process is +attached to a TTY — decided once at boot, not per record. + +**Nothing in core writes to `console`.** That is enforced by a lint rule, not by good intentions, so +every framework diagnostic is redirectable. + +The logger is also injectable: + +```ts +@Step({ provides: 'user', needs: ['db'] }) +class LoadUser { + run(@needs('logger') log: Logger) { … } +} +``` + +Same object, two access paths. It is registered rather than declared as a provider because it has to +outlive the graph on both ends: a provider cannot report its own boot failing, and shutdown warnings +happen after the graph is gone. + +## Request logging + +Off by default. A framework that writes to stdout uninvited is one you have to configure before you +can use it. + +```ts +createApp({ modules: [AppModule], logRequests: true }); +``` + +It is an ordinary subscriber, so you can do it by hand and take it back: + +```ts +import { logRequests } from '@green-tea/core'; + +const stop = logRequests(app.bus, app.logger); +stop(); // removable, not merely optional +``` + +A logger that throws does **not** silently stop writing: the subscriber is wrapped so failures fall +back to `console`. `Bus.emit` isolates listener failures by design — an observer must never break a +request — and the wrapper keeps that guarantee without paying for it in silence. + +## Metrics and tracing + +There is no metrics registry in core and no OpenTelemetry exporter in core. Both read the stream +above from outside: + +```ts +app.bus.on('request:end', (e) => histogram.observe(e.durationMs, { route: e.route, status: e.status })); +``` + +Per-step timings are already on the events, so a per-node timing breakdown needs no extra +instrumentation — the graph already knows every node. + +## What it costs + +Measured, not asserted, on the box that produced [BENCHMARKS.md](https://github.com/Expressive-Tea/green-tea/blob/main/BENCHMARKS.md): + +| Scenario | Before | After | | +|---|---:|---:|---:| +| JSON hello | 78,118 req/s | 75,075 req/s | −3.9% | +| Pipeline (3 steps) | 70,671 req/s | 69,164 req/s | −2.1% | + +The cost is **per request, not per step** — which is why the route with *fewer* steps loses more. +Most of it is generating the request id; per-step timing and payload construction are skipped +entirely when nothing is subscribed. diff --git a/website/src/content/docs/guides/plugins.md b/website/src/content/docs/guides/plugins.md index 0047ede..a1cdc13 100644 --- a/website/src/content/docs/guides/plugins.md +++ b/website/src/content/docs/guides/plugins.md @@ -1,5 +1,5 @@ --- -title: Plugins & observability +title: Plugins description: "Extending the app safely via bus.on and scope.add." --- @@ -45,14 +45,20 @@ api.bus.on('request:step:enter', (p: any) => { /* ... */ }); api.bus.on('request:step:leave', (p: any) => { /* ... */ }); ``` -The full event vocabulary: +The full event vocabulary, what each payload carries, and how requests are correlated across +them live in [Observability](/docs/guides/observability/). The short version: +- `request:start | request:end | request:failed` — the request itself +- `route:matched | route:unmatched` — routing (`unmatched` covers both 404 and 405) +- `request:step:*` — a step entering/exiting/failing, with its own `durationMs` - `boot:provider:*` — provider lifecycle during boot -- `request:step:*` — a step entering/exiting during a request - `stream:open | stream:close | stream:error` — SSE/WS stream lifecycle - `mesh:connect | mesh:disconnect | mesh:rpc:error` — mesh link and RPC activity - `plugin:mounted` — a plugin finished mounting +Every per-request payload carries a `requestId`, so a plugin can attribute events to the request +that caused them — which matters the moment two requests overlap. + Observation is read-only: handlers see the event payload but can't alter control flow. To change behavior, contribute a node to your scope — see [Dependency injection](/docs/guides/dependency-injection/). diff --git a/website/src/content/docs/reference/createapp.md b/website/src/content/docs/reference/createapp.md index 77726c0..937e556 100644 --- a/website/src/content/docs/reference/createapp.md +++ b/website/src/content/docs/reference/createapp.md @@ -26,6 +26,8 @@ const app = createApp(options); | `views` | `string` | `process.cwd()` | base dir `@Html('file.html')` paths resolve against — relative paths join it, absolute paths are used as-is ([HTML & views](/docs/guides/html/)) | | `viewEngine` | `(source: string, data: unknown) => string` | built-in `render` | swap in your own template engine for `@Html(..., { template: true })`; template mode only ([HTML & views](/docs/guides/html/)) | | `static` | `boolean \| string` | — | serve a directory as a `GET`/`HEAD` fallback (after declared routes, before `404`); `true` → `./public`, a string → that dir; path-traversal-safe; needs a filesystem — Node/Deno/Bun only ([HTML & views](/docs/guides/html/)) | +| `logger` | `Logger` | structured JSON (readable on a TTY) | where every framework diagnostic is written; also injectable as `@needs('logger')` ([observability](/docs/guides/observability/)) | +| `logRequests` | `boolean` | `false` | log one line per completed request and per failure; a removable Bus subscriber, not a middleware ([observability](/docs/guides/observability/)) | | `shutdownTimeoutMs` | `number` | `10_000` | how long `close()` gives in-flight work before forcing the rest shut; `close({ timeoutMs })` still wins per call. Set it here when `close()` is reached from a signal handler or shutdown hook you do not own ([runtimes](/docs/guides/runtimes/)) | | `mesh` | `MeshConfig` | — | distributed DI — **requires `experimental: true`** ([mesh](/docs/guides/mesh/)) | | `experimental` | `boolean` | `false` | opt in to alpha features (currently gates `mesh`) | @@ -75,7 +77,8 @@ const app = createApp(options); | `toMermaid()` / `toDOT()` | `string` | render the graph | | `openapi(info?)` | `OpenApiDoc` | structural OpenAPI 3.1 document ([details](/docs/guides/openapi/)) | | `degraded()` | `string[]` | optional providers running degraded (empty until providers boot through `fetch`, `upgrade`, or `listen`) | -| `bus` | `Bus` | lifecycle + request event bus | +| `bus` | `Bus` | lifecycle + request event bus ([observability](/docs/guides/observability/)) | +| `logger` | `Logger` | the app's logger — the one passed in, or the default | :::note On mesh apps, `graph` / `explain` / `inspect` / `degraded` are only available after `ready()` or the first serving call — the graph is finalized once remote scopes connect. From 523e3184b01eac24b77f94eb0b76f39ebd593802 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 15:07:39 -0500 Subject: [PATCH 22/46] docs(plans): record that the timing model was wrong in shape, not just magnitude MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit D7 predicted ~0.25% per step and called it invisible. Measured over a real socket it is -3.9% on JSON hello and -2.1% on a three-step pipeline: the route with *fewer* steps loses more, which falsifies a per-step model rather than just its constant. Per-step work is skipped when nothing subscribes, so what remains is a fixed per-request cost that a shallow route amortises over less. The decision survived, for a better reason than it was made with: there is nothing per-step left to make optional. Also records the two regressions that measurement caught and reasoning did not, both larger than anything the design anticipated — a second async frame in handle() at 0.43us per request, and a closure allocated per request inside correlateRequest at 0.16us. On this path an extra promise costs more than any amount of bookkeeping. Signed-off-by: Diego Resendez --- docs/plans/2026-08-16-observability-design.md | 2 ++ docs/plans/2026-08-16-observability-plan.md | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/docs/plans/2026-08-16-observability-design.md b/docs/plans/2026-08-16-observability-design.md index bcdc317..ffaaf52 100644 --- a/docs/plans/2026-08-16-observability-design.md +++ b/docs/plans/2026-08-16-observability-design.md @@ -149,6 +149,8 @@ Two things follow. `Date.now()` loses on both axes — slower *and* coarser — At 0.25% per step the overhead sits **below the 0.3% run-to-run CV of the project's own benchmark**, so it is not measurable in the harness that would have to justify a flag. Making it opt-in would buy two code paths and a configuration surface in exchange for something nobody can observe. Always on. +> **Correction, after implementation.** This decision survived; its reasoning did not. Measured over a real socket the cost is **−3.9% on JSON hello and −2.1% on a three-step pipeline** — the shallower route loses *more*, which is the opposite of a per-step model. Per-step work is skipped entirely when nothing subscribes; what is left is a fixed per-request cost. "Always on" is still right, and for a better reason: there is nothing per-step left to make optional. See Task 7 in the implementation plan. + ### D8 — Request logging is a `Bus` subscriber, wrapped so a failing logger cannot go silent The logger is a callable sink either way — the 8 direct diagnostics (shutdown timeout, degraded provider) are not events and need one regardless. The decision is only about request logging, and it goes through the event stream: one path, and it is composable and removable exactly as #10 asks for ("a composable step, not a global middleware"). diff --git a/docs/plans/2026-08-16-observability-plan.md b/docs/plans/2026-08-16-observability-plan.md index eddbb1e..2dead70 100644 --- a/docs/plans/2026-08-16-observability-plan.md +++ b/docs/plans/2026-08-16-observability-plan.md @@ -111,12 +111,26 @@ Tasks 1–3 are the correction; 4–6 are what consumes it. Do not start 4 befor **Step 4:** `route` on every payload is the **matched pattern**, never the concrete path. A metrics consumer labelling on raw URLs produces unbounded cardinality and takes down the metrics backend; the framework must not hand anyone that shape by default. -### Task 7: Benchmark, and publish the number +### Task 7: Benchmark, and publish the number — **DONE; D7 was wrong in shape** **Files:** - Modify: `BENCHMARKS.md` -`npm run bench` before and after, same box, same run. D7 predicts ~0.25% per step and predicts it is invisible against a 0.3% CV. If the measurement disagrees with the design, the design is what changes — say so rather than quietly keeping the code. +D7 predicted ~0.25% **per step**, invisible against the harness's own 0.3% CV. Measured over a real socket, on the box `BENCHMARKS.md` was produced on, same server config both sides: + +| Scenario | Before | After | | +|---|---:|---:|---:| +| JSON hello | 78,118 req/s | 75,075 req/s | −3.9% | +| Pipeline (3 steps) | 70,671 req/s | 69,164 req/s | −2.1% | + +**The route with fewer steps loses more**, which falsifies the model rather than only the number. The per-step cost is real but is skipped entirely when nothing subscribes (`Bus.hasListeners`); what remains is a **fixed per-request** cost — generating the request id, reading two headers, and the guard checks. A shallow route amortises that over less work, so it shows up larger. + +Two regressions were found and fixed by measuring rather than reasoning, both larger than anything the design anticipated: + +- **A second `async` frame in `handle()` cost 0.43 µs/request** — a promise and two microtask ticks, an order of magnitude more than the four `Map` lookups it existed to arrange. `handle()` is no longer `async`. +- **A closure allocated per request inside `correlateRequest`** cost 0.16 µs, 45% of the then-remaining overhead, for a helper capturing nothing. + +Recorded here because the lesson generalises: on this path, an extra promise costs more than any amount of bookkeeping, and a hot-path prediction reasoned from primitive costs was off by more than 10×. ### Task 8: Documentation From 86dd3fe9b681ce59966564f6c35d6dd652010d25 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 22:44:35 -0500 Subject: [PATCH 23/46] perf(router): stop decoding every path segment to throw the result away MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit normalizeRequestPath ran on every request and validated percent-encoding by splitting the path and calling decodeURIComponent on each segment, discarding every result — matching is done on the raw path. Two array allocations and one decodeURIComponent per segment, per request, to prove that a string nobody decodes could be decoded. Measured in isolation: 95.8ns for /hello, 342.7ns for a six-segment route. The guard costs 15.7ns and 6.7ns for the same two paths. Same validation. decodeURIComponent throws on the first malformed % sequence wherever it appears, so one call on the whole string catches what per-segment calls caught, and %2F inside a segment decodes fine either way. Only the throw was ever used. The existing tests for malformed encoding and repeated slashes pass unchanged. Found by sweeping all 178 commits between fe1831a and the observability work after the regenerated benchmark showed green-tea down ~20% since July while raw-http, fastify and nestjs-fastify reproduced their July numbers within 1.4% on the same run. The sweep put a +11.8% step at 9a61ba8 "complete HEAD and OPTIONS semantics", which is where this function entered the request path. Effect: -6.2% in-process request latency, from twelve interleaved measurements whose ranges do not overlap (OLD 4.253-4.425us, FIX 4.035-4.151us). A first attempt measured with-then-without and produced the opposite sign, so the interleaving is load-bearing, not ceremony. Expect roughly 2% over a real socket, which is below that harness's own noise floor. Signed-off-by: Diego Resendez --- src/http/router.ts | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/http/router.ts b/src/http/router.ts index de3b350..fdaae6e 100644 --- a/src/http/router.ts +++ b/src/http/router.ts @@ -169,10 +169,23 @@ export function normalizeRequestPath(path: string): string { if (path.includes('//')) throw new InvalidRequestPathError('invalid request path: repeated slash'); const normalized = path.length > 1 && path.endsWith('/') ? path.slice(0, -1) : path; - try { - for (const segment of normalized.split('/').slice(1)) decodeURIComponent(segment); - } catch { - throw new InvalidRequestPathError('invalid request path: malformed path encoding'); + // Validation only — the decoded value is deliberately discarded, matching is done on the raw + // path. So the work is skipped entirely unless there is something to validate. + // + // This used to split the path and call `decodeURIComponent` per segment, on every request, and + // throw all of it away. Measured on this path: 95.8 ns for `/hello`, 342.7 ns for a six-segment + // route — around 8% of a whole request, spent proving that a string nobody decodes could be + // decoded. The guard below is 15.7 ns and 6.7 ns for the same two paths. + // + // One call on the whole string rather than per segment is the same check: `decodeURIComponent` + // throws on the first malformed `%` sequence wherever it appears, and a `%2F` inside a segment + // decodes fine either way. Only the throw matters here, never the result. + if (normalized.includes('%')) { + try { + decodeURIComponent(normalized); + } catch { + throw new InvalidRequestPathError('invalid request path: malformed path encoding'); + } } return normalized; From 0c5decbeaee7d189e0aa6197668efd0b1a6409c6 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 22:55:46 -0500 Subject: [PATCH 24/46] perf(router): skip query parsing when there is no query string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit parseQuery ran on every request. For a URL without a `?` it split the string, built a URLSearchParams from '', looped zero times and returned {} — three allocations to arrive at an empty object, on the majority of requests. 92.3ns before, 18.6ns after, in isolation. End to end: -3.1% request latency over five interleaved rounds. Only the guard is new. Switching the parse itself to indexOf + slice would drop another allocation, but it changes what a second `?` in a URL means, and that is a behaviour question that does not belong in a performance commit. Found by CPU-profiling the request path rather than guessing. Worth recording what that profile showed: almost nothing in it is green-tea. Building the web-standard Request/Response/Headers in undici dominates — appendHeader alone is 5.2%, Response construction 2.8%, stream state 4.5%, GC 5% — while the only green-tea frames above 1.5% were mergeInjectedHeaders at 2.6% and this at 1.8%. The per-request cost of app.fetch is mostly the price of returning a real Response, not framework logic. mergeInjectedHeaders is the next candidate: it rebuilds a lowercased Set of the injected header keys on every response, and those keys are fixed for the life of the app. Signed-off-by: Diego Resendez --- src/http/router.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/http/router.ts b/src/http/router.ts index fdaae6e..8dce901 100644 --- a/src/http/router.ts +++ b/src/http/router.ts @@ -304,6 +304,15 @@ export function allowedMethods(routes: RouteDef[], path: string): string[] { /** Parses a URL's query string into a flat string map (last value wins for repeated keys). */ export function parseQuery(url: string): Record { + // Most requests carry no query string, and the work below is not free for them: `split` builds + // an array, `new URLSearchParams('')` builds an object, and the loop runs zero times — three + // allocations to arrive at `{}`. Measured at 92.3 ns against 18.6 ns for this check. + // + // Only the guard is new; the parse below is untouched on purpose. Reaching for `indexOf` + + // `slice` instead of `split` would also drop an allocation, but it changes what a second `?` + // means, and that is a behaviour question rather than a performance one. + if (!url.includes('?')) return {}; + const queryString = url.split('?')[1] ?? ''; const out: Record = {}; for (const [key, value] of new URLSearchParams(queryString)) out[key] = value; From 8d8ef7ed09d716cbe886332f8ce0adbf422bfe1e Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 22:57:37 -0500 Subject: [PATCH 25/46] perf(http): look injected header keys up directly instead of rebuilding a Set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mergeInjectedHeaders rebuilt a lowercased Set of the injected header keys on every response: an array from Object.keys, a mapped array from toLowerCase, and a Set from that. Three allocations to answer a question the object already answers. The lowercasing was the redundant part. Every key `injected` can hold is written as a lowercase literal in src/security.ts — buildSecurityHeaders and resolveCors are its only sources — so the mapped array was a copy of the keys it started with. hasOwnProperty rather than `in`: a handler may legitimately send a header named constructor or toString, and `in` would find those on Object.prototype and drop them silently. 146.4ns to 55.9ns in isolation; -3.2% end to end over five interleaved rounds, with all five pairs favouring the change. Third of three fixes from the same profile, and all three are one pattern: work done unconditionally for a case that rarely or never applies — validating encoding that is almost never malformed, parsing a query string that is not there, lowercasing keys that already were. Signed-off-by: Diego Resendez --- src/http/headers.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/http/headers.ts b/src/http/headers.ts index d9fb64e..c5ae5c0 100644 --- a/src/http/headers.ts +++ b/src/http/headers.ts @@ -1,5 +1,7 @@ import { mergeVary } from '../security'; +const hasOwn = Object.prototype.hasOwnProperty; + /** * Merges a handler's response headers with authoritative `injected` headers * (security + CORS). Injected keys win case-insensitively; `vary` is merged. @@ -10,7 +12,6 @@ export function mergeInjectedHeaders( injected: Record, ): Record { const merged: Record = {}; - const injectedLower = new Set(Object.keys(injected).map((key) => key.toLowerCase())); let handlerVary: string | undefined; if (handlerHeaders) @@ -22,7 +23,16 @@ export function mergeInjectedHeaders( continue; } - if (!injectedLower.has(lowerKey)) merged[key] = handlerHeaders[key]; + // `injected` is looked up directly instead of through a lowercased Set rebuilt per response. + // Every key it can hold is written as a lowercase literal in `src/security.ts` — both + // `buildSecurityHeaders` and `resolveCors`, which are its only sources — so lowercasing them + // again produced a copy of the keys it already had. Three allocations per response (an array, + // a mapped array, a Set) to answer a question the object answers itself: 146.4 ns against + // 55.9 ns. + // + // `hasOwnProperty` rather than `in`: a handler is free to send a header called `constructor` + // or `toString`, and `in` would find those on Object.prototype and silently drop them. + if (!hasOwn.call(injected, lowerKey)) merged[key] = handlerHeaders[key]; } Object.assign(merged, injected); From 5fafe97bc5e4dcda96acbd49380ce30e2dc1b777 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 23:03:07 -0500 Subject: [PATCH 26/46] docs: correct the observability cost, and record why three earlier numbers were wrong The published figure was -3.9%. It was measured sequentially rather than interleaved, and the machine drifts 12% across a session as it warms, so run order was indistinguishable from effect. Two later attempts to correct it were also wrong: 0.8% had the same flaw, and -6.8% compared 7bd11bf against HEAD, which differ by observability *and* three performance fixes pulling the other way, then reported their net as if it were one of them. Measured properly, alternating round by round between 7bd11bf and 523e318 (the last commit before those fixes): +7.0% of the framework's own per-request work, about 0.29us, roughly 2% of a request over a real socket. Ranges do not overlap. The guide no longer quotes absolute throughput from this laptop. The reference numbers come from a two-box setup, and single-box loopback figures invite a comparison that is not valid. D7's shape survives: the cost is fixed per request, not per step, because per-step work is skipped when nothing subscribes. Signed-off-by: Diego Resendez --- docs/plans/2026-08-16-observability-design.md | 4 +++- docs/plans/2026-08-16-observability-plan.md | 16 ++++++++++------ .../src/content/docs/guides/observability.md | 18 ++++++++++-------- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/docs/plans/2026-08-16-observability-design.md b/docs/plans/2026-08-16-observability-design.md index ffaaf52..5f74c0f 100644 --- a/docs/plans/2026-08-16-observability-design.md +++ b/docs/plans/2026-08-16-observability-design.md @@ -149,7 +149,9 @@ Two things follow. `Date.now()` loses on both axes — slower *and* coarser — At 0.25% per step the overhead sits **below the 0.3% run-to-run CV of the project's own benchmark**, so it is not measurable in the harness that would have to justify a flag. Making it opt-in would buy two code paths and a configuration surface in exchange for something nobody can observe. Always on. -> **Correction, after implementation.** This decision survived; its reasoning did not. Measured over a real socket the cost is **−3.9% on JSON hello and −2.1% on a three-step pipeline** — the shallower route loses *more*, which is the opposite of a per-step model. Per-step work is skipped entirely when nothing subscribes; what is left is a fixed per-request cost. "Always on" is still right, and for a better reason: there is nothing per-step left to make optional. See Task 7 in the implementation plan. +> **Correction, after implementation.** This decision survived; its reasoning did not. The measured cost is **+7.0% of the framework's own per-request work** (~0.29 µs, ~2% over a real socket), and it is *fixed per request* rather than per step — per-step work is skipped entirely when nothing subscribes. "Always on" is still right, and for a better reason: there is nothing per-step left to make optional. +> +> Three earlier figures for this were published before that one and all three were wrong, each from a comparison with more than one variable moving. See Task 7 in the implementation plan for what went wrong and why interleaving is not optional here. ### D8 — Request logging is a `Bus` subscriber, wrapped so a failing logger cannot go silent diff --git a/docs/plans/2026-08-16-observability-plan.md b/docs/plans/2026-08-16-observability-plan.md index 2dead70..67a45fe 100644 --- a/docs/plans/2026-08-16-observability-plan.md +++ b/docs/plans/2026-08-16-observability-plan.md @@ -116,14 +116,18 @@ Tasks 1–3 are the correction; 4–6 are what consumes it. Do not start 4 befor **Files:** - Modify: `BENCHMARKS.md` -D7 predicted ~0.25% **per step**, invisible against the harness's own 0.3% CV. Measured over a real socket, on the box `BENCHMARKS.md` was produced on, same server config both sides: +D7 predicted ~0.25% **per step**, invisible against the harness's own 0.3% CV. -| Scenario | Before | After | | -|---|---:|---:|---:| -| JSON hello | 78,118 req/s | 75,075 req/s | −3.9% | -| Pipeline (3 steps) | 70,671 req/s | 69,164 req/s | −2.1% | +**Measured: +7.0% of the framework's own per-request work** — 4.074 µs → 4.361 µs, medians of five interleaved rounds, ranges not overlapping. About 0.29 µs, or ~2% of a request over a real socket. -**The route with fewer steps loses more**, which falsifies the model rather than only the number. The per-step cost is real but is skipped entirely when nothing subscribes (`Bus.hasListeners`); what remains is a **fixed per-request** cost — generating the request id, reading two headers, and the guard checks. A shallow route amortises that over less work, so it shows up larger. +The prediction was wrong in **shape**, not only magnitude. Per-step work is skipped entirely when nothing subscribes (`Bus.hasListeners`), so a deep pipeline pays no more than a shallow one; what remains is a **fixed per-request** cost — generating the request id, reading two headers, and the guard checks. "Always on" survives, for a better reason than it was made with: there is nothing per-step left to make optional. + +**Three earlier numbers for this were published and all three were wrong**, which is the more useful lesson: −3.9%, then 0.8%, then −6.8%. Each came from a comparison with more than one variable moving. + +- The first two were sequential rather than interleaved. The same code measured at the start and end of one session differed by **12%** as the machine warmed, so run order was indistinguishable from effect — one of them even reported the wrong sign. +- The third compared `7bd11bf` against `HEAD`, which differ by observability **and** three performance fixes pulling the other way. It reported their net as if it were one of them. + +The number above compares `7bd11bf` against `523e318`, the last commit before those fixes, alternating round by round. Two regressions were found and fixed by measuring rather than reasoning, both larger than anything the design anticipated: diff --git a/website/src/content/docs/guides/observability.md b/website/src/content/docs/guides/observability.md index 45a19fa..cc65843 100644 --- a/website/src/content/docs/guides/observability.md +++ b/website/src/content/docs/guides/observability.md @@ -131,13 +131,15 @@ instrumentation — the graph already knows every node. ## What it costs -Measured, not asserted, on the box that produced [BENCHMARKS.md](https://github.com/Expressive-Tea/green-tea/blob/main/BENCHMARKS.md): +**About 0.29 µs per request** — roughly **7% of the framework's own work**, or **~2% of a request +measured over a real socket**, where the transport dominates. -| Scenario | Before | After | | -|---|---:|---:|---:| -| JSON hello | 78,118 req/s | 75,075 req/s | −3.9% | -| Pipeline (3 steps) | 70,671 req/s | 69,164 req/s | −2.1% | +The cost is **per request, not per step**. Per-step timing and payload construction are skipped +entirely when nothing is subscribed, so a deep pipeline pays no more than a shallow one. What +remains is fixed: generating the request id, reading two headers, and the checks that decide +whether anyone is listening. -The cost is **per request, not per step** — which is why the route with *fewer* steps loses more. -Most of it is generating the request id; per-step timing and payload construction are skipped -entirely when nothing is subscribed. +Absolute throughput numbers are deliberately not quoted here. The figure above comes from an +interleaved A/B — alternating both versions round by round — because the same code measured at the +start and end of one session on the same machine differed by 12% as it warmed up. Any before/after +that does not interleave is measuring the clock as much as the code. From e625d5c88147aa3e8362b3316c8206666ec52ba2 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 23:35:06 -0500 Subject: [PATCH 27/46] perf(router): stop the route scan at a match nothing can outrank MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit matchRoute evaluated every registered route before answering, so `/hello` cost the same whether it was declared first or last among 32 routes — 1227 ns against 1237 ns. That is ~38 ns of scanning per registered route on every request, growing with the route table, and the benchmark app has the smallest table any real service would have. Specificity ranks a literal segment above every other kind, so a pattern made only of literals cannot be outranked by anything else matching the same path, and an equal rank keeps registration order — which is the route already in hand. Finishing the scan only re-derives it. The path split moves out of matchCompiled for the same reason: `split` + `filter` ran once per candidate route on every request, always producing the same array. Doing it once per request is 63.7% off a 32-route scan that early exit cannot help at all (a :param match, which must be compared against the rest of the table). Signed-off-by: Diego Resendez --- src/http/router.ts | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/src/http/router.ts b/src/http/router.ts index 8dce901..193970b 100644 --- a/src/http/router.ts +++ b/src/http/router.ts @@ -13,6 +13,8 @@ export interface CompiledPattern { segments: CompiledSegment[]; kinds: number[]; catchAll: boolean; + /** Every segment is a literal, so this pattern scores the maximum specificity and cannot be outranked. */ + allStatic: boolean; } const compiledCache = new Map(); @@ -158,6 +160,7 @@ export function compilePattern(pattern: string): CompiledPattern { .filter((segment) => segment.kind !== 'catchAll') .map((segment) => (segment.kind === 'static' ? 3 : segment.constraint ? 2 : 1)), catchAll: segments.at(-1)?.kind === 'catchAll', + allStatic: segments.every((segment) => segment.kind === 'static'), }; compiledCache.set(pattern, compiled); return compiled; @@ -195,8 +198,18 @@ function decodeSegment(value: string): string { return decodeURIComponent(value); } -function matchCompiled(compiled: CompiledPattern, path: string): Record | undefined { - const pathSegs = path.split('/').filter(Boolean); +/** + * Splits a request path into its non-empty segments. + * + * Called once per request by the scanning functions below, not once per candidate route. It used to + * live inside {@link matchCompiled}, which meant `split` + `filter` — two allocations — ran for every + * registered route on every request, always producing the same array. + */ +function splitPath(path: string): string[] { + return path.split('/').filter(Boolean); +} + +function matchCompiled(compiled: CompiledPattern, pathSegs: string[]): Record | undefined { const params: Record = {}; for (let index = 0; index < compiled.segments.length; index++) { @@ -224,7 +237,7 @@ function matchCompiled(compiled: CompiledPattern, path: string): Record | undefined { - return matchCompiled(compilePattern(pattern), path); + return matchCompiled(compilePattern(pattern), splitPath(path)); } /** Orders matching patterns by exactness, then static/constrained/plain segment specificity. */ @@ -245,14 +258,26 @@ function moreSpecific(a: string, b: string): number { /** Finds the most specific route matching both method and path; ties keep registration order. */ export function matchRoute(routes: RouteDef[], method: string, path: string): MatchedRoute | undefined { + const pathSegs = splitPath(path); let best: MatchedRoute | undefined; let bestPattern = ''; for (const route of routes) { if (route.method !== method) continue; - const params = matchPattern(route.pattern, path); + const compiled = compilePattern(route.pattern); + const params = matchCompiled(compiled, pathSegs); if (!params) continue; + // An all-static match ends the scan. Specificity ranks a literal segment above every other + // kind, so no pattern that also matches this path can outrank one made only of literals — and + // an equal rank keeps registration order, which is this route. Finishing the scan would + // re-derive the answer already in hand. + // + // The scan used to run to the end regardless: `/hello` cost the same whether it was declared + // first or last among 32 routes, 1227 ns against 1237 ns. That is ~38 ns of scanning per + // registered route on every request, and it grows with the route table. + if (compiled.allStatic) return { params, def: route }; + if (!best || moreSpecific(route.pattern, bestPattern) > 0) { best = { params, def: route }; bestPattern = route.pattern; @@ -284,10 +309,11 @@ const METHOD_ORDER = ['GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS' /** Lists the distinct HTTP methods whose pattern matches the path — used to build a 405 `Allow` header. */ export function allowedMethods(routes: RouteDef[], path: string): string[] { + const pathSegs = splitPath(path); const methods = new Set(); for (const route of routes) { - if (!matchPattern(route.pattern, path)) continue; + if (!matchCompiled(compilePattern(route.pattern), pathSegs)) continue; methods.add(route.method); if (route.method === 'GET' && route.transport === 'buffer') methods.add('HEAD'); } From 0c9f8a545edd0dd2e5aa7067db5a494d0f335b05 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 23:35:26 -0500 Subject: [PATCH 28/46] fix(router): route dot segments the same way on every runtime MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The same bytes on the wire reached different routes depending on where the app ran. `GET /public/../admin` hit a `/admin` route under Deno, Bun and workerd, and 404'd under Node — 200 vs 404 for one request. The fetch-based runtimes resolve dot segments inside the `Request` constructor, before green-tea is handed anything: `new Request( 'http://x/public/../admin').url` is already `http://x/admin`. Node's raw target has no such step. Rejecting outright — the stricter policy, and what this module already does for `//` — is not implementable on three of the four runtimes, because the raw target is unrecoverable there. So Node converges on the rule the other three cannot opt out of. `%2e` is a dot to the URL parser, so the encoded spelling resolves too; leaving it out would keep it as a way to reach a route the plain spelling resolves away from. Cost is gated: paths with no `.` and no `%` pay two indexOf scans (20.0 -> 21.7 ns for `/hello`), a literal dot pays the regex (35.5 ns), and only real dot segments pay the split (103.6 ns). The existing parity suite could not have caught this — its `both()` helper goes through `fetch()`, which normalizes the URL before it reaches the wire. The new cases write the request line to a socket by hand. Signed-off-by: Diego Resendez --- src/http/router.ts | 55 ++++++++++++++++++++++++++++++++++++++++++++- test/parity.test.ts | 35 +++++++++++++++++++++++++++++ test/router.test.ts | 27 ++++++++++++++++++++++ 3 files changed, 116 insertions(+), 1 deletion(-) diff --git a/src/http/router.ts b/src/http/router.ts index 193970b..0c9d381 100644 --- a/src/http/router.ts +++ b/src/http/router.ts @@ -166,11 +166,64 @@ export function compilePattern(pattern: string): CompiledPattern { return compiled; } +/** Matches a `.` or `..` segment, percent-encoded or not, sitting alone between separators. */ +const DOT_SEGMENT = /(?:^|\/)(?:\.|%2e){1,2}(?:\/|$)/i; + +/** + * Classifies one path segment as `.`, `..`, or neither. + * + * `%2e` is a dot as far as the URL spec is concerned, so `/a/%2e%2e/b` and `/a/../b` are the same + * path. Skipping the encoded spelling would leave the encoded form as a way to reach a route the + * plain form resolves away from. + */ +function dotSegment(segment: string): '.' | '..' | undefined { + if (segment === '.' || segment === '..') return segment; + if (segment.length > 6 || !segment.includes('%')) return undefined; + const decoded = segment.toLowerCase().replace(/%2e/g, '.'); + return decoded === '.' || decoded === '..' ? decoded : undefined; +} + +/** + * Resolves `.` and `..` segments, the way RFC 3986 §5.2.4 and the WHATWG URL parser both do. + * + * This runs for the *Node* adapter's benefit. Every fetch-based runtime — Deno, Bun, workerd — + * resolves dot segments inside the `Request` constructor, before green-tea is handed anything: + * `new Request('http://x/public/../admin').url` is already `http://x/admin`. The raw target is + * simply not recoverable there, so rejecting dot segments outright — which is what this module + * does for `//`, and would be the stricter policy — cannot be implemented on three of the four + * runtimes. Resolving is the only rule all four can agree on. + * + * Before this, the same bytes on the wire routed differently per runtime: `GET /public/../admin` + * reached a `/admin` route under Deno/Bun/edge and 404'd under Node. + */ +function resolveDotSegments(path: string): string { + const out: string[] = []; + + for (const segment of path.split('/').slice(1)) { + const dots = dotSegment(segment); + if (dots === '.') continue; + + if (dots === '..') { + out.pop(); + continue; + } + + out.push(segment); + } + + return `/${out.join('/')}`; +} + /** Applies the public trailing-slash policy and validates every segment's percent encoding. */ export function normalizeRequestPath(path: string): string { if (!path.startsWith('/')) throw new InvalidRequestPathError('invalid request path: path must start with slash'); if (path.includes('//')) throw new InvalidRequestPathError('invalid request path: repeated slash'); - const normalized = path.length > 1 && path.endsWith('/') ? path.slice(0, -1) : path; + + // Two `indexOf` scans gate the regex, and the regex gates the split. A path with no `.` and no + // `%` at all — which is most of them — pays only the scans. + const resolved = + (path.includes('.') || path.includes('%')) && DOT_SEGMENT.test(path) ? resolveDotSegments(path) : path; + const normalized = resolved.length > 1 && resolved.endsWith('/') ? resolved.slice(0, -1) : resolved; // Validation only — the decoded value is deliberately discarded, matching is done on the raw // path. So the work is skipped entirely unless there is something to validate. diff --git a/test/parity.test.ts b/test/parity.test.ts index 9d18135..cceabe8 100644 --- a/test/parity.test.ts +++ b/test/parity.test.ts @@ -1,5 +1,6 @@ import { describe, it, expect, beforeAll, afterAll } from 'vitest'; import type { Server } from 'http'; +import { connect } from 'net'; import { createApp, Provider, Route, Get, Head, Options, Post, Module, needs, body, Sse } from '../src/index'; @Provider({ provides: 'db' }) @@ -69,6 +70,25 @@ async function both(path: string, init?: RequestInit) { return { node, web }; } +/** + * Sends a request line verbatim, bypassing `fetch`. + * + * `both()` cannot reach the cases below: `fetch()` normalizes the URL before it hits the wire, and + * `new Request()` does the same, so a dot segment written into either is already resolved by the + * time the adapter sees it. Only a hand-written request line proves what Node does with one. + */ +function rawStatus(target: string): Promise { + return new Promise((resolve, reject) => { + const socket = connect(Number(new URL(base).port), '127.0.0.1', () => { + socket.write(`GET ${target} HTTP/1.1\r\nHost: 127.0.0.1\r\nConnection: close\r\n\r\n`); + }); + let raw = ''; + socket.on('data', (chunk) => (raw += chunk.toString())); + socket.on('error', reject); + socket.on('end', () => resolve(Number(raw.split(' ')[1]))); + }); +} + describe('Node vs app.fetch parity (Node is truth)', () => { it('GET /api/x', async () => { const { node, web } = await both('/api/x'); @@ -125,6 +145,21 @@ describe('Node vs app.fetch parity (Node is truth)', () => { expect(web.headers.get('x-content-type-options')).toBe('nosniff'); } }); + // Regression: the same bytes on the wire used to route differently per runtime. Deno, Bun and + // workerd resolve dot segments inside the `Request` constructor before green-tea sees anything, + // and the raw target is unrecoverable there — so Node had to be taught to resolve them too. + it('resolves dot segments to the same route the fetch adapter reaches', async () => { + for (const target of ['/api/nope/../x', '/api/./x', '/api/nope/%2e%2e/x', '/nope/../api/x']) { + expect(await rawStatus(target), `node ${target}`).toBe(200); + expect((await app.fetch(new Request(base + target))).status, `fetch ${target}`).toBe(200); + } + }); + + it('does not treat dots inside a segment as dot segments', async () => { + expect(await rawStatus('/api/x.y')).toBe(404); + expect((await app.fetch(new Request(base + '/api/x.y'))).status).toBe(404); + }); + it('SSE first two events', async () => { const nodeText = await (await fetch(base + '/api/s')).text(); const webText = await (await app.fetch(new Request(base + '/api/s'))).text(); diff --git a/test/router.test.ts b/test/router.test.ts index 72177ba..3f61b1c 100644 --- a/test/router.test.ts +++ b/test/router.test.ts @@ -76,6 +76,33 @@ describe('normalizeRequestPath', () => { expect(() => normalizeRequestPath('/users//42')).toThrow(/repeated slash/); expect(() => normalizeRequestPath('/users/%E0%A4%A')).toThrow(/malformed path encoding/); }); + + // The reference for every case below is `new URL('http://x' + path).pathname`, because that is + // what Deno, Bun and workerd apply before green-tea is handed the request. Node has no such step, + // so this is where the two adapters are made to agree. + it('resolves dot segments the way the URL parser does', () => { + expect(normalizeRequestPath('/public/../admin')).toBe('/admin'); + expect(normalizeRequestPath('/./admin')).toBe('/admin'); + expect(normalizeRequestPath('/a/b/../../c')).toBe('/c'); + expect(normalizeRequestPath('/a/.')).toBe('/a'); + expect(normalizeRequestPath('/..')).toBe('/'); + expect(normalizeRequestPath('/a/../..')).toBe('/'); + }); + + it('resolves percent-encoded dot segments, which the URL parser also treats as dots', () => { + expect(normalizeRequestPath('/public/%2e%2e/admin')).toBe('/admin'); + expect(normalizeRequestPath('/public/%2E%2E/admin')).toBe('/admin'); + expect(normalizeRequestPath('/%2e/admin')).toBe('/admin'); + expect(normalizeRequestPath('/public/.%2e/admin')).toBe('/admin'); + }); + + it('leaves dots that are not whole segments alone', () => { + expect(normalizeRequestPath('/assets/logo.png')).toBe('/assets/logo.png'); + expect(normalizeRequestPath('/files/.hidden')).toBe('/files/.hidden'); + expect(normalizeRequestPath('/v1.2/status')).toBe('/v1.2/status'); + // %2f is not a separator to the URL parser, so `..%2fb` is one ordinary segment. + expect(normalizeRequestPath('/a/..%2fb')).toBe('/a/..%2fb'); + }); }); describe('matchRoute precedence', () => { From a4bb3c02d68cd0de7dfd71afbf5dbabaabd62978 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 16 Aug 2026 23:46:57 -0500 Subject: [PATCH 29/46] refactor(http): resolve each request once, in the core that already routes it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both adapters routed every request themselves, and then handle() routed it again from the same inputs — a four-route app walked its table 2.5 times per request. Neither side was wrong: an adapter must know the route to decide whether to read a body, and the core must know it to dispatch. The cause was the shape of the handoff. NeutralRequest carried an already-parsed body, so producing one was the adapter's problem, and every policy that depends on the matched route came with it — these four chains were written out in server.ts and web.ts character for character: matched.def.maxBodyBytes ?? opts?.limits?.maxBodyBytes ?? 1_000_000 matched.def.bodyDuplicates ?? opts?.bodyDuplicates ?? 'last' matched.def.maxParts ?? opts?.limits?.maxParts ?? 1000 opts?.limits?.maxBodyBytes ?? 1_000_000 A fifth knob, or one changed default, meant editing both or letting the runtimes quietly disagree about limits. Handing over the ability to read rather than the result moves the decision to where the route is already known. What stays in an adapter is what genuinely differs between runtimes: getting bytes in, putting bytes out. Enforcement stays with the reader too, because Node aborts an oversized upload as chunks arrive while a fetch runtime can only measure what arrayBuffer() already resolved — passing the limit in preserves that. 413/400/501 keep their exact current shape, Node's connection: close included; it now has the test it never had. Measured through app.fetch, both versions in one process, interleaved: 40 routes with the match declared last, 3.89 -> 3.58 us (-8.2%). One route, where there is no second scan to save, is unchanged. The first cut of this was 13% SLOWER, and the reason is worth recording: a per-request closure for the reader plus the error-context object it captured cost 250 ns, and the async frames around a body that did not exist cost another 215 ns — together more than the duplicate scan the whole change removes. The reader is now built once per server and takes the runtime's request as an argument, and a bodiless request touches no promise on this path at all. Signed-off-by: Diego Resendez --- src/http/body.ts | 135 ++++++++++++++++++++++++++++++++++++++++ src/http/core.ts | 61 ++++++++++++++---- src/http/server.ts | 152 +++++++++++---------------------------------- src/http/web.ts | 111 +++++++++++---------------------- test/http.test.ts | 4 ++ 5 files changed, 262 insertions(+), 201 deletions(-) create mode 100644 src/http/body.ts diff --git a/src/http/body.ts b/src/http/body.ts new file mode 100644 index 0000000..9056233 --- /dev/null +++ b/src/http/body.ts @@ -0,0 +1,135 @@ +// src/http/body.ts — runtime-neutral body acquisition: limit resolution, parsing, and the failure +// envelope. The one part that is genuinely runtime-specific — getting the bytes — is supplied by +// the caller as a {@link BodyReader}. +import { HttpError, isHttpError } from '../signals'; +import { renderError, type ErrorRequest } from '../transformers'; +import { parseMultipart, extractBoundary, collapseDuplicates } from '../multipart'; +import type { MatchedRoute, HttpOptions } from './types'; + +/** A ready-to-send error response produced while acquiring the request body. */ +export interface BodyFailure { + fail: { status: number; headers: Record; body: string }; +} + +/** A value, or a promise of one. Readers that have nothing to await return the value directly. */ +export type MaybePromise = T | Promise; + +/** True for the native promises both adapters' readers return; no cross-realm thenables reach here. */ +function isPromise(value: MaybePromise): value is Promise { + return value instanceof Promise; +} + +/** + * Reads the raw request body, enforcing `limit`. + * + * The adapter owns this and nothing else about the body, because enforcement is the one place the + * runtimes legitimately differ: Node checks the running total as chunks arrive and can abort a + * 10 GB upload after 1 MB, while a fetch runtime has only `request.arrayBuffer()` and can check + * `byteLength` after the fact. Passing the limit *in*, rather than measuring the returned buffer + * here, is what keeps Node's incremental abort — measuring afterwards would force it to buffer + * without bound first. + * + * The failure branch is opaque on purpose: Node answers an over-limit request with + * `connection: close`, so the rest of the upload does not keep arriving on a kept-alive socket. + * That header means nothing on the fetch side, and is a forbidden response header on some + * runtimes, so the adapter that needs it is the one that attaches it. + * + * `source` is the runtime's own request object, handed straight back untouched. It exists so the + * reader can be built **once per server** instead of once per request: a closure capturing the + * request measured at 250 ns per request together with the error-context object it captured — + * more than the duplicate route resolution this whole indirection removes. + */ +export type BodyReader = (source: unknown, limit: number) => MaybePromise<{ bytes: Buffer | undefined } | BodyFailure>; + +/** Parse outcome: the decoded body, or an error message plus the status to send (400 unless set). */ +type ParseResult = { body: unknown } | { error: string; status?: number }; + +/** + * Parses a raw request body by content type (JSON, urlencoded, multipart, or plain text). + * @returns `{ body }` on success, or `{ error, status? }` on malformed input / missing multipart support. + */ +export async function parseRequestBody( + buf: Buffer | undefined, + contentType: string, + duplicates: 'array' | 'last', + maxParts: number, +): Promise { + if (buf !== undefined && contentType.includes('application/json')) { + try { + return { body: JSON.parse(buf.toString('utf8')) }; + } catch { + return { error: 'Invalid JSON body' }; + } + } + + if (buf !== undefined && contentType.includes('application/x-www-form-urlencoded')) { + return { body: collapseDuplicates(new URLSearchParams(buf.toString('utf8')), duplicates) }; + } + + if (buf !== undefined && contentType.includes('multipart/form-data')) { + const boundary = extractBoundary(contentType); + if (!boundary) return { error: 'Invalid multipart body' }; + + try { + return { body: await parseMultipart(buf, boundary, { maxParts, duplicates }) }; + } catch (error) { + // HttpError = the busboy peer dep is missing (501); anything else = malformed input (400). + if (isHttpError(error)) return { error: error.message, status: error.status }; + return { error: 'Invalid multipart body' }; + } + } + + const text = buf?.toString('utf8'); + return { body: text === '' ? undefined : text }; +} + +/** + * Resolves the body limits for a matched route, reads it through `read`, and parses it. + * + * The four `route ?? server ?? default` chains below used to be written out in both adapters, + * character for character, because each adapter had to route the request itself in order to know + * whether to read a body — and so ended up owning every policy that depends on the matched route. + * Adding a fifth knob, or changing one default, meant changing it in two places or letting the + * runtimes quietly disagree about limits. + */ +export function acquireBody( + read: BodyReader, + source: unknown, + matched: MatchedRoute, + opts: HttpOptions | undefined, + req: ErrorRequest, +): MaybePromise<{ body: unknown } | BodyFailure> { + const limit = matched.def.maxBodyBytes ?? opts?.limits?.maxBodyBytes ?? 1_000_000; + const acquired = read(source, limit); + + // Deliberately not `async`. A request with no body — every GET, which is most of them — resolves + // this whole path without a single promise, and an `async` wrapper here would allocate one + // regardless. Same reason `handle()` is not async. + return isPromise(acquired) + ? acquired.then((settled) => parseAcquired(settled, matched, opts, req)) + : parseAcquired(acquired, matched, opts, req); +} + +function parseAcquired( + acquired: { bytes: Buffer | undefined } | BodyFailure, + matched: MatchedRoute, + opts: HttpOptions | undefined, + req: ErrorRequest, +): MaybePromise<{ body: unknown } | BodyFailure> { + if ('fail' in acquired) return acquired; + + // `parseRequestBody(undefined, …)` answers `{ body: undefined }` for every content type, so + // there is nothing to parse and nothing to await. Skipping it is what keeps a bodiless request + // off the promise path entirely. + if (acquired.bytes === undefined) return { body: undefined }; + + const contentType = String(req.headers['content-type'] ?? ''); + const duplicates = matched.def.bodyDuplicates ?? opts?.bodyDuplicates ?? 'last'; + const maxParts = matched.def.maxParts ?? opts?.limits?.maxParts ?? 1000; + + return parseRequestBody(acquired.bytes, contentType, duplicates, maxParts).then((parsed) => + 'error' in parsed + ? { fail: renderError(new HttpError(parsed.status ?? 400, parsed.error), req, opts?.onError) } + : { body: parsed.body }, + ); +} diff --git a/src/http/core.ts b/src/http/core.ts index fa99e72..d48ad02 100644 --- a/src/http/core.ts +++ b/src/http/core.ts @@ -5,6 +5,7 @@ import { isStreamResult, type PipelineResult } from '../pipeline'; import { buildSecurityHeaders, resolveCors, corsPreflightHeaders } from '../security'; import { resolveRoute, allowedMethods, normalizeRequestPath, parseQuery } from './router'; import { pickEncoder } from './stream'; +import { acquireBody, type BodyReader } from './body'; import type { RouteDef, HttpOptions } from './types'; import type { StreamEncoder } from '../encoders'; import type { Bus } from '../bus'; @@ -16,12 +17,24 @@ import type { Bus } from '../bus'; // have without a compatibility flag. declare const crypto: { randomUUID(): string }; -/** A runtime-neutral inbound request: body already parsed by the caller's ingress (Node stream, fetch Request, …). */ +/** + * A runtime-neutral inbound request. + * + * The body arrives as a {@link BodyReader} rather than a value, and that is the whole reason this + * core resolves each request exactly once. When the adapter had to hand over an already-parsed + * body, it first had to route the request itself — a body is only read for a request that reaches + * a handler — so both the adapter and `dispatch` resolved the same route from the same inputs, and + * a four-route app walked its table two and a half times per request. Handing over the *ability* + * to read instead of the result moves that decision here, where the route is known anyway. + */ export interface NeutralRequest { method: string; url: string; // path + query, e.g. "/users/9?x=1" headers: Record; - body: unknown; // already-parsed body + /** Called only once a route matches, so an unmatched request still never reads a body. */ + readBody: BodyReader; + /** The runtime's own request object, passed back to {@link readBody} untouched and never inspected here. */ + source: unknown; secure: boolean; ip: string; requestId: string; @@ -36,10 +49,10 @@ const first = (value: string | string[] | undefined): string | undefined => (Arr /** * Derives a request's identity from its headers, for the adapters to stamp on a `NeutralRequest`. * - * **Called by the adapters, not by {@link handle}**, and the placement is the point. Both adapters - * read and size-check the body before they reach `handle()` (`server.ts`, `web.ts`), so a `413` is - * answered without `handle()` ever seeing the request. Generating identity in here would leave - * precisely the failures an operator most wants to correlate with nothing to correlate them by. + * **Called by the adapters, not by {@link handle}**, and the placement is the point. An adapter's + * `BodyReader` renders its own `413` (`server.ts`, `web.ts`) without `handle()` ever producing it, + * so identity has to exist before the read starts. Generating it in here would leave precisely the + * failures an operator most wants to correlate with nothing to correlate them by. * * An `x-request-id` from a gateway is adopted rather than replaced — a service behind a proxy must * not open a second identity for a request that already has one. `traceparent` is carried through @@ -71,7 +84,14 @@ export function correlateRequest(headers: Record; body: string | Buffer } - | { kind: 'stream'; headers: Record; stream: AsyncIterable; encoder: StreamEncoder }; + | { + kind: 'stream'; + headers: Record; + stream: AsyncIterable; + encoder: StreamEncoder; + /** The matched route's pattern, for naming the stream lifecycle events. */ + route: string; + }; /** {@link handle}'s result for a normal (non-preflight) request. */ export interface HandleResult { @@ -106,7 +126,7 @@ function errorOutcome( opts: HttpOptions | undefined, headers: Record = {}, ): HandleResult { - const rendered = renderError(error, { method: req.method, url: req.url, headers: req.headers }, opts?.onError); + const rendered = renderError(error, req, opts?.onError); return { injected, outcome: { @@ -279,6 +299,16 @@ async function dispatch( traceId: req.traceId, }); + // `req` is passed straight through as the error context: a `NeutralRequest` already has the + // `method`/`url`/`headers` an `ErrorRequest` is, so copying those three fields into a fresh + // object per request bought nothing. + const acquired = await acquireBody(req.readBody, req.source, matched, opts, req); + + // The adapter rendered this one itself (a 413 it had to answer while reading), or `acquireBody` + // did (a malformed or unsupported body). Either way it is already the standard envelope, and the + // caller merges `injected` into it exactly as it does for every other outcome. + if ('fail' in acquired) return { injected, outcome: { kind: 'buffered', ...acquired.fail } }; + let result: PipelineResult; try { @@ -288,19 +318,28 @@ async function dispatch( headers: req.headers, params: matched.params, query: parseQuery(req.url), - body: req.body, + body: acquired.body, protocol: req.secure ? 'https' : 'http', ip: req.ip, requestId: req.requestId, traceId: req.traceId, }); } catch (error) { - result = renderError(error, { method: req.method, url: req.url, headers: req.headers }, opts?.onError); + result = renderError(error, req, opts?.onError); } if (isStreamResult(result)) { const encoder = pickEncoder(matched.def.transport, String(req.headers.accept ?? '')); - return { injected, outcome: { kind: 'stream', headers: encoder.headers, stream: result.stream, encoder } }; + return { + injected, + outcome: { + kind: 'stream', + headers: encoder.headers, + stream: result.stream, + encoder, + route: matched.def.pattern, + }, + }; } return { diff --git a/src/http/server.ts b/src/http/server.ts index 694b8bd..37a65c5 100644 --- a/src/http/server.ts +++ b/src/http/server.ts @@ -1,29 +1,23 @@ import type http from 'http'; import type https from 'https'; import { renderError, type ErrorRequest } from '../transformers'; -import { isHttpError, HttpError } from '../signals'; import type { Bus } from '../bus'; import { buildSecurityHeaders, resolveCors } from '../security'; -import { parseMultipart, extractBoundary, collapseDuplicates } from '../multipart'; -import { normalizeRequestPath, resolveRoute } from './router'; -import { readBody, deriveSecure, deriveIp } from './request'; +import { readBody as readBodyBytes, deriveSecure, deriveIp } from './request'; import { pipeStream } from './stream'; import { attachWs } from './ws'; import { mergeInjectedHeaders } from './headers'; import { handle, correlateRequest } from './core'; -import type { RouteDef, WsRouteDef, MatchedRoute, MeshControl, HttpOptions } from './types'; +import type { BodyFailure, BodyReader } from './body'; +import type { RouteDef, WsRouteDef, MeshControl, HttpOptions } from './types'; interface HandlerConfig { routes: RouteDef[]; bus?: Bus; opts?: HttpOptions; - maxBody: number; trustProxy: boolean; } -/** A ready-to-send error response produced while acquiring the request body. */ -type BodyFailure = { fail: { status: number; headers: Record; body: string } }; - /** Builds the {@link ErrorRequest} handed to a user error renderer. */ function errorRequest(req: http.IncomingMessage): ErrorRequest { return { method: req.method ?? 'GET', url: req.url ?? '/', headers: req.headers }; @@ -44,9 +38,8 @@ export function createHttpServer( meshControl?: MeshControl, opts?: HttpOptions, ): http.Server { - const maxBody = opts?.limits?.maxBodyBytes ?? 1_000_000; const trustProxy = opts?.trustProxy ?? false; - const handler = createRequestHandler({ routes, bus, opts, maxBody, trustProxy }); + const handler = createRequestHandler({ routes, bus, opts, trustProxy }); // Node http/https are loaded lazily so importing createApp stays edge/workerd-safe // (workerd's nodejs_compat provides no node:http/node:https). This path only runs under listen(). @@ -70,18 +63,18 @@ export function createHttpServer( /** * Builds the request listener: a thin Node adapter around the runtime-neutral {@link handle} core. - * Reads the body (Node-specific), delegates security/CORS/routing/error-rendering to `handle()`, - * then writes the result to `res` (buffered or streamed). The security-header monkeypatch is - * installed here — and stays the single source of truth for merging headers into every response — - * so `handle()`'s own `injected` is intentionally unused by this adapter. + * Describes the request, supplies the {@link BodyReader} the core calls once a route matches, then + * writes the result to `res` (buffered or streamed). Routing, body parsing, limits and error + * rendering all live in the core. The security-header monkeypatch is installed here — and stays the + * single source of truth for merging headers into every response — so `handle()`'s own `injected` + * is intentionally unused by this adapter. */ function createRequestHandler(cfg: HandlerConfig) { - const { routes, bus, opts, maxBody, trustProxy } = cfg; + const { routes, bus, opts, trustProxy } = cfg; + // Built once per server, not once per request — see `BodyReader`. + const readBody: BodyReader = (source, limit) => readRequestBytes(source, limit, opts); return async (req: http.IncomingMessage, res: http.ServerResponse): Promise => { - const url = req.url ?? '/'; - const path = url.split('?')[0]; - const method = req.method ?? 'GET'; // Install the security-header patch BEFORE any routing/response so every path // (200, 404, error, stream) writes headers through the same patched writeHead. const secure = deriveSecure(req, trustProxy); @@ -94,37 +87,13 @@ function createRequestHandler(cfg: HandlerConfig) { // by reference at writeHead time, so keys added here still land on every response. if (opts?.cors) Object.assign(injected, resolveCors(opts.cors, req)); - // Mirror handle()'s own preflight/route-match decision here, so we only read the body - // (below) for a request that actually reaches a route handler — matching prior behaviour. - const isPreflight = Boolean(opts?.cors && method === 'OPTIONS' && req.headers['access-control-request-method']); - let matched: ReturnType; - - try { - matched = isPreflight ? undefined : resolveRoute(routes, method, normalizeRequestPath(path)); - } catch { - matched = undefined; // handle() owns the standard 400 envelope and injected headers - } - - let body: unknown; - - if (matched) { - const acquired = await acquireBody(req, matched, opts, maxBody); - - if ('fail' in acquired) { - res.writeHead(acquired.fail.status, acquired.fail.headers); - res.end(acquired.fail.body); - return; - } - - body = acquired.body; - } - const result = await handle(routes, opts, { ...correlation, - method, - url, + method: req.method ?? 'GET', + url: req.url ?? '/', headers: req.headers, - body, + readBody, + source: req, secure, ip: deriveIp(req, trustProxy), }); @@ -136,7 +105,7 @@ function createRequestHandler(cfg: HandlerConfig) { } if (result.outcome.kind === 'stream') { - await pipeStream(res, result.outcome.stream, result.outcome.encoder, bus, matched?.def.pattern, opts?.streams); + await pipeStream(res, result.outcome.stream, result.outcome.encoder, bus, result.outcome.route, opts?.streams); return; } @@ -145,34 +114,27 @@ function createRequestHandler(cfg: HandlerConfig) { }; } -/** Reads and parses the request body, returning `{ body }` or a ready-to-send `{ fail }` error response. */ -async function acquireBody( - req: http.IncomingMessage, - matched: MatchedRoute, +/** + * The Node half of body acquisition: bytes off the socket, and the over-limit answer. + * + * `readBody` enforces the limit against the running total as chunks arrive, so an oversized upload + * is rejected without being buffered. `connection: close` on that response is load-bearing — it + * stops the remainder of the upload from continuing to arrive on a kept-alive socket. + */ +function readRequestBytes( + source: unknown, + limit: number, opts: HttpOptions | undefined, - maxBody: number, -): Promise<{ body: unknown } | BodyFailure> { - let buf: Buffer | undefined; - const bodyLimit = matched.def.maxBodyBytes ?? maxBody; // per-route override falls back to the server default +): Promise<{ bytes: Buffer | undefined } | BodyFailure> { + const req = source as http.IncomingMessage; - try { - buf = await readBody(req, bodyLimit); - } catch (error) { - const rendered = renderError(error, errorRequest(req), opts?.onError); - return { fail: { ...rendered, headers: { ...rendered.headers, connection: 'close' } } }; - } - - const contentType = String(req.headers['content-type'] ?? ''); - const duplicates = matched.def.bodyDuplicates ?? opts?.bodyDuplicates ?? 'last'; - const maxParts = matched.def.maxParts ?? opts?.limits?.maxParts ?? 1000; - const parsed = await parseRequestBody(buf, contentType, duplicates, maxParts); - - if ('error' in parsed) { - const rendered = renderError(new HttpError(parsed.status ?? 400, parsed.error), errorRequest(req), opts?.onError); - return { fail: rendered }; - } - - return { body: parsed.body }; + return readBodyBytes(req, limit).then( + (bytes) => ({ bytes }), + (error: unknown) => { + const rendered = renderError(error, errorRequest(req), opts?.onError); + return { fail: { ...rendered, headers: { ...rendered.headers, connection: 'close' } } }; + }, + ); } /** @@ -189,45 +151,3 @@ function patchResponseHeaders(res: http.ServerResponse, injected: Record { - if (buf !== undefined && contentType.includes('application/json')) { - try { - return { body: JSON.parse(buf.toString('utf8')) }; - } catch { - return { error: 'Invalid JSON body' }; - } - } - - if (buf !== undefined && contentType.includes('application/x-www-form-urlencoded')) { - return { body: collapseDuplicates(new URLSearchParams(buf.toString('utf8')), duplicates) }; - } - - if (buf !== undefined && contentType.includes('multipart/form-data')) { - const boundary = extractBoundary(contentType); - if (!boundary) return { error: 'Invalid multipart body' }; - - try { - return { body: await parseMultipart(buf, boundary, { maxParts, duplicates }) }; - } catch (error) { - // HttpError = the busboy peer dep is missing (501); anything else = malformed input (400). - if (isHttpError(error)) return { error: error.message, status: error.status }; - return { error: 'Invalid multipart body' }; - } - } - - const text = buf?.toString('utf8'); - return { body: text === '' ? undefined : text }; -} diff --git a/src/http/web.ts b/src/http/web.ts index 0ad8326..8fd38db 100644 --- a/src/http/web.ts +++ b/src/http/web.ts @@ -1,11 +1,10 @@ import type { StreamEncoder } from '../encoders'; import { handle, computeInjected, correlateRequest, type HandleResult } from './core'; import { mergeInjectedHeaders } from './headers'; -import { parseRequestBody } from './server'; -import { normalizeRequestPath, resolveRoute } from './router'; +import type { BodyFailure, BodyReader, MaybePromise } from './body'; import { HttpError } from '../signals'; -import { renderError, type ErrorRequest, type ErrorResponse } from '../transformers'; -import type { RouteDef, HttpOptions, MatchedRoute } from './types'; +import { renderError, type ErrorRequest } from '../transformers'; +import type { RouteDef, HttpOptions } from './types'; /** Wraps an AsyncIterable as a web ReadableStream, encoding each value. Cancels the source on stream cancel. */ export function asReadableStream(source: AsyncIterable, encoder: StreamEncoder): ReadableStream { @@ -44,60 +43,36 @@ function headersToRecord(headers: Headers): Record { } /** - * Turns a rendered error (or any {status, headers, body}) into a web `Response`, merging in the - * authoritative `injected` security/CORS headers — mirrors the Node adapter, where - * `patchResponseHeaders` installs these before body acquisition even runs, so early failures - * (413/400/501) carry them too. + * The fetch half of body acquisition: bytes out of the `Request`, and the over-limit answer. + * + * Unlike Node, there is no incremental read to abort — `arrayBuffer()` resolves with the whole body + * or not at all, so the limit can only be checked once the bytes are already in memory. That + * difference is exactly why the limit is passed in rather than applied by the shared core. */ -function errorResponse(rendered: ErrorResponse, injected: Record): Response { - const headers = mergeInjectedHeaders(rendered.headers, injected); - return new Response(rendered.body, { status: rendered.status, headers }); -} - -/** - * Reads and parses a matched request's body (enforcing `maxBodyBytes` → 413), mirroring the Node - * adapter's `acquireBody`. Returns `{ body }` on success, or a ready-to-send `{ response }` on failure. - */ -async function acquireFetchBody( - request: Request, - matched: MatchedRoute, - headers: Record, - path: string, - maxBody: number, +function readFetchBytes( + source: unknown, + limit: number, opts: HttpOptions | undefined, - injected: Record, -): Promise<{ body: unknown } | { response: Response }> { - const errReq: ErrorRequest = { method: request.method, url: path, headers }; - let buf: Buffer | undefined; +): MaybePromise<{ bytes: Buffer | undefined } | BodyFailure> { + const request = source as Request; + // Not `async`: a bodiless request answers without allocating a promise at all. + if (!request.body) return { bytes: undefined }; - if (request.body) { - const arrayBuffer = await request.arrayBuffer(); - const bodyLimit = matched.def.maxBodyBytes ?? maxBody; - - if (arrayBuffer.byteLength > bodyLimit) { - return { - response: errorResponse(renderError(new HttpError(413, 'Payload Too Large'), errReq, opts?.onError), injected), + return request.arrayBuffer().then((arrayBuffer) => { + if (arrayBuffer.byteLength > limit) { + // Rebuilt here rather than captured per request: only an over-limit body ever needs it, and + // a `url`/`headers` pair captured up-front cost more than the work it saved. + const url = new URL(request.url); + const errReq: ErrorRequest = { + method: request.method, + url: url.pathname + url.search, + headers: headersToRecord(request.headers), }; + return { fail: renderError(new HttpError(413, 'Payload Too Large'), errReq, opts?.onError) }; } - buf = arrayBuffer.byteLength === 0 ? undefined : Buffer.from(arrayBuffer); - } - - const contentType = headers['content-type'] ?? ''; - const duplicates = matched.def.bodyDuplicates ?? opts?.bodyDuplicates ?? 'last'; - const maxParts = matched.def.maxParts ?? opts?.limits?.maxParts ?? 1000; - const parsed = await parseRequestBody(buf, contentType, duplicates, maxParts); - - if ('error' in parsed) { - return { - response: errorResponse( - renderError(new HttpError(parsed.status ?? 400, parsed.error), errReq, opts?.onError), - injected, - ), - }; - } - - return { body: parsed.body }; + return { bytes: arrayBuffer.byteLength === 0 ? undefined : Buffer.from(arrayBuffer) }; + }); } /** @@ -144,11 +119,14 @@ function outcomeToResponse(result: HandleResult): Response { /** * Builds a Web-Standards `fetch(request)` handler over the same route table the Node adapter uses: - * reads the body (enforcing `maxBodyBytes` → 413), parses it by content type, runs it through the - * runtime-neutral {@link handle}, and converts the outcome to a `Response` (buffered or streamed). + * describes the request for the runtime-neutral {@link handle}, supplies the {@link BodyReader} it + * calls once a route matches, and converts the outcome to a `Response` (buffered or streamed). + * Routing, body parsing, limits and error rendering all live in the core; this file is the part + * that knows how to get bytes out of a `Request` and how to put them into a `Response`. */ export function buildFetch(routes: RouteDef[], opts: HttpOptions | undefined) { - const maxBody = opts?.limits?.maxBodyBytes ?? 1_000_000; + // Built once per server, not once per request — see `BodyReader`. + const readBody: BodyReader = (source, limit) => readFetchBytes(source, limit, opts); return async (request: Request): Promise => { const url = new URL(request.url); @@ -156,33 +134,18 @@ export function buildFetch(routes: RouteDef[], opts: HttpOptions | undefined) { const headers = headersToRecord(request.headers); // Derived before the body is read, so a 413 rejected below still carries an identity. const correlation = correlateRequest(headers); - let matched: ReturnType; - - try { - matched = resolveRoute(routes, request.method, normalizeRequestPath(url.pathname)); - } catch { - matched = undefined; // handle() renders the shared 400 response without reading a body - } - const secure = url.protocol === 'https:'; - // Computed up-front from the same inputs `handle()` uses, so early-failure responses (413/400/501, - // before a route handler even runs) carry the same security/CORS headers Node's writeHead patch - // would have installed before body acquisition. + // Computed up-front from the same inputs `handle()` uses, so a preflight — the one response + // this adapter builds itself — carries the same security/CORS headers every other one does. const injected = computeInjected(opts, { secure, headers }); - let body: unknown; - - if (matched) { - const acquired = await acquireFetchBody(request, matched, headers, path, maxBody, opts, injected); - if ('response' in acquired) return acquired.response; - body = acquired.body; - } const result = await handle(routes, opts, { ...correlation, method: request.method, url: path, headers, - body, + readBody, + source: request, secure, // Mirrors Node's `deriveIp` (src/http/request.ts): only trust `x-forwarded-for` when the proxy is // trusted, and take its first hop — an untrusted XFF is client-spoofable, and there's no socket diff --git a/test/http.test.ts b/test/http.test.ts index fc322f2..a358652 100644 --- a/test/http.test.ts +++ b/test/http.test.ts @@ -112,6 +112,10 @@ describe('request hardening', () => { const res = await fetch(`${getUrl(server)}/echo`, { method: 'POST', body: 'x'.repeat(1000) }); expect(res.status).toBe(413); expect(ran).toBe(false); + // Load-bearing, not cosmetic: without it the rest of the upload keeps arriving on a + // kept-alive socket after the response. Node-only — `Connection` is a forbidden response + // header on the fetch side, which is why the adapter attaches it rather than the shared core. + expect(res.headers.get('connection')).toBe('close'); server.close(); }); From 101c4fe65a3f8f845907d8767f73bc0a3786964b Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Mon, 17 Aug 2026 10:05:04 -0500 Subject: [PATCH 30/46] chore: move the documentation site out to its own repository MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit website/ is now github.com/Expressive-Tea/green-tea-docs, carrying its own history — 31 commits, extracted with `git subtree split`, not squashed into an import that pretends the pages appeared all at once. What this repository gives up is real and worth naming: the site had no deploy pipeline at all, and CI here was the only thing proving it still built. That is why the new repository got a build gate and a tagged release before this deletion landed, rather than after. Removed with it: the three website steps in ci.yml (including the second setup-node that re-pinned 22.12 purely for the docs build — the core job stays on 18, the minimum supported version), the two package.json scripts, and the .astro/ and website/dist/ ignore rules that now belong over there. SECURITY.md pointed at `website/` as an out-of-scope path; it now points at the repository, since the path no longer exists to be out of scope. The split trades a CI coupling for a drift risk — nothing fails now when the docs and the API disagree. Both READMEs state the rule that replaces the build: a change to public API updates the page documenting it. That is the weakest of the options considered, and it is written down rather than assumed. Signed-off-by: Diego Resendez --- .github/workflows/ci.yml | 7 - .gitignore | 3 - README.md | 3 +- SECURITY.md | 3 +- package.json | 2 - website/astro.config.mjs | 77 - website/package-lock.json | 6853 ----------------- website/package.json | 15 - website/public/favicon.svg | 16 - website/src/assets/logo.svg | 16 - website/src/content.config.ts | 7 - website/src/content/docs/404.md | 11 - website/src/content/docs/concepts/flow.md | 24 - .../src/content/docs/concepts/the-graph.md | 47 - website/src/content/docs/getting-started.md | 95 - website/src/content/docs/guides/arguments.md | 148 - website/src/content/docs/guides/cli.md | 79 - .../docs/guides/dependency-injection.md | 147 - website/src/content/docs/guides/errors.md | 68 - website/src/content/docs/guides/html.md | 161 - .../src/content/docs/guides/introspection.md | 55 - website/src/content/docs/guides/mesh.md | 145 - .../src/content/docs/guides/observability.md | 145 - website/src/content/docs/guides/openapi.md | 43 - website/src/content/docs/guides/plugins.md | 64 - website/src/content/docs/guides/routing.md | 74 - website/src/content/docs/guides/runtimes.md | 174 - website/src/content/docs/guides/security.md | 103 - website/src/content/docs/guides/streaming.md | 116 - website/src/content/docs/guides/testing.md | 33 - website/src/content/docs/guides/uploads.md | 71 - website/src/content/docs/guides/validation.md | 84 - website/src/content/docs/index.mdx | 47 - .../src/content/docs/reference/createapp.md | 85 - .../src/content/docs/reference/decorators.md | 98 - website/src/styles/brand.css | 32 - website/tsconfig.json | 5 - 37 files changed, 3 insertions(+), 9153 deletions(-) delete mode 100644 website/astro.config.mjs delete mode 100644 website/package-lock.json delete mode 100644 website/package.json delete mode 100644 website/public/favicon.svg delete mode 100644 website/src/assets/logo.svg delete mode 100644 website/src/content.config.ts delete mode 100644 website/src/content/docs/404.md delete mode 100644 website/src/content/docs/concepts/flow.md delete mode 100644 website/src/content/docs/concepts/the-graph.md delete mode 100644 website/src/content/docs/getting-started.md delete mode 100644 website/src/content/docs/guides/arguments.md delete mode 100644 website/src/content/docs/guides/cli.md delete mode 100644 website/src/content/docs/guides/dependency-injection.md delete mode 100644 website/src/content/docs/guides/errors.md delete mode 100644 website/src/content/docs/guides/html.md delete mode 100644 website/src/content/docs/guides/introspection.md delete mode 100644 website/src/content/docs/guides/mesh.md delete mode 100644 website/src/content/docs/guides/observability.md delete mode 100644 website/src/content/docs/guides/openapi.md delete mode 100644 website/src/content/docs/guides/plugins.md delete mode 100644 website/src/content/docs/guides/routing.md delete mode 100644 website/src/content/docs/guides/runtimes.md delete mode 100644 website/src/content/docs/guides/security.md delete mode 100644 website/src/content/docs/guides/streaming.md delete mode 100644 website/src/content/docs/guides/testing.md delete mode 100644 website/src/content/docs/guides/uploads.md delete mode 100644 website/src/content/docs/guides/validation.md delete mode 100644 website/src/content/docs/index.mdx delete mode 100644 website/src/content/docs/reference/createapp.md delete mode 100644 website/src/content/docs/reference/decorators.md delete mode 100644 website/src/styles/brand.css delete mode 100644 website/tsconfig.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d2a6f0..b40873a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,13 +56,6 @@ jobs: - run: npm audit --omit=dev - run: npm audit continue-on-error: true - - uses: actions/setup-node@v4 - with: - node-version: '22.12' - - run: npm ci --prefix website - - run: npm audit --prefix website - continue-on-error: true - - run: npm run docs:build # Runs everywhere is the headline claim, so it gets tested rather than asserted. `npm test` is # Node only: a change to shared code can pass it and still be broken on Deno or Bun, which is diff --git a/.gitignore b/.gitignore index 1437e2f..c7b69f4 100644 --- a/.gitignore +++ b/.gitignore @@ -11,9 +11,6 @@ coverage/ .env .env.* -# Astro (docs site) -.astro/ -website/dist/ # Edge (Miniflare) test bundle artifact test/edge/_worker.mjs diff --git a/README.md b/README.md index 77cf5a2..8fa21ea 100644 --- a/README.md +++ b/README.md @@ -254,7 +254,7 @@ green-tea is **beta**, on the road to a release candidate. Express and Fastify h ## Docs & development -- **[green-tea.expressive-tea.io/docs](https://green-tea.expressive-tea.io/docs)** — getting started, concepts (the graph, `flow`), and guides: routing, DI, validation, uploads, streaming, HTML, security, errors, introspection, OpenAPI, plugins, mesh, runtimes, testing. +- **[green-tea.expressive-tea.io/docs](https://green-tea.expressive-tea.io/docs)** — getting started, concepts (the graph, `flow`), and guides: routing, DI, validation, uploads, streaming, HTML, security, errors, introspection, OpenAPI, plugins, mesh, runtimes, testing. Its source lives in [green-tea-docs](https://github.com/Expressive-Tea/green-tea-docs); a change to public API here needs a matching change there, because nothing fails when the two disagree. - **[matcha](https://github.com/Expressive-Tea/matcha)** — the CLI. `matcha new` scaffolds a project (Node, Deno, or Bun), `matcha create` generates and auto-wires controllers/steps/providers/modules, `matcha run` detects your runtime and watches. A standalone Rust binary — no JS runtime needed to install it. ```bash @@ -266,7 +266,6 @@ npm run test:edge # workerd via miniflare npm run typecheck # tsc --noEmit (includes the compile-time-guarantee type test) npm run build # emit dist/ (tsup: dual ESM + CJS) npm run bench # regenerate BENCHMARKS.md -npm run docs:dev # the documentation site (website/) ``` ## Roadmap diff --git a/SECURITY.md b/SECURITY.md index 9a112db..c6ed18e 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -57,7 +57,8 @@ In scope: anything in `src/` that ships in the published package — route match pipeline, body parsing and its limits, the security headers and CORS handling, TLS setup, the WebSocket upgrade path, the mesh wire protocol, static file serving and view rendering. -Out of scope: the benchmarks in `bench/`, the docs site in `website/`, dev-only tooling, and +Out of scope: the benchmarks in `bench/`, the documentation site (now its own repository, +[green-tea-docs](https://github.com/Expressive-Tea/green-tea-docs)), dev-only tooling, and anything that requires an attacker to already control your application code. Advisories in build-time dependencies are worth telling us about, but they are not vulnerabilities in green-tea and we handle them as ordinary dependency updates. diff --git a/package.json b/package.json index f9ef571..f88ff05 100644 --- a/package.json +++ b/package.json @@ -97,8 +97,6 @@ "lint:fix": "eslint src --fix", "format": "prettier --write \"src/**/*.ts\"", "format:check": "prettier --check \"src/**/*.ts\"", - "docs:dev": "npm --prefix website run dev", - "docs:build": "npm --prefix website run build", "complexity": "ccts src", "complexity:check": "node scripts/check-complexity.mjs", "complexity:cyclomatic": "cyclomatic-complexity \"src/**/*.ts\" -tw 15 -te 25", diff --git a/website/astro.config.mjs b/website/astro.config.mjs deleted file mode 100644 index cce1f39..0000000 --- a/website/astro.config.mjs +++ /dev/null @@ -1,77 +0,0 @@ -import { defineConfig } from 'astro/config'; -import starlight from '@astrojs/starlight'; - -// Docs site for @green-tea/core. Content lives in src/content/docs/**. -export default defineConfig({ - site: 'https://green-tea.expressive-tea.io', - base: '/docs', - integrations: [ - starlight({ - // GoatCounter — same site code as the marketing site, so /docs traffic lands in - // the same dashboard and referrer paths stay comparable. - head: [ - { - tag: 'script', - attrs: { - 'data-goatcounter': 'https://greentea.goatcounter.com/count', - async: true, - src: '//gc.zgo.at/count.js', - }, - }, - ], - // Let the content-backed 404.md own /404; otherwise Astro also injects a conflicting route. - disable404Route: true, - title: 'Green Tea.', - description: 'A zen, opinionated, type-safe framework — your API is a graph, not a chain.', - logo: { src: './src/assets/logo.svg', alt: 'Green Tea' }, - favicon: '/favicon.svg', - customCss: ['./src/styles/brand.css'], - tableOfContents: { minHeadingLevel: 2, maxHeadingLevel: 3 }, - sidebar: [ - { - label: 'Start here', - items: [ - { label: 'Introduction', link: '/' }, - { label: 'Getting started', slug: 'getting-started' }, - ], - }, - { - label: 'Concepts', - items: [ - { label: 'The dependency graph', slug: 'concepts/the-graph' }, - { label: 'The typed flow core', slug: 'concepts/flow' }, - ], - }, - { - label: 'Guides', - items: [ - { label: 'The matcha CLI', slug: 'guides/cli' }, - { label: 'Routing', slug: 'guides/routing' }, - { label: 'Dependency injection', slug: 'guides/dependency-injection' }, - { label: 'Argument decorators', slug: 'guides/arguments' }, - { label: 'Validation', slug: 'guides/validation' }, - { label: 'Error handling', slug: 'guides/errors' }, - { label: 'Streaming & real-time', slug: 'guides/streaming' }, - { label: 'File uploads', slug: 'guides/uploads' }, - { label: 'HTML & views', slug: 'guides/html' }, - { label: 'Transport security', slug: 'guides/security' }, - { label: 'Plugins', slug: 'guides/plugins' }, - { label: 'Observability', slug: 'guides/observability' }, - { label: 'Graph introspection', slug: 'guides/introspection' }, - { label: 'OpenAPI', slug: 'guides/openapi' }, - { label: 'Runtimes', slug: 'guides/runtimes' }, - { label: 'Testing', slug: 'guides/testing' }, - { label: 'Mesh (alpha)', slug: 'guides/mesh', badge: { text: 'alpha', variant: 'caution' } }, - ], - }, - { - label: 'Reference', - items: [ - { label: 'Decorators', slug: 'reference/decorators' }, - { label: 'createApp options', slug: 'reference/createapp' }, - ], - }, - ], - }), - ], -}); diff --git a/website/package-lock.json b/website/package-lock.json deleted file mode 100644 index 5113208..0000000 --- a/website/package-lock.json +++ /dev/null @@ -1,6853 +0,0 @@ -{ - "name": "green-tea-docs", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "green-tea-docs", - "dependencies": { - "@astrojs/starlight": "^0.41.6", - "astro": "^7.1.6", - "sharp": "^0.35.3" - } - }, - "node_modules/@astrojs/compiler-binding": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding/-/compiler-binding-0.3.2.tgz", - "integrity": "sha512-8w/9CWmYrAJJ8N0SY3O43ws2BgxoW6u3QsD8u2mE140lMYAlwh+tlNoUeSBq22wVheFuiBbR212l6ixZ2IIgCQ==", - "license": "MIT", - "engines": { - "node": "^20.19.0 || >=22.12.0" - }, - "optionalDependencies": { - "@astrojs/compiler-binding-darwin-arm64": "0.3.2", - "@astrojs/compiler-binding-darwin-x64": "0.3.2", - "@astrojs/compiler-binding-linux-arm64-gnu": "0.3.2", - "@astrojs/compiler-binding-linux-arm64-musl": "0.3.2", - "@astrojs/compiler-binding-linux-x64-gnu": "0.3.2", - "@astrojs/compiler-binding-linux-x64-musl": "0.3.2", - "@astrojs/compiler-binding-wasm32-wasi": "0.3.2", - "@astrojs/compiler-binding-win32-arm64-msvc": "0.3.2", - "@astrojs/compiler-binding-win32-x64-msvc": "0.3.2" - } - }, - "node_modules/@astrojs/compiler-binding-darwin-arm64": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-darwin-arm64/-/compiler-binding-darwin-arm64-0.3.2.tgz", - "integrity": "sha512-MM8tn8CSimcfytaOla4b6acN8mKWiL/rlAA1fpT3/Wl7dNGSE4y8FjTN/zJVNnb63CsLWG5zZwCt01TXtDKh9g==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@astrojs/compiler-binding-darwin-x64": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-darwin-x64/-/compiler-binding-darwin-x64-0.3.2.tgz", - "integrity": "sha512-2lXOlzf8xb7jLomRsf/aswh61/NnGusynB2OwFkK6k4pmOtpfXMYnG0PLfXrEvxXYj69NdCnmUYXtHDd+JOOag==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@astrojs/compiler-binding-linux-arm64-gnu": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-linux-arm64-gnu/-/compiler-binding-linux-arm64-gnu-0.3.2.tgz", - "integrity": "sha512-BmU3kWj7qnLrd4vzm49zFEPJ5oFnn1tCT4Vt9hZbqdU5Cmb8GZl7fn6VFsnNfe7B18a2gIFtVzbLINtYl5kBjQ==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@astrojs/compiler-binding-linux-arm64-musl": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-linux-arm64-musl/-/compiler-binding-linux-arm64-musl-0.3.2.tgz", - "integrity": "sha512-f0heT9ZZEseSu5bHCeb80eL2DH07ArE6U9xi1WT/PEusNjzPmEr3GJsjG1tRLo5VYUUYX7h3ScaqGmGrMOVGmw==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@astrojs/compiler-binding-linux-x64-gnu": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-linux-x64-gnu/-/compiler-binding-linux-x64-gnu-0.3.2.tgz", - "integrity": "sha512-M8fOUt0itRpqiGyoEA/ij184s8O+hqbCz3+YozRusOOM3osgGljpDThhbKAJjqh82wOo6FioQ4w8PBvU1XMD5Q==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@astrojs/compiler-binding-linux-x64-musl": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-linux-x64-musl/-/compiler-binding-linux-x64-musl-0.3.2.tgz", - "integrity": "sha512-/Kebk8sO6HnLeSd691JkaAPfN7CqR9/KEXmWvyNPkaKNGmj8rTZ/lf2uXtnPu92Lan84UrKdIKVPy1fSo2encQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@astrojs/compiler-binding-wasm32-wasi": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-wasm32-wasi/-/compiler-binding-wasm32-wasi-0.3.2.tgz", - "integrity": "sha512-pUA6xbcOSB7DhfzIArB8BCAkFfAIqriiR7zl5zOStd6oU2G0kIKj+GUdGnyXyhfiv881Hffyk5tC0mR18sDjDw==", - "cpu": [ - "wasm32" - ], - "license": "MIT", - "optional": true, - "dependencies": { - "@napi-rs/wasm-runtime": "^1.2.0" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/@astrojs/compiler-binding-win32-arm64-msvc": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-win32-arm64-msvc/-/compiler-binding-win32-arm64-msvc-0.3.2.tgz", - "integrity": "sha512-ESruf+6Qkl1trHUFxI6GSf6t52j8yN2kCNSzMWdzt7V/T09tFHrYzrVaJQohb2C9bJUH76pNvX6Zb51+xCQc9Q==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@astrojs/compiler-binding-win32-x64-msvc": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-win32-x64-msvc/-/compiler-binding-win32-x64-msvc-0.3.2.tgz", - "integrity": "sha512-wzzVrEbOwbsLWOdEbocskjMRx2aZPxJ7ZbmL+jnpBamFwmigm+2M/wzuM6JWncocgYwLic1csSpalBh96kQKXA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@astrojs/compiler-rs": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@astrojs/compiler-rs/-/compiler-rs-0.3.2.tgz", - "integrity": "sha512-xlx/T7JovIKduu4ucbTQUxQ5+Q8wxkHxhLjnZk3VlJbhbQ9RLvvuDk1p2YYFYFQ5y14dVm3FGGO4isQXa4F+Tg==", - "license": "MIT", - "dependencies": { - "@astrojs/compiler-binding": "0.3.2" - }, - "engines": { - "node": ">=22.12.0" - } - }, - "node_modules/@astrojs/internal-helpers": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/@astrojs/internal-helpers/-/internal-helpers-0.10.1.tgz", - "integrity": "sha512-5phcroT/vmOOrYuuAxtkbPixy5hePtlz9i8K4OeDv3dNK6/UQRuXPOSRTxIOBbUY5Sonw2UaxjbuVc43Mcir6Q==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.4", - "@types/mdast": "^4.0.4", - "js-yaml": "^4.1.1", - "picomatch": "^4.0.4", - "retext-smartypants": "^6.2.0", - "shiki": "^4.0.2", - "smol-toml": "^1.6.0", - "unified": "^11.0.5" - } - }, - "node_modules/@astrojs/markdown-satteri": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/@astrojs/markdown-satteri/-/markdown-satteri-0.3.5.tgz", - "integrity": "sha512-CvWVEFAbay7YO+i9SaqDJubipA5ckiVB89QWoMJ5XC0m5CtFg8JwZ7Kau6X9sYY7FZURH0w2l03ISH2jOS/RDQ==", - "license": "MIT", - "dependencies": { - "@astrojs/internal-helpers": "0.10.2", - "@astrojs/prism": "4.0.2", - "github-slugger": "^2.0.0", - "hast-util-from-html": "^2.0.3", - "satteri": "^0.9.1" - } - }, - "node_modules/@astrojs/markdown-satteri/node_modules/@astrojs/internal-helpers": { - "version": "0.10.2", - "resolved": "https://registry.npmjs.org/@astrojs/internal-helpers/-/internal-helpers-0.10.2.tgz", - "integrity": "sha512-yt7fMgPYqSM4Tmr+taTW6Per+hjJ8Pk6lA1PAcDyqzOt8HzJ6Kje5WzCxA2Sd+9wsUW7uhkLeoTMK0cXPwH9rQ==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.4", - "@types/mdast": "^4.0.4", - "js-yaml": "^4.3.0", - "picomatch": "^4.0.4", - "retext-smartypants": "^6.2.0", - "shiki": "^4.0.2", - "smol-toml": "^1.6.0", - "unified": "^11.0.5" - } - }, - "node_modules/@astrojs/mdx": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@astrojs/mdx/-/mdx-7.0.2.tgz", - "integrity": "sha512-l+sJY5U1KkGZUdr+bIL4Y6BefeS549qoSHVSkUSs6A9INwdCND+/0+vN0NroPBXwl5Vcg5u78t7VQRsJjePxbw==", - "license": "MIT", - "dependencies": { - "@astrojs/internal-helpers": "0.10.1", - "@astrojs/markdown-remark": "7.2.1", - "@mdx-js/mdx": "^3.1.1", - "acorn": "^8.16.0", - "es-module-lexer": "^2.0.0", - "estree-util-visit": "^2.0.0", - "hast-util-to-html": "^9.0.5", - "piccolore": "^0.1.3", - "rehype-raw": "^7.0.0", - "remark-gfm": "^4.0.1", - "remark-smartypants": "^3.0.2", - "source-map": "^0.7.6", - "unist-util-visit": "^5.1.0", - "vfile": "^6.0.3" - }, - "engines": { - "node": ">=22.12.0" - }, - "peerDependencies": { - "@astrojs/markdown-satteri": "^0.3.1", - "astro": "^7.0.0" - }, - "peerDependenciesMeta": { - "@astrojs/markdown-satteri": { - "optional": true - } - } - }, - "node_modules/@astrojs/mdx/node_modules/@astrojs/markdown-remark": { - "version": "7.2.1", - "resolved": "https://registry.npmjs.org/@astrojs/markdown-remark/-/markdown-remark-7.2.1.tgz", - "integrity": "sha512-jPVNIqTvk+yKviikszv/Y1U4jGUSKpp/Nw48QZV4qjWgp70j4Lkq3lhSDRbWwCfgKvEyO9GHuVbV1dM2WYXy1w==", - "license": "MIT", - "dependencies": { - "@astrojs/internal-helpers": "0.10.1", - "@astrojs/prism": "4.0.2", - "github-slugger": "^2.0.0", - "hast-util-from-html": "^2.0.3", - "hast-util-to-text": "^4.0.2", - "mdast-util-definitions": "^6.0.0", - "rehype-raw": "^7.0.0", - "rehype-stringify": "^10.0.1", - "remark-gfm": "^4.0.1", - "remark-parse": "^11.0.0", - "remark-rehype": "^11.1.2", - "remark-smartypants": "^3.0.2", - "unified": "^11.0.5", - "unist-util-remove-position": "^5.0.0", - "unist-util-visit": "^5.1.0", - "unist-util-visit-parents": "^6.0.2", - "vfile": "^6.0.3" - } - }, - "node_modules/@astrojs/prism": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-4.0.2.tgz", - "integrity": "sha512-KTivpmnz6lDsC6o9H4+DNm2SrE/GHzw8cNAvEJwAvUT+eoaEnn/4NtbDNfRRaxaJHdp15gf+tfHAWiXR4wB3BA==", - "license": "MIT", - "dependencies": { - "prismjs": "^1.30.0" - }, - "engines": { - "node": ">=22.12.0" - } - }, - "node_modules/@astrojs/sitemap": { - "version": "3.7.3", - "resolved": "https://registry.npmjs.org/@astrojs/sitemap/-/sitemap-3.7.3.tgz", - "integrity": "sha512-f8euLVsyeAmAkSm/1M2Kb8sL8byQmfgbvBNaHFItCheTj/IpiJYSEWVcqDHZ/yEHxiS7+w87mQkzwZaPHmk5GA==", - "license": "MIT", - "dependencies": { - "sitemap": "^9.0.0", - "stream-replace-string": "^2.0.0", - "zod": "^4.3.6" - } - }, - "node_modules/@astrojs/starlight": { - "version": "0.41.6", - "resolved": "https://registry.npmjs.org/@astrojs/starlight/-/starlight-0.41.6.tgz", - "integrity": "sha512-Dt0/wY2JbFGUpxMgclw1j2Iqks2GG0LHYKgP7TfBXsFrs4LIbKvQ596lzyhXLz6nFcnPdIB9ZRFyDJeuVcx3Ug==", - "license": "MIT", - "dependencies": { - "@astrojs/markdown-satteri": "^0.3.2", - "@astrojs/mdx": "^7.0.0", - "@astrojs/sitemap": "^3.7.2", - "@pagefind/default-ui": "^1.3.0", - "@types/hast": "^3.0.4", - "@types/js-yaml": "^4.0.9", - "@types/mdast": "^4.0.4", - "astro-expressive-code": "^0.44.0", - "bcp-47": "^2.1.0", - "hast-util-from-html": "^2.0.3", - "hast-util-select": "^6.0.4", - "hast-util-to-string": "^3.0.1", - "hastscript": "^9.0.1", - "i18next": "^26.0.7", - "js-yaml": "^4.1.1", - "klona": "^2.0.6", - "magic-string": "^0.30.21", - "mdast-util-directive": "^3.1.0", - "mdast-util-to-markdown": "^2.1.2", - "mdast-util-to-string": "^4.0.0", - "pagefind": "^1.5.2", - "rehype": "^13.0.2", - "rehype-format": "^5.0.1", - "remark-directive": "^4.0.0", - "satteri": "^0.9.1", - "ultrahtml": "^1.6.0", - "unified": "^11.0.5", - "unist-util-visit": "^5.1.0", - "vfile": "^6.0.3" - }, - "peerDependencies": { - "@astrojs/markdown-remark": "^7.2.0", - "astro": "^7.0.2" - }, - "peerDependenciesMeta": { - "@astrojs/markdown-remark": { - "optional": true - } - } - }, - "node_modules/@astrojs/telemetry": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/@astrojs/telemetry/-/telemetry-3.3.3.tgz", - "integrity": "sha512-C1TLn5sPJr0x4vk56piHWKbnqlEB8BKyte5Y45V02U+D7BGO5eMqZDH5aPjnkXQWJggvmsTXxH03QMZ9NgWLzQ==", - "license": "MIT", - "dependencies": { - "ci-info": "^4.4.0", - "dset": "^3.1.4", - "is-docker": "^4.0.0", - "package-manager-detector": "^1.6.0" - }, - "engines": { - "node": "18.20.8 || ^20.3.0 || >=22.0.0" - } - }, - "node_modules/@babel/helper-string-parser": { - "version": "7.29.7", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz", - "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==", - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.29.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", - "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/parser": { - "version": "7.29.7", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.7.tgz", - "integrity": "sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg==", - "license": "MIT", - "dependencies": { - "@babel/types": "^7.29.7" - }, - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/types": { - "version": "7.29.7", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.7.tgz", - "integrity": "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA==", - "license": "MIT", - "dependencies": { - "@babel/helper-string-parser": "^7.29.7", - "@babel/helper-validator-identifier": "^7.29.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@bruits/satteri-darwin-arm64": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/@bruits/satteri-darwin-arm64/-/satteri-darwin-arm64-0.9.4.tgz", - "integrity": "sha512-W3MSUkr2mZRR8Stoe+lqNAyzQzRuFMU8WffV9IvFSxTok0LGWR0ZZQPLELU4QTRiUbhL2Y4VUP9vV7pj8rHjgg==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@bruits/satteri-darwin-x64": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/@bruits/satteri-darwin-x64/-/satteri-darwin-x64-0.9.4.tgz", - "integrity": "sha512-DXOuuaE1lsv7mpk2mOvGrzqoEWEvOIZEO/fXVa7zfM23Iob+CBjBkRAMwpHA4pmZ3j6Gj7WJzPKw0kQ7w741AQ==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@bruits/satteri-linux-arm64-gnu": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/@bruits/satteri-linux-arm64-gnu/-/satteri-linux-arm64-gnu-0.9.4.tgz", - "integrity": "sha512-gJxU9rGGoqIznSEgEzpjxkry24jeHuMpoo1tCIAhHYh7WaD3j5F8zt3jmHxEaN1Uwa+K5+wFgIR2uIGOnMzEmw==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@bruits/satteri-linux-arm64-musl": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/@bruits/satteri-linux-arm64-musl/-/satteri-linux-arm64-musl-0.9.4.tgz", - "integrity": "sha512-Wjzu9hmmAbfmDkBfPI1VdZygJtYz9uYZQnkEyrXi6S2JFi+2pXQ1A5irj38bqm0IZmWcTbk0cVG4NZnPdtVNJA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@bruits/satteri-linux-x64-gnu": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/@bruits/satteri-linux-x64-gnu/-/satteri-linux-x64-gnu-0.9.4.tgz", - "integrity": "sha512-MR1Q+wMx65FQlbSV7cRqWW87Knp0zkoaIV55Dt+xZl028wJABXEPEEmG3670SLq7lVZvcGIDwCgSg2kCYxvRwA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@bruits/satteri-linux-x64-musl": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/@bruits/satteri-linux-x64-musl/-/satteri-linux-x64-musl-0.9.4.tgz", - "integrity": "sha512-T4gxhXve3zyNAZesrXAd/rDZOGRkbfFIUFld4TGsw6BsjoIteCcDji6IMqeXyaWEVSykY2X8Eid2hr6aXGYAaw==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@bruits/satteri-wasm32-wasi": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/@bruits/satteri-wasm32-wasi/-/satteri-wasm32-wasi-0.9.4.tgz", - "integrity": "sha512-/CEG8LUlpaBEnhFnYVn0UnlHFLs51UhrkJBUPDUXLzkadzAcnR88iRA/nOl7Zwhjb4WhfBV4p3P5qeOJMtH0iA==", - "cpu": [ - "wasm32" - ], - "optional": true, - "dependencies": { - "@emnapi/core": "1.11.1", - "@emnapi/runtime": "1.11.1", - "@napi-rs/wasm-runtime": "^1.1.6" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/@bruits/satteri-wasm32-wasi/node_modules/@emnapi/core": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.11.1.tgz", - "integrity": "sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ==", - "license": "MIT", - "optional": true, - "dependencies": { - "@emnapi/wasi-threads": "1.2.2", - "tslib": "^2.4.0" - } - }, - "node_modules/@bruits/satteri-wasm32-wasi/node_modules/@emnapi/runtime": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.1.tgz", - "integrity": "sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw==", - "license": "MIT", - "optional": true, - "dependencies": { - "tslib": "^2.4.0" - } - }, - "node_modules/@bruits/satteri-win32-arm64-msvc": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/@bruits/satteri-win32-arm64-msvc/-/satteri-win32-arm64-msvc-0.9.4.tgz", - "integrity": "sha512-E1ZPQbgCtFKiU7pFYVndynvY7ne4coeVDUgnVThErSFlJ2ceQCBZrfRTD1lzrIDy63Bbqo+g/cZY9duw+JYjIw==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@bruits/satteri-win32-x64-msvc": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/@bruits/satteri-win32-x64-msvc/-/satteri-win32-x64-msvc-0.9.4.tgz", - "integrity": "sha512-5I7SiarsNdAUuhJb50CXJPTwr/ECVrBoU+fymoLjChK5fW//+srhY4lstcNTzgFRtQSYfVtm4OQZz16CVMeTeA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@capsizecss/unpack": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@capsizecss/unpack/-/unpack-4.0.1.tgz", - "integrity": "sha512-CuNiSqg7+e1cO/GjffyMOm5Tt2jUF9CWHHnvQ/UkqvtkGfHdgwEC0wpmq7fkN3gxwpRnrAN0WzO3vREKmNolMQ==", - "license": "MIT", - "dependencies": { - "fontkitten": "^1.0.3" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/@clack/core": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/@clack/core/-/core-1.4.3.tgz", - "integrity": "sha512-/kr3UWNtdJfxZtPgDqUOmG2pvwlmcLGheex5yiZKdwbzZJxhV+HMNR9QNmyY5cGwTNV6LrR7Jtp+KjhUAP1qBQ==", - "license": "MIT", - "dependencies": { - "fast-wrap-ansi": "^0.2.0", - "sisteransi": "^1.0.5" - }, - "engines": { - "node": ">= 20.12.0" - } - }, - "node_modules/@clack/prompts": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@clack/prompts/-/prompts-1.7.0.tgz", - "integrity": "sha512-y7/yvZ2TPAnR9+jnc00klvNNLkJiXFFrQA/hlLCcxA9a2A4zQIOimyFQ9XfwYKiGD1fb5GY8vbKIIgO8d5Tb2A==", - "license": "MIT", - "dependencies": { - "@clack/core": "1.4.3", - "fast-string-width": "^3.0.2", - "fast-wrap-ansi": "^0.2.0", - "sisteransi": "^1.0.5" - }, - "engines": { - "node": ">= 20.12.0" - } - }, - "node_modules/@ctrl/tinycolor": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@ctrl/tinycolor/-/tinycolor-4.2.0.tgz", - "integrity": "sha512-kzyuwOAQnXJNLS9PSyrk0CWk35nWJW/zl/6KvnTBMFK65gm7U1/Z5BqjxeapjZCIhQcM/DsrEmcbRwDyXyXK4A==", - "license": "MIT", - "engines": { - "node": ">=14" - } - }, - "node_modules/@emnapi/core": { - "version": "1.11.2", - "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.11.2.tgz", - "integrity": "sha512-TC8MkTuZUtcTSiFeuC0ksCh9QIJ5+F21MvZ4Wn4ORfYaFJ/0dsiudv5tVkejgwZlwQ39jL9WWDe2lz8x0WglOA==", - "license": "MIT", - "optional": true, - "peer": true, - "dependencies": { - "@emnapi/wasi-threads": "1.2.2", - "tslib": "^2.4.0" - } - }, - "node_modules/@emnapi/runtime": { - "version": "1.11.2", - "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.2.tgz", - "integrity": "sha512-kyOl3X0DuTiT1h2ft8r2fYO8JYtU9a9Xis/zBSiGArNaagCOWx90N1k2wxp18czFDH+OgcWGb5ZP/XMt3dcyPA==", - "license": "MIT", - "optional": true, - "dependencies": { - "tslib": "^2.4.0" - } - }, - "node_modules/@emnapi/wasi-threads": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.2.tgz", - "integrity": "sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==", - "license": "MIT", - "optional": true, - "dependencies": { - "tslib": "^2.4.0" - } - }, - "node_modules/@esbuild/aix-ppc64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.1.tgz", - "integrity": "sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ==", - "cpu": [ - "ppc64" - ], - "license": "MIT", - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.1.tgz", - "integrity": "sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.1.tgz", - "integrity": "sha512-34EGEbCIAgosYz6goLcopX6Mo7NyGv9tfwEM2/7Ce2VcVRk568iSvniGWcUXIy7wEDR1wzolcxcriFVrWYcwBg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.1.tgz", - "integrity": "sha512-dbwY7ltSMDWsRatcRpCnES4F+im88OCUgGZjy52shC7GqHRE/cYlxNbB4Z4UpJswpcc4Qxd2oE/ufM0p61IKng==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.1.tgz", - "integrity": "sha512-TZbWkQY7kvTAXbXUT7uVACR5cMHsDiSz9z7ZKAX/RTq/WJEk3QyRr0wZpNhBDX+/0CtdqUIJlOiodQcta6tY3Q==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.1.tgz", - "integrity": "sha512-zfdzgK9ACBNZLI/CyHTOx81SyNbM6YXn7rxSgX97VjyiPl9W1i4Ka4fgKECEoFCKGpvBj5qArWIGgQjOwkgskQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.1.tgz", - "integrity": "sha512-wG2EA8ENdEI0qhkSZMjfqrdY+ziCYCPMmtZjjIwOmXFjmyzEHn+UUxk5of+SYsjtfs3VpnlC7QLzSI5hY/rOAw==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.1.tgz", - "integrity": "sha512-i7dZ9vQgnvSCzi/rYCXNgtF/U+eKZNJBzu3eTQbRgHnM7tNSizLOkRFAl3qzVc/Op/u5YkHHa4pf/3DOYHthLQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.1.tgz", - "integrity": "sha512-qVXBOHQS+d5Y722GwJzJUtOLlX7km3CraOaGormF1pDtPd2C/l1SHRPgjLunLGe51Sh5YYWKMFDyV4SxgMQYTQ==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.1.tgz", - "integrity": "sha512-yHs+0uc8+nvEAfAfxrWQKK5peSNzBc4PegcMO0EJ2hT71uA7vB8Ihg2e77R2P7SG5uYjPbHlLLmve4LLLRCf0g==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.1.tgz", - "integrity": "sha512-d1z4ZuP0ajrfz/FhGT4vv278rX8KnPPJx8i5+AtK7TYbx9Le9F1hyzurZpkEyjkGa9dUGhQow4C1NmeGvqxN2w==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.1.tgz", - "integrity": "sha512-M5sRjUVZrkm1OAPR3dlOYzNmN+loZKGVi1VUQGrwuqLcbR6qeAz+famMhjASeH3YVKvZz+zT1jlh/keC3Rj/lg==", - "cpu": [ - "loong64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.1.tgz", - "integrity": "sha512-mRObBZeHh2OxcBFPWE/FjylkRgZdYuiTR3vaTozquCGOH14iP9oN4x4Ge81CoIDYQrXmIxpFumJBu5MtZpnQJQ==", - "cpu": [ - "mips64el" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.1.tgz", - "integrity": "sha512-slScBsMAb3GFDcdrCgLwZtPYRoH2H/youv10QiZyRjmsP48fznoveWytSgCI/R0ZcUgpc0ZhIUEx6LHts8yrfQ==", - "cpu": [ - "ppc64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.1.tgz", - "integrity": "sha512-kw0owk1o0GFETUJyW0jc0G4Yzs0BHZn0JDZ8JRT088vjJYX777BAs1fDGxAC+q831qOs2DTC96mNsG2opdfyyQ==", - "cpu": [ - "riscv64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.1.tgz", - "integrity": "sha512-/lAIjX8aYFRByhh6L5rYtPEDRqa9de/4V/juOXcta5frjvzXO4/sqEtyytse0g3zZFuWu5cDN0MkLz2qRDD2Ag==", - "cpu": [ - "s390x" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.1.tgz", - "integrity": "sha512-u/anNYF2mmVOEDwLtnQ1wOr3EZ9sTNGLWrsYGYwHWzGA3Si84IOkHXlbWTD1NB+9/1lcnweYKO54uhxZydNzfA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.1.tgz", - "integrity": "sha512-oks0DYbLwWMmaakTsCb+zL4E+aHRVLom9IJZOAthMQEPiQmydXHkziYEsGYRx0uNV/IjEKGAV941JzH02pflqw==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.1.tgz", - "integrity": "sha512-aeL6lAnN89Hz43Mlh1G8ARasbuoYvSITDEx0tHh5b7jJnHcssqgjy9Yx430GDpmCa6OyrKoS0aNRjKundRizGg==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.1.tgz", - "integrity": "sha512-MEFJe5C3R8pwXdZ5Y21oo6m7ePiS0d9pWucn99O/wvyJZChoIQKrQDxKrGeW8F5+T0okTHesAmDeiHDTIq0V/Q==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.1.tgz", - "integrity": "sha512-i/ZLIOafE0Z8cI/XANJAixoJL/uRAoS2xOA3rb0xN+KK0K177cMAsQYkzHtBrtMXAKuAc7HGgcWiZ/sRC1Nxgw==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openharmony-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.1.tgz", - "integrity": "sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.1.tgz", - "integrity": "sha512-BEjgtECkL3vY+SaSQ6nzVfiALUeFxpawyp8Jmf5PtYhf1Ug40N1h/hxlhts+f1FvSvarEigdxS3BlSMI2PJLcQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.1.tgz", - "integrity": "sha512-lCv9eK/H6ZJWbE7bh2nw54CZ9M2nupBxJcTsdk/QQnWkdSjKGuxmmH8/GWrlT1eMmZfn4dGcCjRte397WqfQXA==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.1.tgz", - "integrity": "sha512-zvb/mB2bSCoJOpoCBgYKKpX6YM6mJBlBUVUtVj41DlZJVEB6/0CKlRYxP5wWl1C1ILiCoAU5wZZ4q1P3qeS6Eg==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.1.tgz", - "integrity": "sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@expressive-code/core": { - "version": "0.44.0", - "resolved": "https://registry.npmjs.org/@expressive-code/core/-/core-0.44.0.tgz", - "integrity": "sha512-xgiF2P6tYUbrhi3+x0S8xHZWT1t3Bvb3U91tAtRbLb9HLejLvYc5GZUqKICKLaUN4iSGhhNJu2fM/aH8e5yCMg==", - "license": "MIT", - "dependencies": { - "@ctrl/tinycolor": "^4.0.4", - "hast-util-select": "^6.0.2", - "hast-util-to-html": "^9.0.1", - "hast-util-to-text": "^4.0.1", - "hastscript": "^9.0.0", - "postcss": "^8.4.38", - "postcss-nested": "^6.0.1", - "unist-util-visit": "^5.0.0", - "unist-util-visit-parents": "^6.0.1" - } - }, - "node_modules/@expressive-code/plugin-frames": { - "version": "0.44.0", - "resolved": "https://registry.npmjs.org/@expressive-code/plugin-frames/-/plugin-frames-0.44.0.tgz", - "integrity": "sha512-V6M6+zVc1GzqCvXkQHc2m5rcFOIVzJgMq5gnfrMnVf2gwtj/sg4H93c1f/mGeqHycubwkHFUDyParAOiGeDZeA==", - "license": "MIT", - "dependencies": { - "@expressive-code/core": "^0.44.0" - } - }, - "node_modules/@expressive-code/plugin-shiki": { - "version": "0.44.0", - "resolved": "https://registry.npmjs.org/@expressive-code/plugin-shiki/-/plugin-shiki-0.44.0.tgz", - "integrity": "sha512-RZsdaqlbGqyAQKuoX4myQXxjmiE2l5KBpJ/gKPh62tCdIdpWyjbzVqSo8+5XsezZxkfi8AJ/J6EUaBTPROFX/Q==", - "license": "MIT", - "dependencies": { - "@expressive-code/core": "^0.44.0", - "shiki": "^4.0.2" - } - }, - "node_modules/@expressive-code/plugin-text-markers": { - "version": "0.44.0", - "resolved": "https://registry.npmjs.org/@expressive-code/plugin-text-markers/-/plugin-text-markers-0.44.0.tgz", - "integrity": "sha512-0/m3A5b+lz2upyNq+wzZ1S69HRoJmyFs5LsR42lVZ9pmGRlBiSBYQpvqlji4DBj1+Riamxc0AvcCr5kuzOQeWA==", - "license": "MIT", - "dependencies": { - "@expressive-code/core": "^0.44.0" - } - }, - "node_modules/@img/colour": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.1.0.tgz", - "integrity": "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==", - "license": "MIT", - "engines": { - "node": ">=18" - } - }, - "node_modules/@img/sharp-darwin-arm64": { - "version": "0.35.3", - "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.35.3.tgz", - "integrity": "sha512-RMnFX7YQsMoh7lWfcM4NEHHymBX/rLuKNPVM84XE9ONPcaSCDgE7CHIHpSgPcO2xcRthgBy1HfNO319mwhIAkg==", - "cpu": [ - "arm64" - ], - "license": "Apache-2.0", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=20.9.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-darwin-arm64": "1.3.2" - } - }, - "node_modules/@img/sharp-darwin-x64": { - "version": "0.35.3", - "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.35.3.tgz", - "integrity": "sha512-Xo+5uFBtLN0BKqieTxiFzFPQAUlBbbH5iBKyRX/z1JrbnYsHTfKJnUfL8+p2TPXr1pXqao4eeL4Rl144uDpK9w==", - "cpu": [ - "x64" - ], - "license": "Apache-2.0", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=20.9.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-darwin-x64": "1.3.2" - } - }, - "node_modules/@img/sharp-freebsd-wasm32": { - "version": "0.35.3", - "resolved": "https://registry.npmjs.org/@img/sharp-freebsd-wasm32/-/sharp-freebsd-wasm32-0.35.3.tgz", - "integrity": "sha512-lUxcqWIj2wMQ9BrwNjngcr1gWUr5xgaGThBRqPPalIC2n67Cqj1uPh8NnA/ZhAg8hUbKl+kVHKwgUIwe6ZYPrg==", - "license": "Apache-2.0", - "optional": true, - "os": [ - "freebsd" - ], - "dependencies": { - "@img/sharp-wasm32": "0.35.3" - }, - "engines": { - "node": ">=20.9.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-darwin-arm64": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.3.2.tgz", - "integrity": "sha512-9J6ypZFpQBj4YnePGoq/S38w6nz+vqg5WZLrLGY4YuSemdMq47GMLBPO42MzwdGwpg/agZ7xzZcFHa48xlywfg==", - "cpu": [ - "arm64" - ], - "license": "LGPL-3.0-or-later", - "optional": true, - "os": [ - "darwin" - ], - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-darwin-x64": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.3.2.tgz", - "integrity": "sha512-m2pW1n6cns9VaubNwsZ+c3CRYjxNQWgJ5gPlnL1nbBcpkBvFm6SCFN5o0psFHI8w9n11NKhFkeEDns98tiqbEw==", - "cpu": [ - "x64" - ], - "license": "LGPL-3.0-or-later", - "optional": true, - "os": [ - "darwin" - ], - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linux-arm": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.3.2.tgz", - "integrity": "sha512-1eMLzy92I4J6rmi4mAT8yC3HxOtniyGELlzGbNMLLeqe052ahFQ0h6LFq+lh5DsDIdYViIDst08abvSbcEdLXQ==", - "cpu": [ - "arm" - ], - "license": "LGPL-3.0-or-later", - "optional": true, - "os": [ - "linux" - ], - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linux-arm64": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.3.2.tgz", - "integrity": "sha512-dqVSFynCox4C/J8kT16V7SIFAns0IjgLwkvYT7p8LQVmJ5OS5b6tI9IGflxTeuBS//zXeFIUbwt5dwxyZ17cnA==", - "cpu": [ - "arm64" - ], - "license": "LGPL-3.0-or-later", - "optional": true, - "os": [ - "linux" - ], - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linux-ppc64": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.3.2.tgz", - "integrity": "sha512-3z0NHDxD6n5I9gc05U1eW1AyRm+Gznzq3naMrthPNqE6oYykcogW0l/jfpJdjYnuNl8R7yI9pNbE1XiUeyq0Aw==", - "cpu": [ - "ppc64" - ], - "license": "LGPL-3.0-or-later", - "optional": true, - "os": [ - "linux" - ], - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linux-riscv64": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-riscv64/-/sharp-libvips-linux-riscv64-1.3.2.tgz", - "integrity": "sha512-bsb4rI+NldGOsXuej2r8OdSS8+zXDVaCWxyWrcv6kneTOlgAHtZABRzBBCwdsPiD90J4myNJuHpg6kA20ImW/w==", - "cpu": [ - "riscv64" - ], - "license": "LGPL-3.0-or-later", - "optional": true, - "os": [ - "linux" - ], - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linux-s390x": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.3.2.tgz", - "integrity": "sha512-/ABshyj8gCpyIrNXnHn4LorDJ0HHm1VhXPBlxZ8zAtfVPAaSafXPGn+sUSIRiwaSBy0mmFjSjiXI5mkcwdChKQ==", - "cpu": [ - "s390x" - ], - "license": "LGPL-3.0-or-later", - "optional": true, - "os": [ - "linux" - ], - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linux-x64": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.3.2.tgz", - "integrity": "sha512-ITPEtgffGJ0S6G9dRyw/366tJQqFRcHWPHhC+Stpg3Z8AEMrDrTr2lhdz4f/Y/HMbRh//7Z5mBzEpVdi62Oc3w==", - "cpu": [ - "x64" - ], - "license": "LGPL-3.0-or-later", - "optional": true, - "os": [ - "linux" - ], - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linuxmusl-arm64": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.3.2.tgz", - "integrity": "sha512-zE9EdiUzUmg5mDT5a1rk5fYJ6GWPloTwWBYDS14naqHsL+EaMpDj1AWnpLgh3u0YCORv2Tt50wrcrpYqkP97Kw==", - "cpu": [ - "arm64" - ], - "license": "LGPL-3.0-or-later", - "optional": true, - "os": [ - "linux" - ], - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linuxmusl-x64": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.3.2.tgz", - "integrity": "sha512-m0lrLiUt+lBYnCFr8qV/65yMR4E/c7/wf78I5eKTdkEakFAlZ9QlzEM3QIhhAwVeUhLAHLcCq7a7Vszq/oFNZQ==", - "cpu": [ - "x64" - ], - "license": "LGPL-3.0-or-later", - "optional": true, - "os": [ - "linux" - ], - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-linux-arm": { - "version": "0.35.3", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.35.3.tgz", - "integrity": "sha512-affVWCTLooy8TSxbDx2qkzuDeaWLNVBA+P//FNBirHsXpP2fuBhk5AuboYUnrDnzoXes8GFjpTx0SBFOCRg+FA==", - "cpu": [ - "arm" - ], - "license": "Apache-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=20.9.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-linux-arm": "1.3.2" - } - }, - "node_modules/@img/sharp-linux-arm64": { - "version": "0.35.3", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.35.3.tgz", - "integrity": "sha512-QgKDspHPnrU+GQ55XPhGwyhC8acLVOOSyAvo1oVfFmrIXLkDNmGWzAfDZ4xK8oSA1qBQrALcHX0G5UZni/SuFQ==", - "cpu": [ - "arm64" - ], - "license": "Apache-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=20.9.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-linux-arm64": "1.3.2" - } - }, - "node_modules/@img/sharp-linux-ppc64": { - "version": "0.35.3", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.35.3.tgz", - "integrity": "sha512-sMd8rDxmpLOwv/7N44klFjOD5DUO7FLdjiXDI0hoxYaf7Ar262dQIEkosE98bps+5HPLtp/EvNqeqQtOycP/IA==", - "cpu": [ - "ppc64" - ], - "license": "Apache-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=20.9.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-linux-ppc64": "1.3.2" - } - }, - "node_modules/@img/sharp-linux-riscv64": { - "version": "0.35.3", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-riscv64/-/sharp-linux-riscv64-0.35.3.tgz", - "integrity": "sha512-0Eob78yjlYPfL5vMNWAW55l3R9Y6BQS/gOfe0ZcP9mEz9ohhKSt4im1hayiknXgf8AWrFqMvJcKIdmLmEe7yeQ==", - "cpu": [ - "riscv64" - ], - "license": "Apache-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=20.9.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-linux-riscv64": "1.3.2" - } - }, - "node_modules/@img/sharp-linux-s390x": { - "version": "0.35.3", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.35.3.tgz", - "integrity": "sha512-KgAxQ0DxpNOq1rG2t5cgTgShJFGSuU7XO45cqC+1NVOuZnP6tlgZRuSYOfNupGkHID0o3cJOsw4DVeJpMovcGw==", - "cpu": [ - "s390x" - ], - "license": "Apache-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=20.9.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-linux-s390x": "1.3.2" - } - }, - "node_modules/@img/sharp-linux-x64": { - "version": "0.35.3", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.35.3.tgz", - "integrity": "sha512-8pqvxubL2PGdhlPy6GLqzDYMUjyRmKAwKHYKixpdJYBUK7PJ0C029XdsnpFIdgRZG68fZiGdHVWcKPvtiPB4cA==", - "cpu": [ - "x64" - ], - "license": "Apache-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=20.9.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-linux-x64": "1.3.2" - } - }, - "node_modules/@img/sharp-linuxmusl-arm64": { - "version": "0.35.3", - "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.35.3.tgz", - "integrity": "sha512-Vz0iQjzzcSX3HCbfwFfCSG/9SCIqyO0mH2sXyiHaAYfBk0cRsCWXRyQYX0ovCK/PAQBbTzQ0dsPQHh5MAFL59w==", - "cpu": [ - "arm64" - ], - "license": "Apache-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=20.9.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-linuxmusl-arm64": "1.3.2" - } - }, - "node_modules/@img/sharp-linuxmusl-x64": { - "version": "0.35.3", - "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.35.3.tgz", - "integrity": "sha512-6O1NPKcDVj9QEdg7Hx549EX8U0rp6yXQERqru6yRN7fGBn32UvIRJUlWnk+8xDCiG76hXVBbX82NZ/ZKr0euIg==", - "cpu": [ - "x64" - ], - "license": "Apache-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=20.9.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-linuxmusl-x64": "1.3.2" - } - }, - "node_modules/@img/sharp-wasm32": { - "version": "0.35.3", - "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.35.3.tgz", - "integrity": "sha512-cZ0XkcYGpHZkqW6iCkqTcmUC0CD9DhD5d/qeZlZkfRBn6GnHniZXLUo5+9xw8Iv76YE6LQFN9YNBlKREcCG76w==", - "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", - "optional": true, - "dependencies": { - "@emnapi/runtime": "^1.11.1" - }, - "engines": { - "node": ">=20.9.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-webcontainers-wasm32": { - "version": "0.35.3", - "resolved": "https://registry.npmjs.org/@img/sharp-webcontainers-wasm32/-/sharp-webcontainers-wasm32-0.35.3.tgz", - "integrity": "sha512-2rnq7bX3NzeR2T4YWgz8qiG4h3TSdMe+vN1iQXpJleSJ3SM5zQ8Fy2SyyXAWlbxpEZ2Y+Z4u1BePgJEYbSy80Q==", - "cpu": [ - "wasm32" - ], - "license": "Apache-2.0", - "optional": true, - "dependencies": { - "@img/sharp-wasm32": "0.35.3" - }, - "engines": { - "node": ">=20.9.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-win32-arm64": { - "version": "0.35.3", - "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.35.3.tgz", - "integrity": "sha512-4bPwFdMbeC4JQ8L8LOyWp6nsHcboP5fxkp6iPOXz2Vg49R42TuMs2whkJ5OAP4/Ul035qOzy0AecOF9VOscn4w==", - "cpu": [ - "arm64" - ], - "license": "Apache-2.0 AND LGPL-3.0-or-later", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=20.9.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-win32-ia32": { - "version": "0.35.3", - "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.35.3.tgz", - "integrity": "sha512-r53mXsBN6lFUDiST764SvgwUdHAqM4rPAiDzAmf4fLoB6X/rkfyTrLCg6+g17wJJiCmB3JYgHuUldCWUIRFSXw==", - "cpu": [ - "ia32" - ], - "license": "Apache-2.0 AND LGPL-3.0-or-later", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": "^20.9.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-win32-x64": { - "version": "0.35.3", - "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.35.3.tgz", - "integrity": "sha512-D4y1vNeZrIIJCN+uHaWVtH86B+aCrdMYYjicy9pXHvbGZeGYLLSd3wdVuC37FxVXlU1ARsk84eKWfWMXGYEqvA==", - "cpu": [ - "x64" - ], - "license": "Apache-2.0 AND LGPL-3.0-or-later", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=20.9.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", - "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", - "license": "MIT" - }, - "node_modules/@mdx-js/mdx": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@mdx-js/mdx/-/mdx-3.1.1.tgz", - "integrity": "sha512-f6ZO2ifpwAQIpzGWaBQT2TXxPv6z3RBzQKpVftEWN78Vl/YweF1uwussDx8ECAXVtr3Rs89fKyG9YlzUs9DyGQ==", - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0", - "@types/estree-jsx": "^1.0.0", - "@types/hast": "^3.0.0", - "@types/mdx": "^2.0.0", - "acorn": "^8.0.0", - "collapse-white-space": "^2.0.0", - "devlop": "^1.0.0", - "estree-util-is-identifier-name": "^3.0.0", - "estree-util-scope": "^1.0.0", - "estree-walker": "^3.0.0", - "hast-util-to-jsx-runtime": "^2.0.0", - "markdown-extensions": "^2.0.0", - "recma-build-jsx": "^1.0.0", - "recma-jsx": "^1.0.0", - "recma-stringify": "^1.0.0", - "rehype-recma": "^1.0.0", - "remark-mdx": "^3.0.0", - "remark-parse": "^11.0.0", - "remark-rehype": "^11.0.0", - "source-map": "^0.7.0", - "unified": "^11.0.0", - "unist-util-position-from-estree": "^2.0.0", - "unist-util-stringify-position": "^4.0.0", - "unist-util-visit": "^5.0.0", - "vfile": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/@napi-rs/wasm-runtime": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.2.tgz", - "integrity": "sha512-JfB4kuJQjaoHuCTseIINHtHWeJnvgEcxjwA5t/Y00ZgaOO1Crz3fjT/p8kT28zA/Caz7oiUMn3d6H2yOVCVwuw==", - "license": "MIT", - "optional": true, - "dependencies": { - "@tybys/wasm-util": "^0.10.3" - }, - "engines": { - "node": "^20.19.0 || ^22.13.0 || >=23.5.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/Brooooooklyn" - }, - "peerDependencies": { - "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.3", - "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.3" - } - }, - "node_modules/@oslojs/encoding": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@oslojs/encoding/-/encoding-1.1.0.tgz", - "integrity": "sha512-70wQhgYmndg4GCPxPPxPGevRKqTIJ2Nh4OkiMWmDAVYsTQ+Ta7Sq+rPevXyXGdzr30/qZBnyOalCszoMxlyldQ==", - "license": "MIT" - }, - "node_modules/@oxc-project/types": { - "version": "0.138.0", - "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.138.0.tgz", - "integrity": "sha512-1a7ZKmrRTCoN1XMZ4L0PyyqrMnrNlLyPuOkdSX2MZg7IiIGRUyurNhAm73ptDOraoBcIordsIGKNPKUzy3ZmfA==", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/Boshen" - } - }, - "node_modules/@pagefind/darwin-arm64": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/@pagefind/darwin-arm64/-/darwin-arm64-1.5.2.tgz", - "integrity": "sha512-MXpI+7HsAdPkvJ0gk9xj9g541BCqBZOBbdwj9g6lB5LCj6kSV6nqDSjzcAJwvOsfu0fjwvC8hQU+ecfhp+MpiQ==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@pagefind/darwin-x64": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/@pagefind/darwin-x64/-/darwin-x64-1.5.2.tgz", - "integrity": "sha512-IojxFWMEJe0RQ7PQ3KXQsPIImNsbpPYpoZ+QUDrL8fAl/O27IX+LVLs74/UzEZy5uA2LD8Nz1AiwKr72vrkZQw==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@pagefind/default-ui": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/@pagefind/default-ui/-/default-ui-1.5.2.tgz", - "integrity": "sha512-pm1LMnQg8N2B3n2TnjKlhaFihpz6zTiA4HiGQ6/slKO/+8K9CAU5kcjdSSPgpuk1PMuuN4hxLipUIifnrkl3Sg==", - "license": "MIT" - }, - "node_modules/@pagefind/freebsd-x64": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/@pagefind/freebsd-x64/-/freebsd-x64-1.5.2.tgz", - "integrity": "sha512-7EVzo9+0w+2cbe671BtMj10UlNo83I+HrLVLfRxO731svHRJKUfJ/mo05gU14pe9PCfpKNQT8FS3Xc/oDN6pOA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ] - }, - "node_modules/@pagefind/linux-arm64": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/@pagefind/linux-arm64/-/linux-arm64-1.5.2.tgz", - "integrity": "sha512-Ovt9+K35sqzn8H3ZMXGwls4TD/wMJuvRtShHIsmUQREmaxjrDEX7gHckRCrwYJ4XE1H1p6HkLz3wukrAnsfXQw==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@pagefind/linux-x64": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/@pagefind/linux-x64/-/linux-x64-1.5.2.tgz", - "integrity": "sha512-V+tFqHKXhQKq/WqPBD67AFy7scn1/aZID00ws4fSDd+1daSi5UHR9VVlRrOUYKxn3VuFQYRD7lYXdZK1WED1YA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@pagefind/windows-arm64": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/@pagefind/windows-arm64/-/windows-arm64-1.5.2.tgz", - "integrity": "sha512-hN9Nh90fNW61nNRCW9ZyQrAj/mD0eRvmJ8NlTUzkbuW8kIzGJUi3cxjFkEcMZ5h/8FsKWD/VcouZl4yo1F7B6g==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@pagefind/windows-x64": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/@pagefind/windows-x64/-/windows-x64-1.5.2.tgz", - "integrity": "sha512-Fa2Iyw7kaDRzGMfNYNUXNW2zbL5FQVDgSOcbDHdzBrDEdpqOqg8TcZ68F22ol6NJ9IGzvUdmeyZypLW5dyhqsg==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rolldown/binding-android-arm64": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.1.4.tgz", - "integrity": "sha512-EZLpf/8y7GXkkra90ML47kzik/GMP3EMcE9bPyHmRfxLC6z9+aW5A8poCsoxjrT5GfEcNAAvWwUHjvP1pUQkfw==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-darwin-arm64": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.1.4.tgz", - "integrity": "sha512-aUi+HBvmYb7j8krl1+qJgkG8C17fO79gk3c+jPw4S8glRFc1DTija9S3EyaTSQUm5GJXYKDAsugBEhFHH2vYiQ==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-darwin-x64": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.1.4.tgz", - "integrity": "sha512-F7hHC3gwY11+vByKPRWqwGbeXWVgKmL+pTGCinaEhdihzBV2aQ0fvZOch9cXYUOKuKKq429HeYXOqQLc7wFCEg==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-freebsd-x64": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.1.4.tgz", - "integrity": "sha512-sI5yw+7s92SK6odiEhD5lKCBlWcpjHS5qyqpVQbZAJ0fIzEUXrmbl3DH2ybR3PZogulNJF+COLtmA8hUfvkCCQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-linux-arm-gnueabihf": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.1.4.tgz", - "integrity": "sha512-mCi0OKgEieFircrtVYmQAFGszRtMnZ6fpZAXrxanXAu7lqZcsK1E1RAaZNG0uKAnxox3B1f4EyQNnoyMfN1vAA==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-linux-arm64-gnu": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.1.4.tgz", - "integrity": "sha512-B9Ial3Kv5sh0SHnB1g/QWcUQCEvCF6QKGAl4zXypYj65mVI+B4AhFBwPtSN7pDrJeIx8Z7zdy4ntx+wQABom7w==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-linux-arm64-musl": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.1.4.tgz", - "integrity": "sha512-lZVym0PuHE1KZ22gmFTC15lAkrg9iTszR617oYRB/iPY1A56ywoJzVKOJBKaot5RiikCObmur6pogpse3gRcng==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-linux-ppc64-gnu": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.1.4.tgz", - "integrity": "sha512-t2DNiLJWNTbnEHyUzTumldML6ET4/g16467LZoDDJ3tSxGvguL5/NyC2lCsNKuyRycg9XeDQF5SSv+TNOhQEXg==", - "cpu": [ - "ppc64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-linux-s390x-gnu": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.1.4.tgz", - "integrity": "sha512-0WIRnL1Uw4BvTZRLQt+PVgo6ZKTJadlC2btP+/EOXv2f/DWbY0rEgl+y834mIVwP1FkTlWVTrGGJXf12lru7EQ==", - "cpu": [ - "s390x" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-linux-x64-gnu": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.1.4.tgz", - "integrity": "sha512-JWtGshGfX+oENAKonoNkqEJX+7hC8yfhi9GUyPX1VX4mdh1y5r+ZiJLR5XzAB0aoP6s/PcILsGjKq8O0mm24bw==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-linux-x64-musl": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.1.4.tgz", - "integrity": "sha512-rT6yQcxUuXs4CnbofqwHRRV0iem349rLMYpTjkgQGLjrY4ado/eDzwPZPTCgTOlF6Nkp8NEv70yLMTn6qkWxsQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-openharmony-arm64": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.1.4.tgz", - "integrity": "sha512-KXMGoboq5cyaCQjDA4GLuRiOwBQ0EyFnJoVViLeZ45/3rFItRODEr+NdsBcVpll40hhNArlm/speWGRvj08LzA==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-wasm32-wasi": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.1.4.tgz", - "integrity": "sha512-5K83rb36oJiY7BCyE9zLZtGcPV4g5wvq+xwdO0XPIwDVZI8cyB/AUjkNXGb92/rnmezEkjMOpgY61rtwjQtFwg==", - "cpu": [ - "wasm32" - ], - "license": "MIT", - "optional": true, - "dependencies": { - "@emnapi/core": "1.11.1", - "@emnapi/runtime": "1.11.1", - "@napi-rs/wasm-runtime": "^1.1.6" - }, - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-wasm32-wasi/node_modules/@emnapi/core": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.11.1.tgz", - "integrity": "sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ==", - "license": "MIT", - "optional": true, - "dependencies": { - "@emnapi/wasi-threads": "1.2.2", - "tslib": "^2.4.0" - } - }, - "node_modules/@rolldown/binding-wasm32-wasi/node_modules/@emnapi/runtime": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.1.tgz", - "integrity": "sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw==", - "license": "MIT", - "optional": true, - "dependencies": { - "tslib": "^2.4.0" - } - }, - "node_modules/@rolldown/binding-win32-arm64-msvc": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.1.4.tgz", - "integrity": "sha512-PnWBtw3TV5KOg69HQQDR0mnQuyCmSGR2pAB4DC1rPF808fgKeTUMj2EOEyKATpgiuxuR5APQmiDO7PDgEjTFSA==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/binding-win32-x64-msvc": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.1.4.tgz", - "integrity": "sha512-M1lpniBePobTfsa7Ks9a199e1akxsXn+GYBUKsEzv3YFzOm1HJAMNwKI3qr0Zq+mxwx9gOZoTdP1yXRYsZUocQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/pluginutils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz", - "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==", - "license": "MIT" - }, - "node_modules/@rollup/pluginutils": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.4.0.tgz", - "integrity": "sha512-MfPp06CjRLfXQ3wY0R8vJDYBy/MvVcc9OulEfR0B8Iv9ko+GCNaRZ+EpJYFl27LhKsZK0o420sYCRHCjfCgeUg==", - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0", - "estree-walker": "^2.0.2", - "picomatch": "^4.0.2" - }, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" - }, - "peerDependenciesMeta": { - "rollup": { - "optional": true - } - } - }, - "node_modules/@rollup/pluginutils/node_modules/estree-walker": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", - "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", - "license": "MIT" - }, - "node_modules/@shikijs/core": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-4.3.1.tgz", - "integrity": "sha512-ANMDxuaPsNMdDC1m4vfvhlDmJweMwkE5XitTwrq2rWHx5jM+dlm4MmHt2PP6t0uejfR77SuhrhJ0zEijIF/uhA==", - "license": "MIT", - "dependencies": { - "@shikijs/primitive": "4.3.1", - "@shikijs/types": "4.3.1", - "@shikijs/vscode-textmate": "^10.0.2", - "@types/hast": "^3.0.4", - "hast-util-to-html": "^9.0.5" - }, - "engines": { - "node": ">=20" - } - }, - "node_modules/@shikijs/engine-javascript": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-4.3.1.tgz", - "integrity": "sha512-JBItcnPuYq7jVJdZo/vMj94r+szT7XEjHFX+mvFDGSEIbVAXAGyHAHzhbWzpGOwYidCZrErJLLgn2PVeiokHnQ==", - "license": "MIT", - "dependencies": { - "@shikijs/types": "4.3.1", - "@shikijs/vscode-textmate": "^10.0.2", - "oniguruma-to-es": "^4.3.6" - }, - "engines": { - "node": ">=20" - } - }, - "node_modules/@shikijs/engine-oniguruma": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-4.3.1.tgz", - "integrity": "sha512-OXyNMzg0pews+msMj4cHeqT4xiYKKvbnn6VbdAXxfoFl3SSx4fJTc8FadECuc5/H9p3BzhNAoAUXKwAu9rWYhg==", - "license": "MIT", - "dependencies": { - "@shikijs/types": "4.3.1", - "@shikijs/vscode-textmate": "^10.0.2" - }, - "engines": { - "node": ">=20" - } - }, - "node_modules/@shikijs/langs": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-4.3.1.tgz", - "integrity": "sha512-m0l9nsDqgBHvbZbk7A0/kXz/impK3uB/c6rAn6Gpg/uPtdZRQ+alsN/17MU5thb68XTj/4DxkZAotrM0GGSpDQ==", - "license": "MIT", - "dependencies": { - "@shikijs/types": "4.3.1" - }, - "engines": { - "node": ">=20" - } - }, - "node_modules/@shikijs/primitive": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/@shikijs/primitive/-/primitive-4.3.1.tgz", - "integrity": "sha512-CXQRQOYy1leqQ8ceTeJdmXv/bsUY++6QyLpXJ94LZAAYj5X2SKRdc5ipguv4NPyGVKItB2PPwUpRNe0Sjh5S1A==", - "license": "MIT", - "dependencies": { - "@shikijs/types": "4.3.1", - "@shikijs/vscode-textmate": "^10.0.2", - "@types/hast": "^3.0.4" - }, - "engines": { - "node": ">=20" - } - }, - "node_modules/@shikijs/themes": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-4.3.1.tgz", - "integrity": "sha512-dgpoJ4WqNi2yTmizQHBJ5zcX6j2lE6icN/0yt4l1kkf16jrY/pwPLoTb1ETsWMz0OBLf9ZNvwmxft+cH+N9qSA==", - "license": "MIT", - "dependencies": { - "@shikijs/types": "4.3.1" - }, - "engines": { - "node": ">=20" - } - }, - "node_modules/@shikijs/types": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-4.3.1.tgz", - "integrity": "sha512-CHFxE0jztBIZRHH6gxXE7DXUCFXjReEGxZ/j0rfSLGKZuwp2xBYycEP14875DSa9KLL/6700oxIq6oO6ef9K2g==", - "license": "MIT", - "dependencies": { - "@shikijs/vscode-textmate": "^10.0.2", - "@types/hast": "^3.0.4" - }, - "engines": { - "node": ">=20" - } - }, - "node_modules/@shikijs/vscode-textmate": { - "version": "10.0.2", - "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-10.0.2.tgz", - "integrity": "sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==", - "license": "MIT" - }, - "node_modules/@tybys/wasm-util": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.3.tgz", - "integrity": "sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==", - "license": "MIT", - "optional": true, - "dependencies": { - "tslib": "^2.4.0" - } - }, - "node_modules/@types/debug": { - "version": "4.1.13", - "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.13.tgz", - "integrity": "sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==", - "license": "MIT", - "dependencies": { - "@types/ms": "*" - } - }, - "node_modules/@types/estree": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", - "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", - "license": "MIT" - }, - "node_modules/@types/estree-jsx": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@types/estree-jsx/-/estree-jsx-1.0.5.tgz", - "integrity": "sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==", - "license": "MIT", - "dependencies": { - "@types/estree": "*" - } - }, - "node_modules/@types/hast": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", - "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", - "license": "MIT", - "dependencies": { - "@types/unist": "*" - } - }, - "node_modules/@types/js-yaml": { - "version": "4.0.9", - "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.9.tgz", - "integrity": "sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==", - "license": "MIT" - }, - "node_modules/@types/mdast": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", - "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", - "license": "MIT", - "dependencies": { - "@types/unist": "*" - } - }, - "node_modules/@types/mdx": { - "version": "2.0.14", - "resolved": "https://registry.npmjs.org/@types/mdx/-/mdx-2.0.14.tgz", - "integrity": "sha512-T48PeuJtvLosNTPVhfnIp3i/n3a4g4Bad7YCq5k64D4u7NwDrAotikQ+5+sjtUvBmxCMlbo3dVL+C2dP0rWHzg==", - "license": "MIT" - }, - "node_modules/@types/ms": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", - "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", - "license": "MIT" - }, - "node_modules/@types/nlcst": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@types/nlcst/-/nlcst-2.0.3.tgz", - "integrity": "sha512-vSYNSDe6Ix3q+6Z7ri9lyWqgGhJTmzRjZRqyq15N0Z/1/UnVsno9G/N40NBijoYx2seFDIl0+B2mgAb9mezUCA==", - "license": "MIT", - "dependencies": { - "@types/unist": "*" - } - }, - "node_modules/@types/node": { - "version": "24.13.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.13.2.tgz", - "integrity": "sha512-fRa09kZTgu8o71KFcDjUFuc7F+dEbZYZmkI0mg5YBTRs0yMKjYHsq/c0urDKeDb+D5qVgXOdFcuu+DZPKOITwA==", - "license": "MIT", - "dependencies": { - "undici-types": "~7.18.0" - } - }, - "node_modules/@types/sax": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/@types/sax/-/sax-1.2.7.tgz", - "integrity": "sha512-rO73L89PJxeYM3s3pPPjiPgVVcymqU490g0YO5n5By0k2Erzj6tay/4lr1CHAAU4JyOWd1rpQ8bCf6cZfHU96A==", - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/unist": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", - "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", - "license": "MIT" - }, - "node_modules/@ungap/structured-clone": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.2.tgz", - "integrity": "sha512-5jsZFwgR5rTdKwidH9Qmat75RKwqfpKlWWB1frDkljN127mwqBu8K0PYo7/hFpF03IEJpfVPpCQDY/eDx3iHvA==", - "license": "ISC" - }, - "node_modules/acorn": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.17.0.tgz", - "integrity": "sha512-xRQbDb9BnwDafYNn6Vwl839DYVjqXYb1XVGtWAZ1kcDc6iwAL4hg3B1dZlRiuENFeO2H53gFG3in621AdERVAg==", - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-jsx": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "license": "MIT", - "peerDependencies": { - "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, - "node_modules/am-i-vibing": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/am-i-vibing/-/am-i-vibing-0.4.0.tgz", - "integrity": "sha512-MxT4XZL7pzLHpuvhDKdMaQHMGGkJDLluKBLsbstn+8wv9sWcFT6h+0ve9qkml95amVTZtZV83gQe2hY+ojgHLg==", - "license": "MIT", - "dependencies": { - "process-ancestry": "^0.1.0" - }, - "bin": { - "am-i-vibing": "dist/cli.mjs" - } - }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "license": "ISC", - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/anymatch/node_modules/picomatch": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", - "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", - "license": "MIT", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/arg": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", - "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==", - "license": "MIT" - }, - "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "license": "Python-2.0" - }, - "node_modules/aria-query": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.2.tgz", - "integrity": "sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw==", - "license": "Apache-2.0", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/array-iterate": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/array-iterate/-/array-iterate-2.0.1.tgz", - "integrity": "sha512-I1jXZMjAgCMmxT4qxXfPXa6SthSoE8h6gkSI9BGGNv8mP8G/v0blc+qFnZu6K42vTOiuME596QaLO0TP3Lk0xg==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/astring": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/astring/-/astring-1.9.0.tgz", - "integrity": "sha512-LElXdjswlqjWrPpJFg1Fx4wpkOCxj1TDHlSV4PlaRxHGWko024xICaa97ZkMfs6DRKlCguiAI+rbXv5GWwXIkg==", - "license": "MIT", - "bin": { - "astring": "bin/astring" - } - }, - "node_modules/astro": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/astro/-/astro-7.1.6.tgz", - "integrity": "sha512-83x9rYbHazMaZkYrAFRVZXSQx2moFkz0F7cjTDUF3GWfS0a3p2vZXG1ZdhV86rStHApQCodBJW+XTD37xISIrQ==", - "license": "MIT", - "dependencies": { - "@astrojs/compiler-rs": "^0.3.2", - "@astrojs/internal-helpers": "0.10.2", - "@astrojs/markdown-satteri": "0.3.5", - "@astrojs/telemetry": "3.3.3", - "@capsizecss/unpack": "^4.0.0", - "@clack/prompts": "^1.1.0", - "@oslojs/encoding": "^1.1.0", - "@rollup/pluginutils": "^5.3.0", - "am-i-vibing": "^0.4.0", - "aria-query": "^5.3.2", - "axobject-query": "^4.1.0", - "ci-info": "^4.4.0", - "clsx": "^2.1.1", - "common-ancestor-path": "^2.0.0", - "cookie": "^2.0.1", - "devalue": "^5.8.1", - "diff": "^8.0.3", - "dset": "^3.1.4", - "es-module-lexer": "^2.0.0", - "esbuild": "^0.28.0", - "flattie": "^1.1.1", - "fontace": "~0.4.1", - "get-tsconfig": "5.0.0-beta.4", - "github-slugger": "^2.0.0", - "html-escaper": "3.0.3", - "http-cache-semantics": "^4.2.0", - "js-yaml": "^4.3.0", - "jsonc-parser": "^3.3.1", - "magic-string": "^1.0.0", - "magicast": "^0.5.2", - "mrmime": "^2.0.1", - "neotraverse": "^1.0.1", - "obug": "^2.1.1", - "p-limit": "^7.3.0", - "p-queue": "^9.1.0", - "package-manager-detector": "^1.6.0", - "piccolore": "^0.1.3", - "picomatch": "^4.0.4", - "semver": "^7.7.4", - "shiki": "^4.0.2", - "smol-toml": "^1.6.0", - "svgo": "^4.0.1", - "tinyclip": "^0.1.12", - "tinyexec": "^1.0.4", - "tinyglobby": "^0.2.15", - "ultrahtml": "^1.6.0", - "unifont": "~0.7.4", - "unstorage": "^1.17.5", - "vite": "^8.0.13", - "vitefu": "^1.1.2", - "xxhash-wasm": "^1.1.0", - "yargs-parser": "^22.0.0", - "zod": "^4.3.6" - }, - "bin": { - "astro": "bin/astro.mjs" - }, - "engines": { - "node": ">=22.12.0", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/astrodotbuild" - }, - "optionalDependencies": { - "sharp": "^0.34.0 || ^0.35.0" - }, - "peerDependencies": { - "@astrojs/markdown-remark": "7.2.2" - }, - "peerDependenciesMeta": { - "@astrojs/markdown-remark": { - "optional": true - } - } - }, - "node_modules/astro-expressive-code": { - "version": "0.44.0", - "resolved": "https://registry.npmjs.org/astro-expressive-code/-/astro-expressive-code-0.44.0.tgz", - "integrity": "sha512-b1wN/ZvbJprzxlGKIpIes2kQrCY5KRLwys2tWbZAZyjGZcW5ZtgneZnBwzNRiBna9/48d4mQl19KLjcRuhO1hw==", - "license": "MIT", - "dependencies": { - "rehype-expressive-code": "^0.44.0", - "url-extras": "^0.1.0" - }, - "peerDependencies": { - "astro": "^4.0.0-beta || ^5.0.0-beta || ^3.3.0 || ^6.0.0-beta || ^7.0.0" - } - }, - "node_modules/astro/node_modules/@astrojs/internal-helpers": { - "version": "0.10.2", - "resolved": "https://registry.npmjs.org/@astrojs/internal-helpers/-/internal-helpers-0.10.2.tgz", - "integrity": "sha512-yt7fMgPYqSM4Tmr+taTW6Per+hjJ8Pk6lA1PAcDyqzOt8HzJ6Kje5WzCxA2Sd+9wsUW7uhkLeoTMK0cXPwH9rQ==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.4", - "@types/mdast": "^4.0.4", - "js-yaml": "^4.3.0", - "picomatch": "^4.0.4", - "retext-smartypants": "^6.2.0", - "shiki": "^4.0.2", - "smol-toml": "^1.6.0", - "unified": "^11.0.5" - } - }, - "node_modules/astro/node_modules/magic-string": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.1.0.tgz", - "integrity": "sha512-kS3VHe0nEPST2saQV4Rbkchcd3UBRkVTQHo1D3h/ZTwFDhai/mfKkmtPAtD129EOI7K3HlHIsFOt0WrI2/oU9g==", - "license": "MIT", - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.5" - } - }, - "node_modules/axobject-query": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz", - "integrity": "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==", - "license": "Apache-2.0", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/bail": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz", - "integrity": "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/bcp-47": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/bcp-47/-/bcp-47-2.1.1.tgz", - "integrity": "sha512-KLw+H/gd2p4zly1X7Yh/qziuyae5/w/QFnvTng9eZL5fvszL7Whl3MBoWF8yxL7ksUjBfOD+OxkytiqbBpG+Fw==", - "license": "MIT", - "dependencies": { - "is-alphabetical": "^2.0.0", - "is-alphanumerical": "^2.0.0", - "is-decimal": "^2.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/bcp-47-match": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/bcp-47-match/-/bcp-47-match-2.0.3.tgz", - "integrity": "sha512-JtTezzbAibu8G0R9op9zb3vcWZd9JF6M0xOYGPn0fNCd7wOpRB1mU2mH9T8gaBGbAAyIIVgB2G7xG0GP98zMAQ==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/boolbase": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", - "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", - "license": "ISC" - }, - "node_modules/ccount": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", - "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/character-entities": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", - "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/character-entities-html4": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz", - "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/character-entities-legacy": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", - "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/character-reference-invalid": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz", - "integrity": "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/chokidar": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-5.0.0.tgz", - "integrity": "sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==", - "license": "MIT", - "dependencies": { - "readdirp": "^5.0.0" - }, - "engines": { - "node": ">= 20.19.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/ci-info": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.4.0.tgz", - "integrity": "sha512-77PSwercCZU2Fc4sX94eF8k8Pxte6JAwL4/ICZLFjJLqegs7kCuAsqqj/70NQF6TvDpgFjkubQB2FW2ZZddvQg==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/sibiraj-s" - } - ], - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/clsx": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", - "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/collapse-white-space": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-2.1.0.tgz", - "integrity": "sha512-loKTxY1zCOuG4j9f6EPnuyyYkf58RnhhWTvRoZEokgB+WbdXehfjFviyOVYkqzEWz1Q5kRiZdBYS5SwxbQYwzw==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/comma-separated-tokens": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", - "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/commander": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz", - "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==", - "license": "MIT", - "engines": { - "node": ">=16" - } - }, - "node_modules/common-ancestor-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-2.0.0.tgz", - "integrity": "sha512-dnN3ibLeoRf2HNC+OlCiNc5d2zxbLJXOtiZUudNFSXZrNSydxcCsSpRzXwfu7BBWCIfHPw+xTayeBvJCP/D8Ng==", - "license": "BlueOak-1.0.0", - "engines": { - "node": ">= 18" - } - }, - "node_modules/cookie": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-2.0.1.tgz", - "integrity": "sha512-yuToqVvRrj6pfDXREyQAAv8SkAEk/8GS3jQRTiUMm66TVtBYmqQeoEjL2Lmq8Rpo6271vH76InTChTitEAm65w==", - "license": "MIT", - "engines": { - "node": ">=22" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/cookie-es": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/cookie-es/-/cookie-es-1.2.3.tgz", - "integrity": "sha512-lXVyvUvrNXblMqzIRrxHb57UUVmqsSWlxqt3XIjCkUP0wDAf6uicO6KMbEgYrMNtEvWgWHwe42CKxPu9MYAnWw==", - "license": "MIT" - }, - "node_modules/crossws": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/crossws/-/crossws-0.3.5.tgz", - "integrity": "sha512-ojKiDvcmByhwa8YYqbQI/hg7MEU0NC03+pSdEq4ZUnZR9xXpwk7E43SMNGkn+JxJGPFtNvQ48+vV2p+P1ml5PA==", - "license": "MIT", - "dependencies": { - "uncrypto": "^0.1.3" - } - }, - "node_modules/css-select": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.2.2.tgz", - "integrity": "sha512-TizTzUddG/xYLA3NXodFM0fSbNizXjOKhqiQQwvhlspadZokn1KDy0NZFS0wuEubIYAV5/c1/lAr0TaaFXEXzw==", - "license": "BSD-2-Clause", - "dependencies": { - "boolbase": "^1.0.0", - "css-what": "^6.1.0", - "domhandler": "^5.0.2", - "domutils": "^3.0.1", - "nth-check": "^2.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/fb55" - } - }, - "node_modules/css-selector-parser": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/css-selector-parser/-/css-selector-parser-3.3.0.tgz", - "integrity": "sha512-Y2asgMGFqJKF4fq4xHDSlFYIkeVfRsm69lQC1q9kbEsH5XtnINTMrweLkjYMeaUgiXBy/uvKeO/a1JHTNnmB2g==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/mdevils" - }, - { - "type": "patreon", - "url": "https://patreon.com/mdevils" - } - ], - "license": "MIT" - }, - "node_modules/css-tree": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.2.1.tgz", - "integrity": "sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA==", - "license": "MIT", - "dependencies": { - "mdn-data": "2.27.1", - "source-map-js": "^1.2.1" - }, - "engines": { - "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" - } - }, - "node_modules/css-what": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.2.2.tgz", - "integrity": "sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA==", - "license": "BSD-2-Clause", - "engines": { - "node": ">= 6" - }, - "funding": { - "url": "https://github.com/sponsors/fb55" - } - }, - "node_modules/cssesc": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", - "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", - "license": "MIT", - "bin": { - "cssesc": "bin/cssesc" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/csso": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/csso/-/csso-5.0.5.tgz", - "integrity": "sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ==", - "license": "MIT", - "dependencies": { - "css-tree": "~2.2.0" - }, - "engines": { - "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/csso/node_modules/css-tree": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.2.1.tgz", - "integrity": "sha512-OA0mILzGc1kCOCSJerOeqDxDQ4HOh+G8NbOJFOTgOCzpw7fCBubk0fEyxp8AgOL/jvLgYA/uV0cMbe43ElF1JA==", - "license": "MIT", - "dependencies": { - "mdn-data": "2.0.28", - "source-map-js": "^1.0.1" - }, - "engines": { - "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/csso/node_modules/mdn-data": { - "version": "2.0.28", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.28.tgz", - "integrity": "sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==", - "license": "CC0-1.0" - }, - "node_modules/debug": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", - "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/decode-named-character-reference": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.3.0.tgz", - "integrity": "sha512-GtpQYB283KrPp6nRw50q3U9/VfOutZOe103qlN7BPP6Ad27xYnOIWv4lPzo8HCAL+mMZofJ9KEy30fq6MfaK6Q==", - "license": "MIT", - "dependencies": { - "character-entities": "^2.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/defu": { - "version": "6.1.7", - "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.7.tgz", - "integrity": "sha512-7z22QmUWiQ/2d0KkdYmANbRUVABpZ9SNYyH5vx6PZ+nE5bcC0l7uFvEfHlyld/HcGBFTL536ClDt3DEcSlEJAQ==", - "license": "MIT" - }, - "node_modules/dequal": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", - "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/destr": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/destr/-/destr-2.0.5.tgz", - "integrity": "sha512-ugFTXCtDZunbzasqBxrK93Ik/DRYsO6S/fedkWEMKqt04xZ4csmnmwGDBAb07QWNaGMAmnTIemsYZCksjATwsA==", - "license": "MIT" - }, - "node_modules/detect-libc": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", - "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", - "license": "Apache-2.0", - "engines": { - "node": ">=8" - } - }, - "node_modules/devalue": { - "version": "5.8.1", - "resolved": "https://registry.npmjs.org/devalue/-/devalue-5.8.1.tgz", - "integrity": "sha512-4CXDYRBGqN+57wVJkuXBYmpAVUSg3L6JAQa/DFqm238G73E1wuyc/JhGQJzN7vUf/CMphYau2zXbfWzDR5aTEw==", - "license": "MIT" - }, - "node_modules/devlop": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz", - "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", - "license": "MIT", - "dependencies": { - "dequal": "^2.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/diff": { - "version": "8.0.4", - "resolved": "https://registry.npmjs.org/diff/-/diff-8.0.4.tgz", - "integrity": "sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw==", - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/direction": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/direction/-/direction-2.0.1.tgz", - "integrity": "sha512-9S6m9Sukh1cZNknO1CWAr2QAWsbKLafQiyM5gZ7VgXHeuaoUwffKN4q6NC4A/Mf9iiPlOXQEKW/Mv/mh9/3YFA==", - "license": "MIT", - "bin": { - "direction": "cli.js" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/dom-serializer": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", - "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", - "license": "MIT", - "dependencies": { - "domelementtype": "^2.3.0", - "domhandler": "^5.0.2", - "entities": "^4.2.0" - }, - "funding": { - "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" - } - }, - "node_modules/dom-serializer/node_modules/entities": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", - "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", - "license": "BSD-2-Clause", - "engines": { - "node": ">=0.12" - }, - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, - "node_modules/domelementtype": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", - "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/fb55" - } - ], - "license": "BSD-2-Clause" - }, - "node_modules/domhandler": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", - "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", - "license": "BSD-2-Clause", - "dependencies": { - "domelementtype": "^2.3.0" - }, - "engines": { - "node": ">= 4" - }, - "funding": { - "url": "https://github.com/fb55/domhandler?sponsor=1" - } - }, - "node_modules/domutils": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.2.2.tgz", - "integrity": "sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==", - "license": "BSD-2-Clause", - "dependencies": { - "dom-serializer": "^2.0.0", - "domelementtype": "^2.3.0", - "domhandler": "^5.0.3" - }, - "funding": { - "url": "https://github.com/fb55/domutils?sponsor=1" - } - }, - "node_modules/dset": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/dset/-/dset-3.1.4.tgz", - "integrity": "sha512-2QF/g9/zTaPDc3BjNcVTGoBbXBgYfMTTceLaYcFJ/W9kggFUkhxD/hMEeuLKbugyef9SqAx8cpgwlIP/jinUTA==", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/entities": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz", - "integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==", - "license": "BSD-2-Clause", - "engines": { - "node": ">=0.12" - }, - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, - "node_modules/es-module-lexer": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.0.tgz", - "integrity": "sha512-KLdwQm2NvGLDkQDCGvmiQrhkd0JbMzXthwQAUgWjQuQdBLFa3eiBP5arXZyA+f8x+x7OXgud6bq2rxjGtHV2tw==", - "license": "MIT" - }, - "node_modules/esast-util-from-estree": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/esast-util-from-estree/-/esast-util-from-estree-2.0.0.tgz", - "integrity": "sha512-4CyanoAudUSBAn5K13H4JhsMH6L9ZP7XbLVe/dKybkxMO7eDyLsT8UHl9TRNrU2Gr9nz+FovfSIjuXWJ81uVwQ==", - "license": "MIT", - "dependencies": { - "@types/estree-jsx": "^1.0.0", - "devlop": "^1.0.0", - "estree-util-visit": "^2.0.0", - "unist-util-position-from-estree": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/esast-util-from-js": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/esast-util-from-js/-/esast-util-from-js-2.0.1.tgz", - "integrity": "sha512-8Ja+rNJ0Lt56Pcf3TAmpBZjmx8ZcK5Ts4cAzIOjsjevg9oSXJnl6SUQ2EevU8tv3h6ZLWmoKL5H4fgWvdvfETw==", - "license": "MIT", - "dependencies": { - "@types/estree-jsx": "^1.0.0", - "acorn": "^8.0.0", - "esast-util-from-estree": "^2.0.0", - "vfile-message": "^4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/esbuild": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.1.tgz", - "integrity": "sha512-HrJrvZv5ayxBzPfwphOoNzkzOIIlifzk0KJrGK2c8R4+LKpMtpYLQeUdjnwjWv/LZlkH2laZk+4w78pi99D4Vw==", - "hasInstallScript": true, - "license": "MIT", - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.28.1", - "@esbuild/android-arm": "0.28.1", - "@esbuild/android-arm64": "0.28.1", - "@esbuild/android-x64": "0.28.1", - "@esbuild/darwin-arm64": "0.28.1", - "@esbuild/darwin-x64": "0.28.1", - "@esbuild/freebsd-arm64": "0.28.1", - "@esbuild/freebsd-x64": "0.28.1", - "@esbuild/linux-arm": "0.28.1", - "@esbuild/linux-arm64": "0.28.1", - "@esbuild/linux-ia32": "0.28.1", - "@esbuild/linux-loong64": "0.28.1", - "@esbuild/linux-mips64el": "0.28.1", - "@esbuild/linux-ppc64": "0.28.1", - "@esbuild/linux-riscv64": "0.28.1", - "@esbuild/linux-s390x": "0.28.1", - "@esbuild/linux-x64": "0.28.1", - "@esbuild/netbsd-arm64": "0.28.1", - "@esbuild/netbsd-x64": "0.28.1", - "@esbuild/openbsd-arm64": "0.28.1", - "@esbuild/openbsd-x64": "0.28.1", - "@esbuild/openharmony-arm64": "0.28.1", - "@esbuild/sunos-x64": "0.28.1", - "@esbuild/win32-arm64": "0.28.1", - "@esbuild/win32-ia32": "0.28.1", - "@esbuild/win32-x64": "0.28.1" - } - }, - "node_modules/escape-string-regexp": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", - "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/estree-util-attach-comments": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/estree-util-attach-comments/-/estree-util-attach-comments-3.0.0.tgz", - "integrity": "sha512-cKUwm/HUcTDsYh/9FgnuFqpfquUbwIqwKM26BVCGDPVgvaCl/nDCCjUfiLlx6lsEZ3Z4RFxNbOQ60pkaEwFxGw==", - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/estree-util-build-jsx": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/estree-util-build-jsx/-/estree-util-build-jsx-3.0.1.tgz", - "integrity": "sha512-8U5eiL6BTrPxp/CHbs2yMgP8ftMhR5ww1eIKoWRMlqvltHF8fZn5LRDvTKuxD3DUn+shRbLGqXemcP51oFCsGQ==", - "license": "MIT", - "dependencies": { - "@types/estree-jsx": "^1.0.0", - "devlop": "^1.0.0", - "estree-util-is-identifier-name": "^3.0.0", - "estree-walker": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/estree-util-is-identifier-name": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/estree-util-is-identifier-name/-/estree-util-is-identifier-name-3.0.0.tgz", - "integrity": "sha512-hFtqIDZTIUZ9BXLb8y4pYGyk6+wekIivNVTcmvk8NoOh+VeRn5y6cEHzbURrWbfp1fIqdVipilzj+lfaadNZmg==", - "license": "MIT", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/estree-util-scope": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/estree-util-scope/-/estree-util-scope-1.0.0.tgz", - "integrity": "sha512-2CAASclonf+JFWBNJPndcOpA8EMJwa0Q8LUFJEKqXLW6+qBvbFZuF5gItbQOs/umBUkjviCSDCbBwU2cXbmrhQ==", - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0", - "devlop": "^1.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/estree-util-to-js": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/estree-util-to-js/-/estree-util-to-js-2.0.0.tgz", - "integrity": "sha512-WDF+xj5rRWmD5tj6bIqRi6CkLIXbbNQUcxQHzGysQzvHmdYG2G7p/Tf0J0gpxGgkeMZNTIjT/AoSvC9Xehcgdg==", - "license": "MIT", - "dependencies": { - "@types/estree-jsx": "^1.0.0", - "astring": "^1.8.0", - "source-map": "^0.7.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/estree-util-visit": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/estree-util-visit/-/estree-util-visit-2.0.0.tgz", - "integrity": "sha512-m5KgiH85xAhhW8Wta0vShLcUvOsh3LLPI2YVwcbio1l7E09NTLL1EyMZFM1OyWowoH0skScNbhOPl4kcBgzTww==", - "license": "MIT", - "dependencies": { - "@types/estree-jsx": "^1.0.0", - "@types/unist": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/estree-walker": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", - "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0" - } - }, - "node_modules/eventemitter3": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz", - "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==", - "license": "MIT" - }, - "node_modules/expressive-code": { - "version": "0.44.0", - "resolved": "https://registry.npmjs.org/expressive-code/-/expressive-code-0.44.0.tgz", - "integrity": "sha512-JXVWVNCKlLuZLMQH8cOiDUSosT0Bb+elwE/dbAkpwFwDFmyFyWlECoWZIohh2FkIF1iI67TQJ+Ts9k7oNDh2qA==", - "license": "MIT", - "dependencies": { - "@expressive-code/core": "^0.44.0", - "@expressive-code/plugin-frames": "^0.44.0", - "@expressive-code/plugin-shiki": "^0.44.0", - "@expressive-code/plugin-text-markers": "^0.44.0" - } - }, - "node_modules/extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "license": "MIT" - }, - "node_modules/fast-string-truncated-width": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/fast-string-truncated-width/-/fast-string-truncated-width-3.0.3.tgz", - "integrity": "sha512-0jjjIEL6+0jag3l2XWWizO64/aZVtpiGE3t0Zgqxv0DPuxiMjvB3M24fCyhZUO4KomJQPj3LTSUnDP3GpdwC0g==", - "license": "MIT" - }, - "node_modules/fast-string-width": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/fast-string-width/-/fast-string-width-3.0.2.tgz", - "integrity": "sha512-gX8LrtNEI5hq8DVUfRQMbr5lpaS4nMIWV+7XEbXk2b8kiQIizgnlr12B4dA3ZEx3308ze0O4Q1R+cHts8kyUJg==", - "license": "MIT", - "dependencies": { - "fast-string-truncated-width": "^3.0.2" - } - }, - "node_modules/fast-wrap-ansi": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/fast-wrap-ansi/-/fast-wrap-ansi-0.2.2.tgz", - "integrity": "sha512-7F2Fl+TjRSenLqlU3UjSH0iyqopqoZIu7eZVpEirP2g1GtWa2G/ecEmBdgz31+Mxr+ELclgg6sokpSFIQiZ02Q==", - "license": "MIT", - "dependencies": { - "fast-string-width": "^3.0.2" - } - }, - "node_modules/fdir": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", - "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", - "license": "MIT", - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } - } - }, - "node_modules/flattie": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/flattie/-/flattie-1.1.1.tgz", - "integrity": "sha512-9UbaD6XdAL97+k/n+N7JwX46K/M6Zc6KcFYskrYL8wbBV/Uyk0CTAMY0VT+qiK5PM7AIc9aTWYtq65U7T+aCNQ==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/fontace": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/fontace/-/fontace-0.4.1.tgz", - "integrity": "sha512-lDMvbAzSnHmbYMTEld5qdtvNH2/pWpICOqpean9IgC7vUbUJc3k+k5Dokp85CegamqQpFbXf0rAVkbzpyTA8aw==", - "license": "MIT", - "dependencies": { - "fontkitten": "^1.0.2" - } - }, - "node_modules/fontkitten": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/fontkitten/-/fontkitten-1.0.3.tgz", - "integrity": "sha512-Wp1zXWPVUPBmfoa3Cqc9ctaKuzKAV6uLstRqlR56kSjplf5uAce+qeyYym7F+PHbGTk+tCEdkCW6RD7DX/gBZw==", - "license": "MIT", - "dependencies": { - "tiny-inflate": "^1.0.3" - }, - "engines": { - "node": ">=20" - } - }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/get-tsconfig": { - "version": "5.0.0-beta.4", - "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-5.0.0-beta.4.tgz", - "integrity": "sha512-7nF7C9fIPFEMHgEMEfgIlO9wDdZ8CyHw27rWciFZfHvHDReIiPhsYuzPRXsfvBCqFy1l8RRyyWV7QLM+ZhUJsQ==", - "license": "MIT", - "dependencies": { - "resolve-pkg-maps": "^1.0.0" - }, - "engines": { - "node": ">=20.20.0" - }, - "funding": { - "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" - } - }, - "node_modules/github-slugger": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/github-slugger/-/github-slugger-2.0.0.tgz", - "integrity": "sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==", - "license": "ISC" - }, - "node_modules/h3": { - "version": "1.15.11", - "resolved": "https://registry.npmjs.org/h3/-/h3-1.15.11.tgz", - "integrity": "sha512-L3THSe2MPeBwgIZVSH5zLdBBU90TOxarvhK9d04IDY2AmVS8j2Jz2LIWtwsGOU3lu2I5jCN7FNvVfY2+XyF+mg==", - "license": "MIT", - "dependencies": { - "cookie-es": "^1.2.3", - "crossws": "^0.3.5", - "defu": "^6.1.6", - "destr": "^2.0.5", - "iron-webcrypto": "^1.2.1", - "node-mock-http": "^1.0.4", - "radix3": "^1.1.2", - "ufo": "^1.6.3", - "uncrypto": "^0.1.3" - } - }, - "node_modules/hast-util-embedded": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/hast-util-embedded/-/hast-util-embedded-3.0.0.tgz", - "integrity": "sha512-naH8sld4Pe2ep03qqULEtvYr7EjrLK2QHY8KJR6RJkTUjPGObe1vnx585uzem2hGra+s1q08DZZpfgDVYRbaXA==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "hast-util-is-element": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hast-util-format": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/hast-util-format/-/hast-util-format-1.1.0.tgz", - "integrity": "sha512-yY1UDz6bC9rDvCWHpx12aIBGRG7krurX0p0Fm6pT547LwDIZZiNr8a+IHDogorAdreULSEzP82Nlv5SZkHZcjA==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "hast-util-embedded": "^3.0.0", - "hast-util-minify-whitespace": "^1.0.0", - "hast-util-phrasing": "^3.0.0", - "hast-util-whitespace": "^3.0.0", - "html-whitespace-sensitive-tag-names": "^3.0.0", - "unist-util-visit-parents": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hast-util-from-html": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/hast-util-from-html/-/hast-util-from-html-2.0.3.tgz", - "integrity": "sha512-CUSRHXyKjzHov8yKsQjGOElXy/3EKpyX56ELnkHH34vDVw1N1XSQ1ZcAvTyAPtGqLTuKP/uxM+aLkSPqF/EtMw==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "devlop": "^1.1.0", - "hast-util-from-parse5": "^8.0.0", - "parse5": "^7.0.0", - "vfile": "^6.0.0", - "vfile-message": "^4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hast-util-from-parse5": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/hast-util-from-parse5/-/hast-util-from-parse5-8.0.3.tgz", - "integrity": "sha512-3kxEVkEKt0zvcZ3hCRYI8rqrgwtlIOFMWkbclACvjlDw8Li9S2hk/d51OI0nr/gIpdMHNepwgOKqZ/sy0Clpyg==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "@types/unist": "^3.0.0", - "devlop": "^1.0.0", - "hastscript": "^9.0.0", - "property-information": "^7.0.0", - "vfile": "^6.0.0", - "vfile-location": "^5.0.0", - "web-namespaces": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hast-util-has-property": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/hast-util-has-property/-/hast-util-has-property-3.0.0.tgz", - "integrity": "sha512-MNilsvEKLFpV604hwfhVStK0usFY/QmM5zX16bo7EjnAEGofr5YyI37kzopBlZJkHD4t887i+q/C8/tr5Q94cA==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hast-util-is-body-ok-link": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/hast-util-is-body-ok-link/-/hast-util-is-body-ok-link-3.0.1.tgz", - "integrity": "sha512-0qpnzOBLztXHbHQenVB8uNuxTnm/QBFUOmdOSsEn7GnBtyY07+ENTWVFBAnXd/zEgd9/SUG3lRY7hSIBWRgGpQ==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hast-util-is-element": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/hast-util-is-element/-/hast-util-is-element-3.0.0.tgz", - "integrity": "sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hast-util-minify-whitespace": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hast-util-minify-whitespace/-/hast-util-minify-whitespace-1.0.1.tgz", - "integrity": "sha512-L96fPOVpnclQE0xzdWb/D12VT5FabA7SnZOUMtL1DbXmYiHJMXZvFkIZfiMmTCNJHUeO2K9UYNXoVyfz+QHuOw==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "hast-util-embedded": "^3.0.0", - "hast-util-is-element": "^3.0.0", - "hast-util-whitespace": "^3.0.0", - "unist-util-is": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hast-util-parse-selector": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-4.0.0.tgz", - "integrity": "sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hast-util-phrasing": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/hast-util-phrasing/-/hast-util-phrasing-3.0.1.tgz", - "integrity": "sha512-6h60VfI3uBQUxHqTyMymMZnEbNl1XmEGtOxxKYL7stY2o601COo62AWAYBQR9lZbYXYSBoxag8UpPRXK+9fqSQ==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "hast-util-embedded": "^3.0.0", - "hast-util-has-property": "^3.0.0", - "hast-util-is-body-ok-link": "^3.0.0", - "hast-util-is-element": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hast-util-raw": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/hast-util-raw/-/hast-util-raw-9.1.0.tgz", - "integrity": "sha512-Y8/SBAHkZGoNkpzqqfCldijcuUKh7/su31kEBp67cFY09Wy0mTRgtsLYsiIxMJxlu0f6AA5SUTbDR8K0rxnbUw==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "@types/unist": "^3.0.0", - "@ungap/structured-clone": "^1.0.0", - "hast-util-from-parse5": "^8.0.0", - "hast-util-to-parse5": "^8.0.0", - "html-void-elements": "^3.0.0", - "mdast-util-to-hast": "^13.0.0", - "parse5": "^7.0.0", - "unist-util-position": "^5.0.0", - "unist-util-visit": "^5.0.0", - "vfile": "^6.0.0", - "web-namespaces": "^2.0.0", - "zwitch": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hast-util-select": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/hast-util-select/-/hast-util-select-6.0.4.tgz", - "integrity": "sha512-RqGS1ZgI0MwxLaKLDxjprynNzINEkRHY2i8ln4DDjgv9ZhcYVIHN9rlpiYsqtFwrgpYU361SyWDQcGNIBVu3lw==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "@types/unist": "^3.0.0", - "bcp-47-match": "^2.0.0", - "comma-separated-tokens": "^2.0.0", - "css-selector-parser": "^3.0.0", - "devlop": "^1.0.0", - "direction": "^2.0.0", - "hast-util-has-property": "^3.0.0", - "hast-util-to-string": "^3.0.0", - "hast-util-whitespace": "^3.0.0", - "nth-check": "^2.0.0", - "property-information": "^7.0.0", - "space-separated-tokens": "^2.0.0", - "unist-util-visit": "^5.0.0", - "zwitch": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hast-util-to-estree": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/hast-util-to-estree/-/hast-util-to-estree-3.1.3.tgz", - "integrity": "sha512-48+B/rJWAp0jamNbAAf9M7Uf//UVqAoMmgXhBdxTDJLGKY+LRnZ99qcG+Qjl5HfMpYNzS5v4EAwVEF34LeAj7w==", - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0", - "@types/estree-jsx": "^1.0.0", - "@types/hast": "^3.0.0", - "comma-separated-tokens": "^2.0.0", - "devlop": "^1.0.0", - "estree-util-attach-comments": "^3.0.0", - "estree-util-is-identifier-name": "^3.0.0", - "hast-util-whitespace": "^3.0.0", - "mdast-util-mdx-expression": "^2.0.0", - "mdast-util-mdx-jsx": "^3.0.0", - "mdast-util-mdxjs-esm": "^2.0.0", - "property-information": "^7.0.0", - "space-separated-tokens": "^2.0.0", - "style-to-js": "^1.0.0", - "unist-util-position": "^5.0.0", - "zwitch": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hast-util-to-html": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.5.tgz", - "integrity": "sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "@types/unist": "^3.0.0", - "ccount": "^2.0.0", - "comma-separated-tokens": "^2.0.0", - "hast-util-whitespace": "^3.0.0", - "html-void-elements": "^3.0.0", - "mdast-util-to-hast": "^13.0.0", - "property-information": "^7.0.0", - "space-separated-tokens": "^2.0.0", - "stringify-entities": "^4.0.0", - "zwitch": "^2.0.4" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hast-util-to-jsx-runtime": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/hast-util-to-jsx-runtime/-/hast-util-to-jsx-runtime-2.3.6.tgz", - "integrity": "sha512-zl6s8LwNyo1P9uw+XJGvZtdFF1GdAkOg8ujOw+4Pyb76874fLps4ueHXDhXWdk6YHQ6OgUtinliG7RsYvCbbBg==", - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0", - "@types/hast": "^3.0.0", - "@types/unist": "^3.0.0", - "comma-separated-tokens": "^2.0.0", - "devlop": "^1.0.0", - "estree-util-is-identifier-name": "^3.0.0", - "hast-util-whitespace": "^3.0.0", - "mdast-util-mdx-expression": "^2.0.0", - "mdast-util-mdx-jsx": "^3.0.0", - "mdast-util-mdxjs-esm": "^2.0.0", - "property-information": "^7.0.0", - "space-separated-tokens": "^2.0.0", - "style-to-js": "^1.0.0", - "unist-util-position": "^5.0.0", - "vfile-message": "^4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hast-util-to-parse5": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/hast-util-to-parse5/-/hast-util-to-parse5-8.0.1.tgz", - "integrity": "sha512-MlWT6Pjt4CG9lFCjiz4BH7l9wmrMkfkJYCxFwKQic8+RTZgWPuWxwAfjJElsXkex7DJjfSJsQIt931ilUgmwdA==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "comma-separated-tokens": "^2.0.0", - "devlop": "^1.0.0", - "property-information": "^7.0.0", - "space-separated-tokens": "^2.0.0", - "web-namespaces": "^2.0.0", - "zwitch": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hast-util-to-string": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/hast-util-to-string/-/hast-util-to-string-3.0.1.tgz", - "integrity": "sha512-XelQVTDWvqcl3axRfI0xSeoVKzyIFPwsAGSLIsKdJKQMXDYJS4WYrBNF/8J7RdhIcFI2BOHgAifggsvsxp/3+A==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hast-util-to-text": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/hast-util-to-text/-/hast-util-to-text-4.0.2.tgz", - "integrity": "sha512-KK6y/BN8lbaq654j7JgBydev7wuNMcID54lkRav1P0CaE1e47P72AWWPiGKXTJU271ooYzcvTAn/Zt0REnvc7A==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "@types/unist": "^3.0.0", - "hast-util-is-element": "^3.0.0", - "unist-util-find-after": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hast-util-whitespace": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz", - "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hastscript": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/hastscript/-/hastscript-9.0.1.tgz", - "integrity": "sha512-g7df9rMFX/SPi34tyGCyUBREQoKkapwdY/T04Qn9TDWfHhAYt4/I0gMVirzK5wEzeUqIjEB+LXC/ypb7Aqno5w==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "comma-separated-tokens": "^2.0.0", - "hast-util-parse-selector": "^4.0.0", - "property-information": "^7.0.0", - "space-separated-tokens": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/html-escaper": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-3.0.3.tgz", - "integrity": "sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ==", - "license": "MIT" - }, - "node_modules/html-void-elements": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-3.0.0.tgz", - "integrity": "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/html-whitespace-sensitive-tag-names": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/html-whitespace-sensitive-tag-names/-/html-whitespace-sensitive-tag-names-3.0.1.tgz", - "integrity": "sha512-q+310vW8zmymYHALr1da4HyXUQ0zgiIwIicEfotYPWGN0OJVEN/58IJ3A4GBYcEq3LGAZqKb+ugvP0GNB9CEAA==", - "license": "MIT", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/http-cache-semantics": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.2.0.tgz", - "integrity": "sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ==", - "license": "BSD-2-Clause" - }, - "node_modules/i18next": { - "version": "26.3.4", - "resolved": "https://registry.npmjs.org/i18next/-/i18next-26.3.4.tgz", - "integrity": "sha512-pa7m0d7pBDqGHZxljT+WPFeyFgQ7P7SciPPo1tTqYuO0z4sqADYhwnBESmmGp/wEof1inwdls/k8ZgTg8rxFHA==", - "funding": [ - { - "type": "individual", - "url": "https://www.locize.com/i18next" - }, - { - "type": "individual", - "url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project" - }, - { - "type": "individual", - "url": "https://www.locize.com" - } - ], - "license": "MIT", - "peerDependencies": { - "typescript": "^5 || ^6" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/inline-style-parser": { - "version": "0.2.7", - "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.7.tgz", - "integrity": "sha512-Nb2ctOyNR8DqQoR0OwRG95uNWIC0C1lCgf5Naz5H6Ji72KZ8OcFZLz2P5sNgwlyoJ8Yif11oMuYs5pBQa86csA==", - "license": "MIT" - }, - "node_modules/iron-webcrypto": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/iron-webcrypto/-/iron-webcrypto-1.2.1.tgz", - "integrity": "sha512-feOM6FaSr6rEABp/eDfVseKyTMDt+KGpeB35SkVn9Tyn0CqvVsY3EwI0v5i8nMHyJnzCIQf7nsy3p41TPkJZhg==", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/brc-dd" - } - }, - "node_modules/is-alphabetical": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz", - "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/is-alphanumerical": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz", - "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==", - "license": "MIT", - "dependencies": { - "is-alphabetical": "^2.0.0", - "is-decimal": "^2.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/is-decimal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz", - "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/is-docker": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-4.0.0.tgz", - "integrity": "sha512-LHE+wROyG/Y/0ZnbktRCoTix2c1RhgWaZraMZ8o1Q7zCh0VSrICJQO5oqIIISrcSBtrXv0o233w1IYwsWCjTzA==", - "license": "MIT", - "bin": { - "is-docker": "cli.js" - }, - "engines": { - "node": ">=20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-hexadecimal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz", - "integrity": "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/is-plain-obj": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", - "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/js-yaml": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.1.tgz", - "integrity": "sha512-CY6crGq313MX8GkwvB7tzgp99vjQxY1++5y10/BKN/GUfHqWaOGQMNZkBvqSzsZKWk/ijwHlWzzkLulsGHhjWQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/puzrin" - }, - { - "type": "github", - "url": "https://github.com/sponsors/nodeca" - } - ], - "license": "MIT", - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/jsonc-parser": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.3.1.tgz", - "integrity": "sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==", - "license": "MIT" - }, - "node_modules/klona": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/klona/-/klona-2.0.6.tgz", - "integrity": "sha512-dhG34DXATL5hSxJbIexCft8FChFXtmskoZYnoPWjXQuebWYCNkVeV3KkGegCK9CP1oswI/vQibS2GY7Em/sJJA==", - "license": "MIT", - "engines": { - "node": ">= 8" - } - }, - "node_modules/lightningcss": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz", - "integrity": "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==", - "license": "MPL-2.0", - "dependencies": { - "detect-libc": "^2.0.3" - }, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - }, - "optionalDependencies": { - "lightningcss-android-arm64": "1.32.0", - "lightningcss-darwin-arm64": "1.32.0", - "lightningcss-darwin-x64": "1.32.0", - "lightningcss-freebsd-x64": "1.32.0", - "lightningcss-linux-arm-gnueabihf": "1.32.0", - "lightningcss-linux-arm64-gnu": "1.32.0", - "lightningcss-linux-arm64-musl": "1.32.0", - "lightningcss-linux-x64-gnu": "1.32.0", - "lightningcss-linux-x64-musl": "1.32.0", - "lightningcss-win32-arm64-msvc": "1.32.0", - "lightningcss-win32-x64-msvc": "1.32.0" - } - }, - "node_modules/lightningcss-android-arm64": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.32.0.tgz", - "integrity": "sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg==", - "cpu": [ - "arm64" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-darwin-arm64": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.32.0.tgz", - "integrity": "sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ==", - "cpu": [ - "arm64" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-darwin-x64": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.32.0.tgz", - "integrity": "sha512-U+QsBp2m/s2wqpUYT/6wnlagdZbtZdndSmut/NJqlCcMLTWp5muCrID+K5UJ6jqD2BFshejCYXniPDbNh73V8w==", - "cpu": [ - "x64" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-freebsd-x64": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.32.0.tgz", - "integrity": "sha512-JCTigedEksZk3tHTTthnMdVfGf61Fky8Ji2E4YjUTEQX14xiy/lTzXnu1vwiZe3bYe0q+SpsSH/CTeDXK6WHig==", - "cpu": [ - "x64" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-arm-gnueabihf": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.32.0.tgz", - "integrity": "sha512-x6rnnpRa2GL0zQOkt6rts3YDPzduLpWvwAF6EMhXFVZXD4tPrBkEFqzGowzCsIWsPjqSK+tyNEODUBXeeVHSkw==", - "cpu": [ - "arm" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-arm64-gnu": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.32.0.tgz", - "integrity": "sha512-0nnMyoyOLRJXfbMOilaSRcLH3Jw5z9HDNGfT/gwCPgaDjnx0i8w7vBzFLFR1f6CMLKF8gVbebmkUN3fa/kQJpQ==", - "cpu": [ - "arm64" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-arm64-musl": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.32.0.tgz", - "integrity": "sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==", - "cpu": [ - "arm64" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-x64-gnu": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.32.0.tgz", - "integrity": "sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==", - "cpu": [ - "x64" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-x64-musl": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.32.0.tgz", - "integrity": "sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==", - "cpu": [ - "x64" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-win32-arm64-msvc": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.32.0.tgz", - "integrity": "sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==", - "cpu": [ - "arm64" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-win32-x64-msvc": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.32.0.tgz", - "integrity": "sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q==", - "cpu": [ - "x64" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/longest-streak": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-3.1.0.tgz", - "integrity": "sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/lru-cache": { - "version": "11.5.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.1.tgz", - "integrity": "sha512-RPimw/7aMdv2oqRrxKwvZXcPfwBrn/JZ2xYcY9Hus/6LaS3VOAKVWKWgNLCFSiOm1ESXinjsDlidVU7JlnCN2A==", - "license": "BlueOak-1.0.0", - "engines": { - "node": "20 || >=22" - } - }, - "node_modules/magic-string": { - "version": "0.30.21", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", - "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", - "license": "MIT", - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.5" - } - }, - "node_modules/magicast": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.5.3.tgz", - "integrity": "sha512-pVKE4UdSQ7DvHzivsCIFx2BJn1mHG6KsyrFcaxFx6tONdneEuThrDx0Cj3AMg58KyN4pzYT+LHOotxDQDjNvkw==", - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.29.3", - "@babel/types": "^7.29.0", - "source-map-js": "^1.2.1" - } - }, - "node_modules/markdown-extensions": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/markdown-extensions/-/markdown-extensions-2.0.0.tgz", - "integrity": "sha512-o5vL7aDWatOTX8LzaS1WMoaoxIiLRQJuIKKe2wAw6IeULDHaqbiqiggmx+pKvZDb1Sj+pE46Sn1T7lCqfFtg1Q==", - "license": "MIT", - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/markdown-table": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.4.tgz", - "integrity": "sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/mdast-util-definitions": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/mdast-util-definitions/-/mdast-util-definitions-6.0.0.tgz", - "integrity": "sha512-scTllyX6pnYNZH/AIp/0ePz6s4cZtARxImwoPJ7kS42n+MnVsI4XbnG6d4ibehRIldYMWM2LD7ImQblVhUejVQ==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "@types/unist": "^3.0.0", - "unist-util-visit": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-directive": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/mdast-util-directive/-/mdast-util-directive-3.1.0.tgz", - "integrity": "sha512-I3fNFt+DHmpWCYAT7quoM6lHf9wuqtI+oCOfvILnoicNIqjh5E3dEJWiXuYME2gNe8vl1iMQwyUHa7bgFmak6Q==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "@types/unist": "^3.0.0", - "ccount": "^2.0.0", - "devlop": "^1.0.0", - "mdast-util-from-markdown": "^2.0.0", - "mdast-util-to-markdown": "^2.0.0", - "parse-entities": "^4.0.0", - "stringify-entities": "^4.0.0", - "unist-util-visit-parents": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-find-and-replace": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-3.0.2.tgz", - "integrity": "sha512-Tmd1Vg/m3Xz43afeNxDIhWRtFZgM2VLyaf4vSTYwudTyeuTneoL3qtWMA5jeLyz/O1vDJmmV4QuScFCA2tBPwg==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "escape-string-regexp": "^5.0.0", - "unist-util-is": "^6.0.0", - "unist-util-visit-parents": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-from-markdown": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.3.tgz", - "integrity": "sha512-W4mAWTvSlKvf8L6J+VN9yLSqQ9AOAAvHuoDAmPkz4dHf553m5gVj2ejadHJhoJmcmxEnOv6Pa8XJhpxE93kb8Q==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "@types/unist": "^3.0.0", - "decode-named-character-reference": "^1.0.0", - "devlop": "^1.0.0", - "mdast-util-to-string": "^4.0.0", - "micromark": "^4.0.0", - "micromark-util-decode-numeric-character-reference": "^2.0.0", - "micromark-util-decode-string": "^2.0.0", - "micromark-util-normalize-identifier": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0", - "unist-util-stringify-position": "^4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-gfm": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-3.1.0.tgz", - "integrity": "sha512-0ulfdQOM3ysHhCJ1p06l0b0VKlhU0wuQs3thxZQagjcjPrlFRqY215uZGHHJan9GEAXd9MbfPjFJz+qMkVR6zQ==", - "license": "MIT", - "dependencies": { - "mdast-util-from-markdown": "^2.0.0", - "mdast-util-gfm-autolink-literal": "^2.0.0", - "mdast-util-gfm-footnote": "^2.0.0", - "mdast-util-gfm-strikethrough": "^2.0.0", - "mdast-util-gfm-table": "^2.0.0", - "mdast-util-gfm-task-list-item": "^2.0.0", - "mdast-util-to-markdown": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-gfm-autolink-literal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-2.0.1.tgz", - "integrity": "sha512-5HVP2MKaP6L+G6YaxPNjuL0BPrq9orG3TsrZ9YXbA3vDw/ACI4MEsnoDpn6ZNm7GnZgtAcONJyPhOP8tNJQavQ==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "ccount": "^2.0.0", - "devlop": "^1.0.0", - "mdast-util-find-and-replace": "^3.0.0", - "micromark-util-character": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-gfm-footnote": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-footnote/-/mdast-util-gfm-footnote-2.1.0.tgz", - "integrity": "sha512-sqpDWlsHn7Ac9GNZQMeUzPQSMzR6Wv0WKRNvQRg0KqHh02fpTz69Qc1QSseNX29bhz1ROIyNyxExfawVKTm1GQ==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "devlop": "^1.1.0", - "mdast-util-from-markdown": "^2.0.0", - "mdast-util-to-markdown": "^2.0.0", - "micromark-util-normalize-identifier": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-gfm-strikethrough": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-2.0.0.tgz", - "integrity": "sha512-mKKb915TF+OC5ptj5bJ7WFRPdYtuHv0yTRxK2tJvi+BDqbkiG7h7u/9SI89nRAYcmap2xHQL9D+QG/6wSrTtXg==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "mdast-util-from-markdown": "^2.0.0", - "mdast-util-to-markdown": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-gfm-table": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-2.0.0.tgz", - "integrity": "sha512-78UEvebzz/rJIxLvE7ZtDd/vIQ0RHv+3Mh5DR96p7cS7HsBhYIICDBCu8csTNWNO6tBWfqXPWekRuj2FNOGOZg==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "devlop": "^1.0.0", - "markdown-table": "^3.0.0", - "mdast-util-from-markdown": "^2.0.0", - "mdast-util-to-markdown": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-gfm-task-list-item": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-2.0.0.tgz", - "integrity": "sha512-IrtvNvjxC1o06taBAVJznEnkiHxLFTzgonUdy8hzFVeDun0uTjxxrRGVaNFqkU1wJR3RBPEfsxmU6jDWPofrTQ==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "devlop": "^1.0.0", - "mdast-util-from-markdown": "^2.0.0", - "mdast-util-to-markdown": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-mdx": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/mdast-util-mdx/-/mdast-util-mdx-3.0.0.tgz", - "integrity": "sha512-JfbYLAW7XnYTTbUsmpu0kdBUVe+yKVJZBItEjwyYJiDJuZ9w4eeaqks4HQO+R7objWgS2ymV60GYpI14Ug554w==", - "license": "MIT", - "dependencies": { - "mdast-util-from-markdown": "^2.0.0", - "mdast-util-mdx-expression": "^2.0.0", - "mdast-util-mdx-jsx": "^3.0.0", - "mdast-util-mdxjs-esm": "^2.0.0", - "mdast-util-to-markdown": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-mdx-expression": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/mdast-util-mdx-expression/-/mdast-util-mdx-expression-2.0.1.tgz", - "integrity": "sha512-J6f+9hUp+ldTZqKRSg7Vw5V6MqjATc+3E4gf3CFNcuZNWD8XdyI6zQ8GqH7f8169MM6P7hMBRDVGnn7oHB9kXQ==", - "license": "MIT", - "dependencies": { - "@types/estree-jsx": "^1.0.0", - "@types/hast": "^3.0.0", - "@types/mdast": "^4.0.0", - "devlop": "^1.0.0", - "mdast-util-from-markdown": "^2.0.0", - "mdast-util-to-markdown": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-mdx-jsx": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-3.2.0.tgz", - "integrity": "sha512-lj/z8v0r6ZtsN/cGNNtemmmfoLAFZnjMbNyLzBafjzikOM+glrjNHPlf6lQDOTccj9n5b0PPihEBbhneMyGs1Q==", - "license": "MIT", - "dependencies": { - "@types/estree-jsx": "^1.0.0", - "@types/hast": "^3.0.0", - "@types/mdast": "^4.0.0", - "@types/unist": "^3.0.0", - "ccount": "^2.0.0", - "devlop": "^1.1.0", - "mdast-util-from-markdown": "^2.0.0", - "mdast-util-to-markdown": "^2.0.0", - "parse-entities": "^4.0.0", - "stringify-entities": "^4.0.0", - "unist-util-stringify-position": "^4.0.0", - "vfile-message": "^4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-mdxjs-esm": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/mdast-util-mdxjs-esm/-/mdast-util-mdxjs-esm-2.0.1.tgz", - "integrity": "sha512-EcmOpxsZ96CvlP03NghtH1EsLtr0n9Tm4lPUJUBccV9RwUOneqSycg19n5HGzCf+10LozMRSObtVr3ee1WoHtg==", - "license": "MIT", - "dependencies": { - "@types/estree-jsx": "^1.0.0", - "@types/hast": "^3.0.0", - "@types/mdast": "^4.0.0", - "devlop": "^1.0.0", - "mdast-util-from-markdown": "^2.0.0", - "mdast-util-to-markdown": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-phrasing": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-4.1.0.tgz", - "integrity": "sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "unist-util-is": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-to-hast": { - "version": "13.2.1", - "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.1.tgz", - "integrity": "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "@types/mdast": "^4.0.0", - "@ungap/structured-clone": "^1.0.0", - "devlop": "^1.0.0", - "micromark-util-sanitize-uri": "^2.0.0", - "trim-lines": "^3.0.0", - "unist-util-position": "^5.0.0", - "unist-util-visit": "^5.0.0", - "vfile": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-to-markdown": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-2.1.2.tgz", - "integrity": "sha512-xj68wMTvGXVOKonmog6LwyJKrYXZPvlwabaryTjLh9LuvovB/KAH+kvi8Gjj+7rJjsFi23nkUxRQv1KqSroMqA==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "@types/unist": "^3.0.0", - "longest-streak": "^3.0.0", - "mdast-util-phrasing": "^4.0.0", - "mdast-util-to-string": "^4.0.0", - "micromark-util-classify-character": "^2.0.0", - "micromark-util-decode-string": "^2.0.0", - "unist-util-visit": "^5.0.0", - "zwitch": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-to-string": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz", - "integrity": "sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdn-data": { - "version": "2.27.1", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.27.1.tgz", - "integrity": "sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==", - "license": "CC0-1.0" - }, - "node_modules/micromark": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/micromark/-/micromark-4.0.2.tgz", - "integrity": "sha512-zpe98Q6kvavpCr1NPVSCMebCKfD7CA2NqZ+rykeNhONIJBpc1tFKt9hucLGwha3jNTNI8lHpctWJWoimVF4PfA==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "@types/debug": "^4.0.0", - "debug": "^4.0.0", - "decode-named-character-reference": "^1.0.0", - "devlop": "^1.0.0", - "micromark-core-commonmark": "^2.0.0", - "micromark-factory-space": "^2.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-chunked": "^2.0.0", - "micromark-util-combine-extensions": "^2.0.0", - "micromark-util-decode-numeric-character-reference": "^2.0.0", - "micromark-util-encode": "^2.0.0", - "micromark-util-normalize-identifier": "^2.0.0", - "micromark-util-resolve-all": "^2.0.0", - "micromark-util-sanitize-uri": "^2.0.0", - "micromark-util-subtokenize": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-core-commonmark": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-2.0.3.tgz", - "integrity": "sha512-RDBrHEMSxVFLg6xvnXmb1Ayr2WzLAWjeSATAoxwKYJV94TeNavgoIdA0a9ytzDSVzBy2YKFK+emCPOEibLeCrg==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "decode-named-character-reference": "^1.0.0", - "devlop": "^1.0.0", - "micromark-factory-destination": "^2.0.0", - "micromark-factory-label": "^2.0.0", - "micromark-factory-space": "^2.0.0", - "micromark-factory-title": "^2.0.0", - "micromark-factory-whitespace": "^2.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-chunked": "^2.0.0", - "micromark-util-classify-character": "^2.0.0", - "micromark-util-html-tag-name": "^2.0.0", - "micromark-util-normalize-identifier": "^2.0.0", - "micromark-util-resolve-all": "^2.0.0", - "micromark-util-subtokenize": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-extension-directive": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/micromark-extension-directive/-/micromark-extension-directive-4.0.0.tgz", - "integrity": "sha512-/C2nqVmXXmiseSSuCdItCMho7ybwwop6RrrRPk0KbOHW21JKoCldC+8rFOaundDoRBUWBnJJcxeA/Kvi34WQXg==", - "license": "MIT", - "dependencies": { - "devlop": "^1.0.0", - "micromark-factory-space": "^2.0.0", - "micromark-factory-whitespace": "^2.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0", - "parse-entities": "^4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/micromark-extension-gfm": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-3.0.0.tgz", - "integrity": "sha512-vsKArQsicm7t0z2GugkCKtZehqUm31oeGBV/KVSorWSy8ZlNAv7ytjFhvaryUiCUJYqs+NoE6AFhpQvBTM6Q4w==", - "license": "MIT", - "dependencies": { - "micromark-extension-gfm-autolink-literal": "^2.0.0", - "micromark-extension-gfm-footnote": "^2.0.0", - "micromark-extension-gfm-strikethrough": "^2.0.0", - "micromark-extension-gfm-table": "^2.0.0", - "micromark-extension-gfm-tagfilter": "^2.0.0", - "micromark-extension-gfm-task-list-item": "^2.0.0", - "micromark-util-combine-extensions": "^2.0.0", - "micromark-util-types": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/micromark-extension-gfm-autolink-literal": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-2.1.0.tgz", - "integrity": "sha512-oOg7knzhicgQ3t4QCjCWgTmfNhvQbDDnJeVu9v81r7NltNCVmhPy1fJRX27pISafdjL+SVc4d3l48Gb6pbRypw==", - "license": "MIT", - "dependencies": { - "micromark-util-character": "^2.0.0", - "micromark-util-sanitize-uri": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/micromark-extension-gfm-footnote": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-footnote/-/micromark-extension-gfm-footnote-2.1.0.tgz", - "integrity": "sha512-/yPhxI1ntnDNsiHtzLKYnE3vf9JZ6cAisqVDauhp4CEHxlb4uoOTxOCJ+9s51bIB8U1N1FJ1RXOKTIlD5B/gqw==", - "license": "MIT", - "dependencies": { - "devlop": "^1.0.0", - "micromark-core-commonmark": "^2.0.0", - "micromark-factory-space": "^2.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-normalize-identifier": "^2.0.0", - "micromark-util-sanitize-uri": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/micromark-extension-gfm-strikethrough": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-2.1.0.tgz", - "integrity": "sha512-ADVjpOOkjz1hhkZLlBiYA9cR2Anf8F4HqZUO6e5eDcPQd0Txw5fxLzzxnEkSkfnD0wziSGiv7sYhk/ktvbf1uw==", - "license": "MIT", - "dependencies": { - "devlop": "^1.0.0", - "micromark-util-chunked": "^2.0.0", - "micromark-util-classify-character": "^2.0.0", - "micromark-util-resolve-all": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/micromark-extension-gfm-table": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-2.1.1.tgz", - "integrity": "sha512-t2OU/dXXioARrC6yWfJ4hqB7rct14e8f7m0cbI5hUmDyyIlwv5vEtooptH8INkbLzOatzKuVbQmAYcbWoyz6Dg==", - "license": "MIT", - "dependencies": { - "devlop": "^1.0.0", - "micromark-factory-space": "^2.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/micromark-extension-gfm-tagfilter": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-tagfilter/-/micromark-extension-gfm-tagfilter-2.0.0.tgz", - "integrity": "sha512-xHlTOmuCSotIA8TW1mDIM6X2O1SiX5P9IuDtqGonFhEK0qgRI4yeC6vMxEV2dgyr2TiD+2PQ10o+cOhdVAcwfg==", - "license": "MIT", - "dependencies": { - "micromark-util-types": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/micromark-extension-gfm-task-list-item": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-2.1.0.tgz", - "integrity": "sha512-qIBZhqxqI6fjLDYFTBIa4eivDMnP+OZqsNwmQ3xNLE4Cxwc+zfQEfbs6tzAo2Hjq+bh6q5F+Z8/cksrLFYWQQw==", - "license": "MIT", - "dependencies": { - "devlop": "^1.0.0", - "micromark-factory-space": "^2.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/micromark-extension-mdx-expression": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/micromark-extension-mdx-expression/-/micromark-extension-mdx-expression-3.0.1.tgz", - "integrity": "sha512-dD/ADLJ1AeMvSAKBwO22zG22N4ybhe7kFIZ3LsDI0GlsNr2A3KYxb0LdC1u5rj4Nw+CHKY0RVdnHX8vj8ejm4Q==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0", - "devlop": "^1.0.0", - "micromark-factory-mdx-expression": "^2.0.0", - "micromark-factory-space": "^2.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-events-to-acorn": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-extension-mdx-jsx": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/micromark-extension-mdx-jsx/-/micromark-extension-mdx-jsx-3.0.2.tgz", - "integrity": "sha512-e5+q1DjMh62LZAJOnDraSSbDMvGJ8x3cbjygy2qFEi7HCeUT4BDKCvMozPozcD6WmOt6sVvYDNBKhFSz3kjOVQ==", - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0", - "devlop": "^1.0.0", - "estree-util-is-identifier-name": "^3.0.0", - "micromark-factory-mdx-expression": "^2.0.0", - "micromark-factory-space": "^2.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-events-to-acorn": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0", - "vfile-message": "^4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/micromark-extension-mdx-md": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/micromark-extension-mdx-md/-/micromark-extension-mdx-md-2.0.0.tgz", - "integrity": "sha512-EpAiszsB3blw4Rpba7xTOUptcFeBFi+6PY8VnJ2hhimH+vCQDirWgsMpz7w1XcZE7LVrSAUGb9VJpG9ghlYvYQ==", - "license": "MIT", - "dependencies": { - "micromark-util-types": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/micromark-extension-mdxjs": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/micromark-extension-mdxjs/-/micromark-extension-mdxjs-3.0.0.tgz", - "integrity": "sha512-A873fJfhnJ2siZyUrJ31l34Uqwy4xIFmvPY1oj+Ean5PHcPBYzEsvqvWGaWcfEIr11O5Dlw3p2y0tZWpKHDejQ==", - "license": "MIT", - "dependencies": { - "acorn": "^8.0.0", - "acorn-jsx": "^5.0.0", - "micromark-extension-mdx-expression": "^3.0.0", - "micromark-extension-mdx-jsx": "^3.0.0", - "micromark-extension-mdx-md": "^2.0.0", - "micromark-extension-mdxjs-esm": "^3.0.0", - "micromark-util-combine-extensions": "^2.0.0", - "micromark-util-types": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/micromark-extension-mdxjs-esm": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/micromark-extension-mdxjs-esm/-/micromark-extension-mdxjs-esm-3.0.0.tgz", - "integrity": "sha512-DJFl4ZqkErRpq/dAPyeWp15tGrcrrJho1hKK5uBS70BCtfrIFg81sqcTVu3Ta+KD1Tk5vAtBNElWxtAa+m8K9A==", - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0", - "devlop": "^1.0.0", - "micromark-core-commonmark": "^2.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-events-to-acorn": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0", - "unist-util-position-from-estree": "^2.0.0", - "vfile-message": "^4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/micromark-factory-destination": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-2.0.1.tgz", - "integrity": "sha512-Xe6rDdJlkmbFRExpTOmRj9N3MaWmbAgdpSrBQvCFqhezUn4AHqJHbaEnfbVYYiexVSs//tqOdY/DxhjdCiJnIA==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "micromark-util-character": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-factory-label": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-2.0.1.tgz", - "integrity": "sha512-VFMekyQExqIW7xIChcXn4ok29YE3rnuyveW3wZQWWqF4Nv9Wk5rgJ99KzPvHjkmPXF93FXIbBp6YdW3t71/7Vg==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "devlop": "^1.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-factory-mdx-expression": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/micromark-factory-mdx-expression/-/micromark-factory-mdx-expression-2.0.3.tgz", - "integrity": "sha512-kQnEtA3vzucU2BkrIa8/VaSAsP+EJ3CKOvhMuJgOEGg9KDC6OAY6nSnNDVRiVNRqj7Y4SlSzcStaH/5jge8JdQ==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0", - "devlop": "^1.0.0", - "micromark-factory-space": "^2.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-events-to-acorn": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0", - "unist-util-position-from-estree": "^2.0.0", - "vfile-message": "^4.0.0" - } - }, - "node_modules/micromark-factory-space": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-2.0.1.tgz", - "integrity": "sha512-zRkxjtBxxLd2Sc0d+fbnEunsTj46SWXgXciZmHq0kDYGnck/ZSGj9/wULTV95uoeYiK5hRXP2mJ98Uo4cq/LQg==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "micromark-util-character": "^2.0.0", - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-factory-title": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-2.0.1.tgz", - "integrity": "sha512-5bZ+3CjhAd9eChYTHsjy6TGxpOFSKgKKJPJxr293jTbfry2KDoWkhBb6TcPVB4NmzaPhMs1Frm9AZH7OD4Cjzw==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "micromark-factory-space": "^2.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-factory-whitespace": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-2.0.1.tgz", - "integrity": "sha512-Ob0nuZ3PKt/n0hORHyvoD9uZhr+Za8sFoP+OnMcnWK5lngSzALgQYKMr9RJVOWLqQYuyn6ulqGWSXdwf6F80lQ==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "micromark-factory-space": "^2.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-util-character": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz", - "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-util-chunked": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-2.0.1.tgz", - "integrity": "sha512-QUNFEOPELfmvv+4xiNg2sRYeS/P84pTW0TCgP5zc9FpXetHY0ab7SxKyAQCNCc1eK0459uoLI1y5oO5Vc1dbhA==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "micromark-util-symbol": "^2.0.0" - } - }, - "node_modules/micromark-util-classify-character": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-2.0.1.tgz", - "integrity": "sha512-K0kHzM6afW/MbeWYWLjoHQv1sgg2Q9EccHEDzSkxiP/EaagNzCm7T/WMKZ3rjMbvIpvBiZgwR3dKMygtA4mG1Q==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "micromark-util-character": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-util-combine-extensions": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-2.0.1.tgz", - "integrity": "sha512-OnAnH8Ujmy59JcyZw8JSbK9cGpdVY44NKgSM7E9Eh7DiLS2E9RNQf0dONaGDzEG9yjEl5hcqeIsj4hfRkLH/Bg==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "micromark-util-chunked": "^2.0.0", - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-util-decode-numeric-character-reference": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-2.0.2.tgz", - "integrity": "sha512-ccUbYk6CwVdkmCQMyr64dXz42EfHGkPQlBj5p7YVGzq8I7CtjXZJrubAYezf7Rp+bjPseiROqe7G6foFd+lEuw==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "micromark-util-symbol": "^2.0.0" - } - }, - "node_modules/micromark-util-decode-string": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-2.0.1.tgz", - "integrity": "sha512-nDV/77Fj6eH1ynwscYTOsbK7rR//Uj0bZXBwJZRfaLEJ1iGBR6kIfNmlNqaqJf649EP0F3NWNdeJi03elllNUQ==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "decode-named-character-reference": "^1.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-decode-numeric-character-reference": "^2.0.0", - "micromark-util-symbol": "^2.0.0" - } - }, - "node_modules/micromark-util-encode": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz", - "integrity": "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT" - }, - "node_modules/micromark-util-events-to-acorn": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/micromark-util-events-to-acorn/-/micromark-util-events-to-acorn-2.0.3.tgz", - "integrity": "sha512-jmsiEIiZ1n7X1Rr5k8wVExBQCg5jy4UXVADItHmNk1zkwEVhBuIUKRu3fqv+hs4nxLISi2DQGlqIOGiFxgbfHg==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0", - "@types/unist": "^3.0.0", - "devlop": "^1.0.0", - "estree-util-visit": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0", - "vfile-message": "^4.0.0" - } - }, - "node_modules/micromark-util-html-tag-name": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-2.0.1.tgz", - "integrity": "sha512-2cNEiYDhCWKI+Gs9T0Tiysk136SnR13hhO8yW6BGNyhOC4qYFnwF1nKfD3HFAIXA5c45RrIG1ub11GiXeYd1xA==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT" - }, - "node_modules/micromark-util-normalize-identifier": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-2.0.1.tgz", - "integrity": "sha512-sxPqmo70LyARJs0w2UclACPUUEqltCkJ6PhKdMIDuJ3gSf/Q+/GIe3WKl0Ijb/GyH9lOpUkRAO2wp0GVkLvS9Q==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "micromark-util-symbol": "^2.0.0" - } - }, - "node_modules/micromark-util-resolve-all": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-2.0.1.tgz", - "integrity": "sha512-VdQyxFWFT2/FGJgwQnJYbe1jjQoNTS4RjglmSjTUlpUMa95Htx9NHeYW4rGDJzbjvCsl9eLjMQwGeElsqmzcHg==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-util-sanitize-uri": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz", - "integrity": "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "micromark-util-character": "^2.0.0", - "micromark-util-encode": "^2.0.0", - "micromark-util-symbol": "^2.0.0" - } - }, - "node_modules/micromark-util-subtokenize": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-2.1.0.tgz", - "integrity": "sha512-XQLu552iSctvnEcgXw6+Sx75GflAPNED1qx7eBJ+wydBb2KCbRZe+NwvIEEMM83uml1+2WSXpBAcp9IUCgCYWA==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "devlop": "^1.0.0", - "micromark-util-chunked": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-util-symbol": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz", - "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT" - }, - "node_modules/micromark-util-types": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.2.tgz", - "integrity": "sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT" - }, - "node_modules/mrmime": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.1.tgz", - "integrity": "sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ==", - "license": "MIT", - "engines": { - "node": ">=10" - } - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "license": "MIT" - }, - "node_modules/nanoid": { - "version": "3.3.18", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.18.tgz", - "integrity": "sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/neotraverse": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/neotraverse/-/neotraverse-1.0.1.tgz", - "integrity": "sha512-WmmLty1YWwJl9yZi77v2dVIV6X2kuYV8YYBI/G3LWGKdGHmHUvL1z7FW0iDvEvGAwNEoc5x1tOOOyDnf5jJw/w==", - "license": "MIT", - "engines": { - "node": ">= 10" - } - }, - "node_modules/nlcst-to-string": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/nlcst-to-string/-/nlcst-to-string-4.0.0.tgz", - "integrity": "sha512-YKLBCcUYKAg0FNlOBT6aI91qFmSiFKiluk655WzPF+DDMA02qIyy8uiRqI8QXtcFpEvll12LpL5MXqEmAZ+dcA==", - "license": "MIT", - "dependencies": { - "@types/nlcst": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/node-fetch-native": { - "version": "1.6.7", - "resolved": "https://registry.npmjs.org/node-fetch-native/-/node-fetch-native-1.6.7.tgz", - "integrity": "sha512-g9yhqoedzIUm0nTnTqAQvueMPVOuIY16bqgAJJC8XOOubYFNwz6IER9qs0Gq2Xd0+CecCKFjtdDTMA4u4xG06Q==", - "license": "MIT" - }, - "node_modules/node-mock-http": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/node-mock-http/-/node-mock-http-1.0.4.tgz", - "integrity": "sha512-8DY+kFsDkNXy1sJglUfuODx1/opAGJGyrTuFqEoN90oRc2Vk0ZbD4K2qmKXBBEhZQzdKHIVfEJpDU8Ak2NJEvQ==", - "license": "MIT" - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/nth-check": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", - "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", - "license": "BSD-2-Clause", - "dependencies": { - "boolbase": "^1.0.0" - }, - "funding": { - "url": "https://github.com/fb55/nth-check?sponsor=1" - } - }, - "node_modules/obug": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.3.tgz", - "integrity": "sha512-9miFgM2OFba7hB+pRgvtV84pYTBaoTHohvmIgiRt6dRIzbwEOIaNaP+dIlGs2fNFoB0SeISs0Jz5WFVRid6Xyg==", - "funding": [ - "https://github.com/sponsors/sxzz", - "https://opencollective.com/debug" - ], - "license": "MIT", - "engines": { - "node": ">=12.20.0" - } - }, - "node_modules/ofetch": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/ofetch/-/ofetch-1.5.1.tgz", - "integrity": "sha512-2W4oUZlVaqAPAil6FUg/difl6YhqhUR7x2eZY4bQCko22UXg3hptq9KLQdqFClV+Wu85UX7hNtdGTngi/1BxcA==", - "license": "MIT", - "dependencies": { - "destr": "^2.0.5", - "node-fetch-native": "^1.6.7", - "ufo": "^1.6.1" - } - }, - "node_modules/ohash": { - "version": "2.0.11", - "resolved": "https://registry.npmjs.org/ohash/-/ohash-2.0.11.tgz", - "integrity": "sha512-RdR9FQrFwNBNXAr4GixM8YaRZRJ5PUWbKYbE5eOsrwAjJW0q2REGcf79oYPsLyskQCZG1PLN+S/K1V00joZAoQ==", - "license": "MIT" - }, - "node_modules/oniguruma-parser": { - "version": "0.12.2", - "resolved": "https://registry.npmjs.org/oniguruma-parser/-/oniguruma-parser-0.12.2.tgz", - "integrity": "sha512-6HVa5oIrgMC6aA6WF6XyyqbhRPJrKR02L20+2+zpDtO5QAzGHAUGw5TKQvwi5vctNnRHkJYmjAhRVQF2EKdTQw==", - "license": "MIT" - }, - "node_modules/oniguruma-to-es": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-4.3.6.tgz", - "integrity": "sha512-csuQ9x3Yr0cEIs/Zgx/OEt9iBw9vqIunAPQkx19R/fiMq2oGVTgcMqO/V3Ybqefr1TBvosI6jU539ksaBULJyA==", - "license": "MIT", - "dependencies": { - "oniguruma-parser": "^0.12.2", - "regex": "^6.1.0", - "regex-recursion": "^6.0.2" - } - }, - "node_modules/p-limit": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-7.3.0.tgz", - "integrity": "sha512-7cIXg/Z0M5WZRblrsOla88S4wAK+zOQQWeBYfV3qJuJXMr+LnbYjaadrFaS0JILfEDPVqHyKnZ1Z/1d6J9VVUw==", - "license": "MIT", - "dependencies": { - "yocto-queue": "^1.2.1" - }, - "engines": { - "node": ">=20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-queue": { - "version": "9.3.1", - "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-9.3.1.tgz", - "integrity": "sha512-POWdiIPmsUPGwb4FeQ4OBg46aqmcInSWe45CKDsGHiOBiVQM9chqfQTuqhuTzcg2Vz9faTI65at0KkVyVEiCHw==", - "license": "MIT", - "dependencies": { - "eventemitter3": "^5.0.4", - "p-timeout": "^7.0.0" - }, - "engines": { - "node": ">=20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-timeout": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-7.0.1.tgz", - "integrity": "sha512-AxTM2wDGORHGEkPCt8yqxOTMgpfbEHqF51f/5fJCmwFC3C/zNcGT63SymH2ttOAaiIws2zVg4+izQCjrakcwHg==", - "license": "MIT", - "engines": { - "node": ">=20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/package-manager-detector": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/package-manager-detector/-/package-manager-detector-1.7.0.tgz", - "integrity": "sha512-xg1eHpwYL/D/HEdWw2goFZP6vV0FH7W+PZ5rFkGjdIDLtxq7EkzBUeT3m+lndYCt8wKbmofUu1MUdMCXkCk9ZQ==", - "license": "MIT" - }, - "node_modules/pagefind": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/pagefind/-/pagefind-1.5.2.tgz", - "integrity": "sha512-XTUaK0hXMCu2jszWE584JGQT7y284TmMV9l/HX3rnG5uo3rHI/uHU56XTyyyPFjeWEBxECbAi0CaFDJOONtG0Q==", - "license": "MIT", - "bin": { - "pagefind": "lib/runner/bin.cjs" - }, - "optionalDependencies": { - "@pagefind/darwin-arm64": "1.5.2", - "@pagefind/darwin-x64": "1.5.2", - "@pagefind/freebsd-x64": "1.5.2", - "@pagefind/linux-arm64": "1.5.2", - "@pagefind/linux-x64": "1.5.2", - "@pagefind/windows-arm64": "1.5.2", - "@pagefind/windows-x64": "1.5.2" - } - }, - "node_modules/parse-entities": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-4.0.2.tgz", - "integrity": "sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw==", - "license": "MIT", - "dependencies": { - "@types/unist": "^2.0.0", - "character-entities-legacy": "^3.0.0", - "character-reference-invalid": "^2.0.0", - "decode-named-character-reference": "^1.0.0", - "is-alphanumerical": "^2.0.0", - "is-decimal": "^2.0.0", - "is-hexadecimal": "^2.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/parse-entities/node_modules/@types/unist": { - "version": "2.0.11", - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz", - "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==", - "license": "MIT" - }, - "node_modules/parse-latin": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/parse-latin/-/parse-latin-7.0.0.tgz", - "integrity": "sha512-mhHgobPPua5kZ98EF4HWiH167JWBfl4pvAIXXdbaVohtK7a6YBOy56kvhCqduqyo/f3yrHFWmqmiMg/BkBkYYQ==", - "license": "MIT", - "dependencies": { - "@types/nlcst": "^2.0.0", - "@types/unist": "^3.0.0", - "nlcst-to-string": "^4.0.0", - "unist-util-modify-children": "^4.0.0", - "unist-util-visit-children": "^3.0.0", - "vfile": "^6.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/parse5": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz", - "integrity": "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==", - "license": "MIT", - "dependencies": { - "entities": "^6.0.0" - }, - "funding": { - "url": "https://github.com/inikulin/parse5?sponsor=1" - } - }, - "node_modules/piccolore": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/piccolore/-/piccolore-0.1.3.tgz", - "integrity": "sha512-o8bTeDWjE086iwKrROaDf31K0qC/BENdm15/uH9usSC/uZjJOKb2YGiVHfLY4GhwsERiPI1jmwI2XrA7ACOxVw==", - "license": "ISC" - }, - "node_modules/picocolors": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", - "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", - "license": "ISC" - }, - "node_modules/picomatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz", - "integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/postcss": { - "version": "8.5.25", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.25.tgz", - "integrity": "sha512-DTPx3RWSSnWyzLxQnlH0rJP+EW5ekl16ZU4/psbIhA0e53kJfdgaN5vKM+xP7yJtXVu+nfdVFmlgFDEKAe4Pyw==", - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "nanoid": "^3.3.16", - "picocolors": "^1.1.1", - "source-map-js": "^1.2.1" - }, - "engines": { - "node": "^10 || ^12 || >=14" - } - }, - "node_modules/postcss-nested": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-6.2.0.tgz", - "integrity": "sha512-HQbt28KulC5AJzG+cZtj9kvKB93CFCdLvog1WFLf1D+xmMvPGlBstkpTEZfK5+AN9hfJocyBFCNiqyS48bpgzQ==", - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "postcss-selector-parser": "^6.1.1" - }, - "engines": { - "node": ">=12.0" - }, - "peerDependencies": { - "postcss": "^8.2.14" - } - }, - "node_modules/postcss-selector-parser": { - "version": "6.1.4", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.4.tgz", - "integrity": "sha512-bIoJLOmjCO1S9XdY/DcnR5hJxvrDir1PbGChrzXG3vw0/FOliy/fA3dmdhQ441kah4gKv+TwckGzex6wNS5cnQ==", - "license": "MIT", - "dependencies": { - "cssesc": "^3.0.0", - "util-deprecate": "^1.0.2" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/prismjs": { - "version": "1.30.0", - "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.30.0.tgz", - "integrity": "sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/process-ancestry": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/process-ancestry/-/process-ancestry-0.1.0.tgz", - "integrity": "sha512-tGqJW/UnclpYASFcM6Xh8D8l/BMtaQ9+CSG0vlJSJTcdMM4lDRv4c6H0Pdcsfted+bVczdYSfk2fdukg2gQkZg==", - "license": "MIT", - "engines": { - "node": ">=18.0.0" - } - }, - "node_modules/property-information": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.2.0.tgz", - "integrity": "sha512-IAtzIB6sUiWaJYrX9smp3V46pBGbBeLFRGdh25kg1334VcBlD8HzhPeNIWQH9zhGmo2itIe25EHt9dQP7G5hmg==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/radix3": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/radix3/-/radix3-1.1.2.tgz", - "integrity": "sha512-b484I/7b8rDEdSDKckSSBA8knMpcdsXudlE/LNL639wFoHKwLbEkQFZHWEYwDC0wa0FKUcCY+GAF73Z7wxNVFA==", - "license": "MIT" - }, - "node_modules/readdirp": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-5.0.0.tgz", - "integrity": "sha512-9u/XQ1pvrQtYyMpZe7DXKv2p5CNvyVwzUB6uhLAnQwHMSgKMBR62lc7AHljaeteeHXn11XTAaLLUVZYVZyuRBQ==", - "license": "MIT", - "engines": { - "node": ">= 20.19.0" - }, - "funding": { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/recma-build-jsx": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/recma-build-jsx/-/recma-build-jsx-1.0.0.tgz", - "integrity": "sha512-8GtdyqaBcDfva+GUKDr3nev3VpKAhup1+RvkMvUxURHpW7QyIvk9F5wz7Vzo06CEMSilw6uArgRqhpiUcWp8ew==", - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0", - "estree-util-build-jsx": "^3.0.0", - "vfile": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/recma-jsx": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/recma-jsx/-/recma-jsx-1.0.1.tgz", - "integrity": "sha512-huSIy7VU2Z5OLv6oFLosQGGDqPqdO1iq6bWNAdhzMxSJP7RAso4fCZ1cKu8j9YHCZf3TPrq4dw3okhrylgcd7w==", - "license": "MIT", - "dependencies": { - "acorn-jsx": "^5.0.0", - "estree-util-to-js": "^2.0.0", - "recma-parse": "^1.0.0", - "recma-stringify": "^1.0.0", - "unified": "^11.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - }, - "peerDependencies": { - "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, - "node_modules/recma-parse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/recma-parse/-/recma-parse-1.0.0.tgz", - "integrity": "sha512-OYLsIGBB5Y5wjnSnQW6t3Xg7q3fQ7FWbw/vcXtORTnyaSFscOtABg+7Pnz6YZ6c27fG1/aN8CjfwoUEUIdwqWQ==", - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0", - "esast-util-from-js": "^2.0.0", - "unified": "^11.0.0", - "vfile": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/recma-stringify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/recma-stringify/-/recma-stringify-1.0.0.tgz", - "integrity": "sha512-cjwII1MdIIVloKvC9ErQ+OgAtwHBmcZ0Bg4ciz78FtbT8In39aAYbaA7zvxQ61xVMSPE8WxhLwLbhif4Js2C+g==", - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0", - "estree-util-to-js": "^2.0.0", - "unified": "^11.0.0", - "vfile": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/regex": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/regex/-/regex-6.1.0.tgz", - "integrity": "sha512-6VwtthbV4o/7+OaAF9I5L5V3llLEsoPyq9P1JVXkedTP33c7MfCG0/5NOPcSJn0TzXcG9YUrR0gQSWioew3LDg==", - "license": "MIT", - "dependencies": { - "regex-utilities": "^2.3.0" - } - }, - "node_modules/regex-recursion": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/regex-recursion/-/regex-recursion-6.0.2.tgz", - "integrity": "sha512-0YCaSCq2VRIebiaUviZNs0cBz1kg5kVS2UKUfNIx8YVs1cN3AV7NTctO5FOKBA+UT2BPJIWZauYHPqJODG50cg==", - "license": "MIT", - "dependencies": { - "regex-utilities": "^2.3.0" - } - }, - "node_modules/regex-utilities": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/regex-utilities/-/regex-utilities-2.3.0.tgz", - "integrity": "sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng==", - "license": "MIT" - }, - "node_modules/rehype": { - "version": "13.0.2", - "resolved": "https://registry.npmjs.org/rehype/-/rehype-13.0.2.tgz", - "integrity": "sha512-j31mdaRFrwFRUIlxGeuPXXKWQxet52RBQRvCmzl5eCefn/KGbomK5GMHNMsOJf55fgo3qw5tST5neDuarDYR2A==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "rehype-parse": "^9.0.0", - "rehype-stringify": "^10.0.0", - "unified": "^11.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/rehype-expressive-code": { - "version": "0.44.0", - "resolved": "https://registry.npmjs.org/rehype-expressive-code/-/rehype-expressive-code-0.44.0.tgz", - "integrity": "sha512-5r74C5F2sMR3X+QJH8OKWgZBO/cqRw5W1fLT6GVlSfLqepk+4j8tGFkyPqZYWjwntsBHzKPDH2zI68sZ7ScLfA==", - "license": "MIT", - "dependencies": { - "expressive-code": "^0.44.0" - } - }, - "node_modules/rehype-format": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/rehype-format/-/rehype-format-5.0.1.tgz", - "integrity": "sha512-zvmVru9uB0josBVpr946OR8ui7nJEdzZobwLOOqHb/OOD88W0Vk2SqLwoVOj0fM6IPCCO6TaV9CvQvJMWwukFQ==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "hast-util-format": "^1.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/rehype-parse": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/rehype-parse/-/rehype-parse-9.0.1.tgz", - "integrity": "sha512-ksCzCD0Fgfh7trPDxr2rSylbwq9iYDkSn8TCDmEJ49ljEUBxDVCzCHv7QNzZOfODanX4+bWQ4WZqLCRWYLfhag==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "hast-util-from-html": "^2.0.0", - "unified": "^11.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/rehype-raw": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/rehype-raw/-/rehype-raw-7.0.0.tgz", - "integrity": "sha512-/aE8hCfKlQeA8LmyeyQvQF3eBiLRGNlfBJEvWH7ivp9sBqs7TNqBL5X3v157rM4IFETqDnIOO+z5M/biZbo9Ww==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "hast-util-raw": "^9.0.0", - "vfile": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/rehype-recma": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/rehype-recma/-/rehype-recma-1.0.0.tgz", - "integrity": "sha512-lqA4rGUf1JmacCNWWZx0Wv1dHqMwxzsDWYMTowuplHF3xH0N/MmrZ/G3BDZnzAkRmxDadujCjaKM2hqYdCBOGw==", - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0", - "@types/hast": "^3.0.0", - "hast-util-to-estree": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/rehype-stringify": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/rehype-stringify/-/rehype-stringify-10.0.1.tgz", - "integrity": "sha512-k9ecfXHmIPuFVI61B9DeLPN0qFHfawM6RsuX48hoqlaKSF61RskNjSm1lI8PhBEM0MRdLxVVm4WmTqJQccH9mA==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "hast-util-to-html": "^9.0.0", - "unified": "^11.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-directive": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-directive/-/remark-directive-4.0.0.tgz", - "integrity": "sha512-7sxn4RfF1o3izevPV1DheyGDD6X4c9hrGpfdUpm7uC++dqrnJxIZVkk7CoKqcLm0VUMAuOol7Mno3m6g8cfMuA==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "mdast-util-directive": "^3.0.0", - "micromark-extension-directive": "^4.0.0", - "unified": "^11.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-gfm": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/remark-gfm/-/remark-gfm-4.0.1.tgz", - "integrity": "sha512-1quofZ2RQ9EWdeN34S79+KExV1764+wCUGop5CPL1WGdD0ocPpu91lzPGbwWMECpEpd42kJGQwzRfyov9j4yNg==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "mdast-util-gfm": "^3.0.0", - "micromark-extension-gfm": "^3.0.0", - "remark-parse": "^11.0.0", - "remark-stringify": "^11.0.0", - "unified": "^11.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-mdx": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/remark-mdx/-/remark-mdx-3.1.1.tgz", - "integrity": "sha512-Pjj2IYlUY3+D8x00UJsIOg5BEvfMyeI+2uLPn9VO9Wg4MEtN/VTIq2NEJQfde9PnX15KgtHyl9S0BcTnWrIuWg==", - "license": "MIT", - "dependencies": { - "mdast-util-mdx": "^3.0.0", - "micromark-extension-mdxjs": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-parse": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-11.0.0.tgz", - "integrity": "sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "mdast-util-from-markdown": "^2.0.0", - "micromark-util-types": "^2.0.0", - "unified": "^11.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-rehype": { - "version": "11.1.2", - "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-11.1.2.tgz", - "integrity": "sha512-Dh7l57ianaEoIpzbp0PC9UKAdCSVklD8E5Rpw7ETfbTl3FqcOOgq5q2LVDhgGCkaBv7p24JXikPdvhhmHvKMsw==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "@types/mdast": "^4.0.0", - "mdast-util-to-hast": "^13.0.0", - "unified": "^11.0.0", - "vfile": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-smartypants": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/remark-smartypants/-/remark-smartypants-3.0.2.tgz", - "integrity": "sha512-ILTWeOriIluwEvPjv67v7Blgrcx+LZOkAUVtKI3putuhlZm84FnqDORNXPPm+HY3NdZOMhyDwZ1E+eZB/Df5dA==", - "license": "MIT", - "dependencies": { - "retext": "^9.0.0", - "retext-smartypants": "^6.0.0", - "unified": "^11.0.4", - "unist-util-visit": "^5.0.0" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/remark-stringify": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-11.0.0.tgz", - "integrity": "sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "mdast-util-to-markdown": "^2.0.0", - "unified": "^11.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/resolve-pkg-maps": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", - "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", - "license": "MIT", - "funding": { - "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" - } - }, - "node_modules/retext": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/retext/-/retext-9.0.0.tgz", - "integrity": "sha512-sbMDcpHCNjvlheSgMfEcVrZko3cDzdbe1x/e7G66dFp0Ff7Mldvi2uv6JkJQzdRcvLYE8CA8Oe8siQx8ZOgTcA==", - "license": "MIT", - "dependencies": { - "@types/nlcst": "^2.0.0", - "retext-latin": "^4.0.0", - "retext-stringify": "^4.0.0", - "unified": "^11.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/retext-latin": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/retext-latin/-/retext-latin-4.0.0.tgz", - "integrity": "sha512-hv9woG7Fy0M9IlRQloq/N6atV82NxLGveq+3H2WOi79dtIYWN8OaxogDm77f8YnVXJL2VD3bbqowu5E3EMhBYA==", - "license": "MIT", - "dependencies": { - "@types/nlcst": "^2.0.0", - "parse-latin": "^7.0.0", - "unified": "^11.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/retext-smartypants": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/retext-smartypants/-/retext-smartypants-6.2.0.tgz", - "integrity": "sha512-kk0jOU7+zGv//kfjXEBjdIryL1Acl4i9XNkHxtM7Tm5lFiCog576fjNC9hjoR7LTKQ0DsPWy09JummSsH1uqfQ==", - "license": "MIT", - "dependencies": { - "@types/nlcst": "^2.0.0", - "nlcst-to-string": "^4.0.0", - "unist-util-visit": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/retext-stringify": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/retext-stringify/-/retext-stringify-4.0.0.tgz", - "integrity": "sha512-rtfN/0o8kL1e+78+uxPTqu1Klt0yPzKuQ2BfWwwfgIUSayyzxpM1PJzkKt4V8803uB9qSy32MvI7Xep9khTpiA==", - "license": "MIT", - "dependencies": { - "@types/nlcst": "^2.0.0", - "nlcst-to-string": "^4.0.0", - "unified": "^11.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/rolldown": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.1.4.tgz", - "integrity": "sha512-IjZYiLxZwpnhwhdBH2ugdTGVSdhCQUmLxLoqyjiL0JxYjyRst+5a0P3xfrTxJ5F638j4Mvvw5FAX5XE6eHpXbA==", - "license": "MIT", - "dependencies": { - "@oxc-project/types": "=0.138.0", - "@rolldown/pluginutils": "^1.0.0" - }, - "bin": { - "rolldown": "bin/cli.mjs" - }, - "engines": { - "node": "^20.19.0 || >=22.12.0" - }, - "optionalDependencies": { - "@rolldown/binding-android-arm64": "1.1.4", - "@rolldown/binding-darwin-arm64": "1.1.4", - "@rolldown/binding-darwin-x64": "1.1.4", - "@rolldown/binding-freebsd-x64": "1.1.4", - "@rolldown/binding-linux-arm-gnueabihf": "1.1.4", - "@rolldown/binding-linux-arm64-gnu": "1.1.4", - "@rolldown/binding-linux-arm64-musl": "1.1.4", - "@rolldown/binding-linux-ppc64-gnu": "1.1.4", - "@rolldown/binding-linux-s390x-gnu": "1.1.4", - "@rolldown/binding-linux-x64-gnu": "1.1.4", - "@rolldown/binding-linux-x64-musl": "1.1.4", - "@rolldown/binding-openharmony-arm64": "1.1.4", - "@rolldown/binding-wasm32-wasi": "1.1.4", - "@rolldown/binding-win32-arm64-msvc": "1.1.4", - "@rolldown/binding-win32-x64-msvc": "1.1.4" - } - }, - "node_modules/satteri": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/satteri/-/satteri-0.9.4.tgz", - "integrity": "sha512-BKob126Tay84diOZsnVNH/Q/c+3njPJTCad3w5zLKa6j8bVjxskPNHDtxrMwYK4bN/RlqUSdMnPwKY4k65EMOQ==", - "dependencies": { - "@types/estree-jsx": "^1.0.5", - "@types/hast": "^3.0.4", - "@types/mdast": "^4.0.4", - "@types/unist": "^3.0.3" - }, - "optionalDependencies": { - "@bruits/satteri-darwin-arm64": "0.9.4", - "@bruits/satteri-darwin-x64": "0.9.4", - "@bruits/satteri-linux-arm64-gnu": "0.9.4", - "@bruits/satteri-linux-arm64-musl": "0.9.4", - "@bruits/satteri-linux-x64-gnu": "0.9.4", - "@bruits/satteri-linux-x64-musl": "0.9.4", - "@bruits/satteri-wasm32-wasi": "0.9.4", - "@bruits/satteri-win32-arm64-msvc": "0.9.4", - "@bruits/satteri-win32-x64-msvc": "0.9.4" - } - }, - "node_modules/sax": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.6.0.tgz", - "integrity": "sha512-6R3J5M4AcbtLUdZmRv2SygeVaM7IhrLXu9BmnOGmmACak8fiUtOsYNWUS4uK7upbmHIBbLBeFeI//477BKLBzA==", - "license": "BlueOak-1.0.0", - "engines": { - "node": ">=11.0.0" - } - }, - "node_modules/semver": { - "version": "7.8.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", - "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/sharp": { - "version": "0.35.3", - "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.35.3.tgz", - "integrity": "sha512-ej0zVHuZGHCiABXcNxeYhpRnPNPAcvbG8RMdBAhDAxLKkCRVSpK3Iyu7qbqw3JMzoj0REeM6f3tJLtVwl0023Q==", - "license": "Apache-2.0", - "dependencies": { - "@img/colour": "^1.1.0", - "detect-libc": "^2.1.2", - "semver": "^7.8.5" - }, - "engines": { - "node": ">=20.9.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-darwin-arm64": "0.35.3", - "@img/sharp-darwin-x64": "0.35.3", - "@img/sharp-freebsd-wasm32": "0.35.3", - "@img/sharp-libvips-darwin-arm64": "1.3.2", - "@img/sharp-libvips-darwin-x64": "1.3.2", - "@img/sharp-libvips-linux-arm": "1.3.2", - "@img/sharp-libvips-linux-arm64": "1.3.2", - "@img/sharp-libvips-linux-ppc64": "1.3.2", - "@img/sharp-libvips-linux-riscv64": "1.3.2", - "@img/sharp-libvips-linux-s390x": "1.3.2", - "@img/sharp-libvips-linux-x64": "1.3.2", - "@img/sharp-libvips-linuxmusl-arm64": "1.3.2", - "@img/sharp-libvips-linuxmusl-x64": "1.3.2", - "@img/sharp-linux-arm": "0.35.3", - "@img/sharp-linux-arm64": "0.35.3", - "@img/sharp-linux-ppc64": "0.35.3", - "@img/sharp-linux-riscv64": "0.35.3", - "@img/sharp-linux-s390x": "0.35.3", - "@img/sharp-linux-x64": "0.35.3", - "@img/sharp-linuxmusl-arm64": "0.35.3", - "@img/sharp-linuxmusl-x64": "0.35.3", - "@img/sharp-webcontainers-wasm32": "0.35.3", - "@img/sharp-win32-arm64": "0.35.3", - "@img/sharp-win32-ia32": "0.35.3", - "@img/sharp-win32-x64": "0.35.3" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - } - } - }, - "node_modules/shiki": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-4.3.1.tgz", - "integrity": "sha512-oR+qDVi2OjX1tmDpyv+3KviX01KzO6Af+0NNnKnsp9491UEGz2YpxTuJboS/6VhYpTdqzmuJBuiTlrAWWJAssw==", - "license": "MIT", - "dependencies": { - "@shikijs/core": "4.3.1", - "@shikijs/engine-javascript": "4.3.1", - "@shikijs/engine-oniguruma": "4.3.1", - "@shikijs/langs": "4.3.1", - "@shikijs/themes": "4.3.1", - "@shikijs/types": "4.3.1", - "@shikijs/vscode-textmate": "^10.0.2", - "@types/hast": "^3.0.4" - }, - "engines": { - "node": ">=20" - } - }, - "node_modules/sisteransi": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", - "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", - "license": "MIT" - }, - "node_modules/sitemap": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/sitemap/-/sitemap-9.0.1.tgz", - "integrity": "sha512-S6hzjGJSG3d6if0YoF5kTyeRJvia6FSTBroE5fQ0bu1QNxyJqhhinfUsXi9fH3MgtXODWvwo2BDyQSnhPQ88uQ==", - "license": "MIT", - "dependencies": { - "@types/node": "^24.9.2", - "@types/sax": "^1.2.1", - "arg": "^5.0.0", - "sax": "^1.4.1" - }, - "bin": { - "sitemap": "dist/esm/cli.js" - }, - "engines": { - "node": ">=20.19.5", - "npm": ">=10.8.2" - } - }, - "node_modules/smol-toml": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.7.0.tgz", - "integrity": "sha512-aqVvWoyO21L23mb+drl4RmMXbf6N7FdHjAhTRA9ZBL7apWBgfWC16KjrASI+1p9GAroljyMHj6fK67i0UiTNvQ==", - "license": "BSD-3-Clause", - "engines": { - "node": ">= 18" - }, - "funding": { - "url": "https://github.com/sponsors/cyyynthia" - } - }, - "node_modules/source-map": { - "version": "0.7.6", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.6.tgz", - "integrity": "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==", - "license": "BSD-3-Clause", - "engines": { - "node": ">= 12" - } - }, - "node_modules/source-map-js": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", - "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/space-separated-tokens": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", - "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/stream-replace-string": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/stream-replace-string/-/stream-replace-string-2.0.0.tgz", - "integrity": "sha512-TlnjJ1C0QrmxRNrON00JvaFFlNh5TTG00APw23j74ET7gkQpTASi6/L2fuiav8pzK715HXtUeClpBTw2NPSn6w==", - "license": "MIT" - }, - "node_modules/stringify-entities": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", - "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", - "license": "MIT", - "dependencies": { - "character-entities-html4": "^2.0.0", - "character-entities-legacy": "^3.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/style-to-js": { - "version": "1.1.21", - "resolved": "https://registry.npmjs.org/style-to-js/-/style-to-js-1.1.21.tgz", - "integrity": "sha512-RjQetxJrrUJLQPHbLku6U/ocGtzyjbJMP9lCNK7Ag0CNh690nSH8woqWH9u16nMjYBAok+i7JO1NP2pOy8IsPQ==", - "license": "MIT", - "dependencies": { - "style-to-object": "1.0.14" - } - }, - "node_modules/style-to-object": { - "version": "1.0.14", - "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-1.0.14.tgz", - "integrity": "sha512-LIN7rULI0jBscWQYaSswptyderlarFkjQ+t79nzty8tcIAceVomEVlLzH5VP4Cmsv6MtKhs7qaAiwlcp+Mgaxw==", - "license": "MIT", - "dependencies": { - "inline-style-parser": "0.2.7" - } - }, - "node_modules/svgo": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/svgo/-/svgo-4.0.2.tgz", - "integrity": "sha512-ekx94z1rRc5LDi6oSUaeRnYhd0UOJxdtQCL2rF8xpWxD3TPAsISWOrxezqGovqS38GRZOdpDfvQe3ts6F7nsng==", - "license": "MIT", - "dependencies": { - "commander": "^11.1.0", - "css-select": "^5.1.0", - "css-tree": "^3.0.1", - "css-what": "^6.1.0", - "csso": "^5.0.5", - "picocolors": "^1.1.1", - "sax": "^1.5.0" - }, - "bin": { - "svgo": "bin/svgo.js" - }, - "engines": { - "node": ">=16" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/svgo" - } - }, - "node_modules/tiny-inflate": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/tiny-inflate/-/tiny-inflate-1.0.3.tgz", - "integrity": "sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==", - "license": "MIT" - }, - "node_modules/tinyclip": { - "version": "0.1.15", - "resolved": "https://registry.npmjs.org/tinyclip/-/tinyclip-0.1.15.tgz", - "integrity": "sha512-uo33abH+Ays0xYaDysoBt494Hb3hsEczMpcC0MwFl773pazORx4fmvKhclhR1wonUbB6vvpRsvVMwnhfqeMc+A==", - "license": "MIT", - "engines": { - "node": "^16.14.0 || >= 17.3.0" - } - }, - "node_modules/tinyexec": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.2.4.tgz", - "integrity": "sha512-SHf/r48b7vOrjve9PxJo3MN5v5yuyjHvdUcrQffT3WXMUfnGmHDVbC4k3sHJaJTgZCwpUplIaAo5ANtMyp3YHg==", - "license": "MIT", - "engines": { - "node": ">=18" - } - }, - "node_modules/tinyglobby": { - "version": "0.2.17", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", - "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", - "license": "MIT", - "dependencies": { - "fdir": "^6.5.0", - "picomatch": "^4.0.4" - }, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/SuperchupuDev" - } - }, - "node_modules/trim-lines": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", - "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/trough": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/trough/-/trough-2.2.0.tgz", - "integrity": "sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/tslib": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", - "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", - "license": "0BSD", - "optional": true - }, - "node_modules/ufo": { - "version": "1.6.4", - "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.4.tgz", - "integrity": "sha512-JFNbkD1Svwe0KvGi8GOeLcP4kAWQ609twvCdcHxq1oSL8svv39ZuSvajcD8B+5D0eL4+s1Is2D/O6KN3qcTeRA==", - "license": "MIT" - }, - "node_modules/ultrahtml": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/ultrahtml/-/ultrahtml-1.6.0.tgz", - "integrity": "sha512-R9fBn90VTJrqqLDwyMph+HGne8eqY1iPfYhPzZrvKpIfwkWZbcYlfpsb8B9dTvBfpy1/hqAD7Wi8EKfP9e8zdw==", - "license": "MIT" - }, - "node_modules/uncrypto": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/uncrypto/-/uncrypto-0.1.3.tgz", - "integrity": "sha512-Ql87qFHB3s/De2ClA9e0gsnS6zXG27SkTiSJwjCc9MebbfapQfuPzumMIUMi38ezPZVNFcHI9sUIepeQfw8J8Q==", - "license": "MIT" - }, - "node_modules/undici-types": { - "version": "7.18.2", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz", - "integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==", - "license": "MIT" - }, - "node_modules/unified": { - "version": "11.0.5", - "resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz", - "integrity": "sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0", - "bail": "^2.0.0", - "devlop": "^1.0.0", - "extend": "^3.0.0", - "is-plain-obj": "^4.0.0", - "trough": "^2.0.0", - "vfile": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unifont": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/unifont/-/unifont-0.7.4.tgz", - "integrity": "sha512-oHeis4/xl42HUIeHuNZRGEvxj5AaIKR+bHPNegRq5LV1gdc3jundpONbjglKpihmJf+dswygdMJn3eftGIMemg==", - "license": "MIT", - "dependencies": { - "css-tree": "^3.1.0", - "ofetch": "^1.5.1", - "ohash": "^2.0.11" - } - }, - "node_modules/unist-util-find-after": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-find-after/-/unist-util-find-after-5.0.0.tgz", - "integrity": "sha512-amQa0Ep2m6hE2g72AugUItjbuM8X8cGQnFoHk0pGfrFeT9GZhzN5SW8nRsiGKK7Aif4CrACPENkA6P/Lw6fHGQ==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0", - "unist-util-is": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-is": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.1.tgz", - "integrity": "sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-modify-children": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-modify-children/-/unist-util-modify-children-4.0.0.tgz", - "integrity": "sha512-+tdN5fGNddvsQdIzUF3Xx82CU9sMM+fA0dLgR9vOmT0oPT2jH+P1nd5lSqfCfXAw+93NhcXNY2qqvTUtE4cQkw==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0", - "array-iterate": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-position": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz", - "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-position-from-estree": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unist-util-position-from-estree/-/unist-util-position-from-estree-2.0.0.tgz", - "integrity": "sha512-KaFVRjoqLyF6YXCbVLNad/eS4+OfPQQn2yOd7zF/h5T/CSL2v8NpN6a5TPvtbXthAGw5nG+PuTtq+DdIZr+cRQ==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-remove-position": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-5.0.0.tgz", - "integrity": "sha512-Hp5Kh3wLxv0PHj9m2yZhhLt58KzPtEYKQQ4yxfYFEO7EvHwzyDYnduhHnY1mDxoqr7VUwVuHXk9RXKIiYS1N8Q==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0", - "unist-util-visit": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-stringify-position": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz", - "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-visit": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.1.0.tgz", - "integrity": "sha512-m+vIdyeCOpdr/QeQCu2EzxX/ohgS8KbnPDgFni4dQsfSCtpz8UqDyY5GjRru8PDKuYn7Fq19j1CQ+nJSsGKOzg==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0", - "unist-util-is": "^6.0.0", - "unist-util-visit-parents": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-visit-children": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-children/-/unist-util-visit-children-3.0.0.tgz", - "integrity": "sha512-RgmdTfSBOg04sdPcpTSD1jzoNBjt9a80/ZCzp5cI9n1qPzLZWF9YdvWGN2zmTumP1HWhXKdUWexjy/Wy/lJ7tA==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-visit-parents": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.2.tgz", - "integrity": "sha512-goh1s1TBrqSqukSc8wrjwWhL0hiJxgA8m4kFxGlQ+8FYQ3C/m11FcTs4YYem7V664AhHVvgoQLk890Ssdsr2IQ==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0", - "unist-util-is": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unstorage": { - "version": "1.17.5", - "resolved": "https://registry.npmjs.org/unstorage/-/unstorage-1.17.5.tgz", - "integrity": "sha512-0i3iqvRfx29hkNntHyQvJTpf5W9dQ9ZadSoRU8+xVlhVtT7jAX57fazYO9EHvcRCfBCyi5YRya7XCDOsbTgkPg==", - "license": "MIT", - "dependencies": { - "anymatch": "^3.1.3", - "chokidar": "^5.0.0", - "destr": "^2.0.5", - "h3": "^1.15.10", - "lru-cache": "^11.2.7", - "node-fetch-native": "^1.6.7", - "ofetch": "^1.5.1", - "ufo": "^1.6.3" - }, - "peerDependencies": { - "@azure/app-configuration": "^1.8.0", - "@azure/cosmos": "^4.2.0", - "@azure/data-tables": "^13.3.0", - "@azure/identity": "^4.6.0", - "@azure/keyvault-secrets": "^4.9.0", - "@azure/storage-blob": "^12.26.0", - "@capacitor/preferences": "^6 || ^7 || ^8", - "@deno/kv": ">=0.9.0", - "@netlify/blobs": "^6.5.0 || ^7.0.0 || ^8.1.0 || ^9.0.0 || ^10.0.0", - "@planetscale/database": "^1.19.0", - "@upstash/redis": "^1.34.3", - "@vercel/blob": ">=0.27.1", - "@vercel/functions": "^2.2.12 || ^3.0.0", - "@vercel/kv": "^1 || ^2 || ^3", - "aws4fetch": "^1.0.20", - "db0": ">=0.2.1", - "idb-keyval": "^6.2.1", - "ioredis": "^5.4.2", - "uploadthing": "^7.4.4" - }, - "peerDependenciesMeta": { - "@azure/app-configuration": { - "optional": true - }, - "@azure/cosmos": { - "optional": true - }, - "@azure/data-tables": { - "optional": true - }, - "@azure/identity": { - "optional": true - }, - "@azure/keyvault-secrets": { - "optional": true - }, - "@azure/storage-blob": { - "optional": true - }, - "@capacitor/preferences": { - "optional": true - }, - "@deno/kv": { - "optional": true - }, - "@netlify/blobs": { - "optional": true - }, - "@planetscale/database": { - "optional": true - }, - "@upstash/redis": { - "optional": true - }, - "@vercel/blob": { - "optional": true - }, - "@vercel/functions": { - "optional": true - }, - "@vercel/kv": { - "optional": true - }, - "aws4fetch": { - "optional": true - }, - "db0": { - "optional": true - }, - "idb-keyval": { - "optional": true - }, - "ioredis": { - "optional": true - }, - "uploadthing": { - "optional": true - } - } - }, - "node_modules/url-extras": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/url-extras/-/url-extras-0.1.0.tgz", - "integrity": "sha512-8tzwTeXFPuX/5PHuCDQE5Dd9Ts4rwoq2t9aIT+HS4iAVpmj5l4Ao7Q+BuuFjvWRqrLswBhQDk8O96ZicgCqQqw==", - "license": "MIT", - "engines": { - "node": ">=20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "license": "MIT" - }, - "node_modules/vfile": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz", - "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0", - "vfile-message": "^4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/vfile-location": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-5.0.3.tgz", - "integrity": "sha512-5yXvWDEgqeiYiBe1lbxYF7UMAIm/IcopxMHrMQDq3nvKcjPKIhZklUKL+AE7J7uApI4kwe2snsK+eI6UTj9EHg==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0", - "vfile": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/vfile-message": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.3.tgz", - "integrity": "sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0", - "unist-util-stringify-position": "^4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/vite": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/vite/-/vite-8.1.3.tgz", - "integrity": "sha512-Ds+gBRbj0lwRO2Y5hwnUBdxSwlAve9LeRyU4sNnAr0ewW0gWF0n5bgXgUzbgZ49MV9BVUAQUFYVcDUcilUExMA==", - "license": "MIT", - "dependencies": { - "lightningcss": "^1.32.0", - "picomatch": "^4.0.4", - "postcss": "^8.5.16", - "rolldown": "~1.1.3", - "tinyglobby": "^0.2.17" - }, - "bin": { - "vite": "bin/vite.js" - }, - "engines": { - "node": "^20.19.0 || >=22.12.0" - }, - "funding": { - "url": "https://github.com/vitejs/vite?sponsor=1" - }, - "optionalDependencies": { - "fsevents": "~2.3.3" - }, - "peerDependencies": { - "@types/node": "^20.19.0 || >=22.12.0", - "@vitejs/devtools": "^0.3.0", - "esbuild": "^0.27.0 || ^0.28.0", - "jiti": ">=1.21.0", - "less": "^4.0.0", - "sass": "^1.70.0", - "sass-embedded": "^1.70.0", - "stylus": ">=0.54.8", - "sugarss": "^5.0.0", - "terser": "^5.16.0", - "tsx": "^4.8.1", - "yaml": "^2.4.2" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - }, - "@vitejs/devtools": { - "optional": true - }, - "esbuild": { - "optional": true - }, - "jiti": { - "optional": true - }, - "less": { - "optional": true - }, - "sass": { - "optional": true - }, - "sass-embedded": { - "optional": true - }, - "stylus": { - "optional": true - }, - "sugarss": { - "optional": true - }, - "terser": { - "optional": true - }, - "tsx": { - "optional": true - }, - "yaml": { - "optional": true - } - } - }, - "node_modules/vitefu": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.1.3.tgz", - "integrity": "sha512-ub4okH7Z5KLjb6hDyjqrGXqWtWvoYdU3IGm/NorpgHncKoLTCfRIbvlhBm7r0YstIaQRYlp4yEbFqDcKSzXSSg==", - "license": "MIT", - "workspaces": [ - "tests/deps/*", - "tests/projects/*", - "tests/projects/workspace/packages/*" - ], - "peerDependencies": { - "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" - }, - "peerDependenciesMeta": { - "vite": { - "optional": true - } - } - }, - "node_modules/web-namespaces": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/web-namespaces/-/web-namespaces-2.0.1.tgz", - "integrity": "sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/xxhash-wasm": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/xxhash-wasm/-/xxhash-wasm-1.1.0.tgz", - "integrity": "sha512-147y/6YNh+tlp6nd/2pWq38i9h6mz/EuQ6njIrmW8D1BS5nCqs0P6DG+m6zTGnNz5I+uhZ0SHxBs9BsPrwcKDA==", - "license": "MIT" - }, - "node_modules/yargs-parser": { - "version": "22.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-22.0.0.tgz", - "integrity": "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==", - "license": "ISC", - "engines": { - "node": "^20.19.0 || ^22.12.0 || >=23" - } - }, - "node_modules/yocto-queue": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.2.2.tgz", - "integrity": "sha512-4LCcse/U2MHZ63HAJVE+v71o7yOdIe4cZ70Wpf8D/IyjDKYQLV5GD46B+hSTjJsvV5PztjvHoU580EftxjDZFQ==", - "license": "MIT", - "engines": { - "node": ">=12.20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/zod": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz", - "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/colinhacks" - } - }, - "node_modules/zwitch": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", - "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - } - } -} diff --git a/website/package.json b/website/package.json deleted file mode 100644 index 36419ab..0000000 --- a/website/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "green-tea-docs", - "type": "module", - "private": true, - "scripts": { - "dev": "astro dev", - "build": "astro build", - "preview": "astro preview" - }, - "dependencies": { - "@astrojs/starlight": "^0.41.6", - "astro": "^7.1.6", - "sharp": "^0.35.3" - } -} diff --git a/website/public/favicon.svg b/website/public/favicon.svg deleted file mode 100644 index 03eb98c..0000000 --- a/website/public/favicon.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/website/src/assets/logo.svg b/website/src/assets/logo.svg deleted file mode 100644 index 03eb98c..0000000 --- a/website/src/assets/logo.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/website/src/content.config.ts b/website/src/content.config.ts deleted file mode 100644 index 6a7b7a0..0000000 --- a/website/src/content.config.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { defineCollection } from 'astro:content'; -import { docsLoader } from '@astrojs/starlight/loaders'; -import { docsSchema } from '@astrojs/starlight/schema'; - -export const collections = { - docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }), -}; diff --git a/website/src/content/docs/404.md b/website/src/content/docs/404.md deleted file mode 100644 index 0e6639c..0000000 --- a/website/src/content/docs/404.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: Page not found -description: "The requested Green Tea documentation page does not exist." -template: splash -hero: - tagline: The documentation page you requested could not be found. - actions: - - text: Back to documentation - link: /docs/ - icon: right-arrow ---- diff --git a/website/src/content/docs/concepts/flow.md b/website/src/content/docs/concepts/flow.md deleted file mode 100644 index 6348ed8..0000000 --- a/website/src/content/docs/concepts/flow.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -title: The typed flow core -description: "The functional flow API where the compile-time dependency guarantee lives." ---- - -The [decorator layer](/docs/guides/dependency-injection/) validates the graph at **boot**. The functional core, `flow`, validates it in the **type checker** — before the program ever runs. - -```typescript -import { flow } from '@green-tea/core'; - -const pipeline = flow() - .step('db', () => ({ find: (id: string) => id })) - .step('user', (ctx) => ctx.db.find('u1')); // referencing a missing 'db' would not compile -``` - -Each `.step(name, fn)` adds its output to the accumulated context **type** (`Acc & Out`). The next step's `ctx` is typed with everything produced so far — so reading `ctx.db` compiles only because a previous step provided `db`. Reference a key nothing produced and it is a **compile error**, not a runtime `undefined`. - -This is the strongest guarantee green-tea offers: the type *is* the dependency contract, checked statically. The decorator layer gives you the same graph with boot-time validation and the ergonomics of classes and decorators; `flow` gives you compile-time proof. - -:::note -`npm run typecheck` in the repo includes a type-level test that asserts this accumulation behaves — a step that reads a missing key is expected to fail compilation. -::: - -See [The dependency graph](/docs/concepts/the-graph/) for how both layers describe the same model. diff --git a/website/src/content/docs/concepts/the-graph.md b/website/src/content/docs/concepts/the-graph.md deleted file mode 100644 index c9aa75e..0000000 --- a/website/src/content/docs/concepts/the-graph.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -title: The dependency graph -description: "How green-tea models the request and boot pipeline as an explicit dependency graph." ---- - -Most frameworks make you keep the whole request in your head: which middleware ran, whether `req.user` exists by now, what order things fire in, which plugin quietly deleted your body parser. That bookkeeping is where bugs live. - -green-tea puts the request **on the page**. You declare what each unit **needs** and **produces**; the framework computes the order, checks the wiring, and can print the whole thing. - -## needs / provides - -Every node declares its inputs and outputs: - -- A **provider** produces an app-scope value (a database handle, a config object) — resolved once at boot and cached. -- A **step** reads the request context and merges new keys into it (authentication producing `user`, say) — runs per request. -- A **handler** (a route method) declares, through its argument decorators, exactly which keys it depends on. - -green-tea builds a directed graph from these declarations and **topologically sorts** it. You never write "put this before that" — order is derived from `needs`/`provides`. - -```typescript -@Step({ provides: 'user', needs: ['db', 'req'] }) // user depends on db and req -class Authenticate { /* ... */ } -``` - -## Why it matters - -- **No ordering bugs.** There's no positional `app.use()` sequence to get wrong; the sort is the order. -- **Each route runs only its slice.** A route runs the transitive closure of what its handler `@needs` (plus always-run observer steps) — an auth step doesn't run on a public route. -- **Boot fails loudly.** If a handler needs a key nothing provides, `createApp` throws at boot with a "did you mean…?" hint — you never serve `undefined`. -- **You can read it.** `app.explain(route)` prints the ordered chain with origins; `app.graph()` / `GET /__graph__` render it as a diagram. See [Graph introspection](/docs/guides/introspection/). - -## Two layers - -green-tea exposes the graph two ways: - -1. **The typed functional core, [`flow`](/docs/concepts/flow/)** — the compile-time guarantee. A handler that reads `ctx.user` fails to **compile** if no step produces `user`. -2. **The declarative decorator layer** — `@Provider` / `@Step` / `@Module` / `@Route` / `@Get` plus [argument decorators](/docs/guides/arguments/). Emits runtime metadata, builds and sorts the graph, and validates at boot. - -Both describe the same graph; pick the ergonomics you want. - -## Why legacy decorators - -green-tea uses **legacy** (experimental) TypeScript decorators — set `experimentalDecorators: true` in your `tsconfig`. This is a design decision, not inertia. - -The argument-injection API (`@param`, `@query`, `@body`, `@header`, `@needs`, `@ctx`, `@inbound`, `@abort`) relies on **parameter decorators**, and the TC39 standard decorators proposal (Stage 3) deliberately does **not** include them. There is no standards-track way to decorate a parameter today, so `handler(@param('id') id: string)` is only expressible with legacy decorators. - -"Stage 3" also means *not finalized* — the proposal can still change before engines ship it. green-tea tracks it and will revisit if parameter injection ever gets a standard path. It does **not** rely on `emitDecoratorMetadata` / `design:type` reflection — argument positions are recorded explicitly — so this is the only legacy surface it depends on. diff --git a/website/src/content/docs/getting-started.md b/website/src/content/docs/getting-started.md deleted file mode 100644 index 9a9f4a3..0000000 --- a/website/src/content/docs/getting-started.md +++ /dev/null @@ -1,95 +0,0 @@ ---- -title: Getting started -description: Install green-tea, configure TypeScript decorators, and build your first graph-based route. ---- - -## Scaffold it - -The fastest path is [matcha](/docs/guides/cli/), green-tea's CLI. It writes a project that runs on the first command — no wiring, no config: - -```bash -matcha new my-api # --runtime node (default) | deno | bun -cd my-api && matcha run -``` - -## Or install by hand - -```bash -npm install @green-tea/core reflect-metadata -# optional, only if you use them: -npm install ws # WebSocket routes (@Ws) and mesh -npm install busboy # multipart/form-data file uploads -``` - -green-tea runs on **Node ≥ 18, Deno, Bun, and the edge** — the same app, you only swap the entry point. This guide uses Node; see [runtimes](/docs/guides/runtimes/) for the others and for what the edge can't offer. - -green-tea uses **legacy** TypeScript decorators. Enable them in your `tsconfig.json`: - -```json -{ - "compilerOptions": { - "experimentalDecorators": true, - "target": "es2020", - "moduleResolution": "node" - } -} -``` - -You do **not** need `emitDecoratorMetadata` — green-tea records argument positions explicitly. See [Why legacy decorators](/docs/concepts/the-graph/#why-legacy-decorators) for the rationale. - -## Your first app - -A provider produces a value, a step transforms the request context, and a controller handler declares exactly what it needs: - -```typescript -import { - createApp, Provider, Step, Route, Get, Module, - Unauthorized, needs, param, -} from '@green-tea/core'; - -@Provider({ provides: 'db' }) -class Database { - provide() { - const users = { u1: { id: 'u1', name: 'Diego' } }; - return { db: { find: (token: string) => users[token] ?? null } }; - } -} - -@Step({ provides: 'user', needs: ['db', 'req'] }) -class Authenticate { - run(ctx) { - const user = ctx.db.find(ctx.req.headers['x-token']); - if (!user) throw new Unauthorized('invalid token'); // cut the request - return { user }; // continue - } -} - -@Route('/users') -class UserController { - @Get('/:id') - getUser(@needs('user') user, @param('id') id) { // the signature IS the contract - return { requested: id, you: user }; - } -} - -@Module({ mountpoint: '/api', providers: [Database], steps: [Authenticate], controllers: [UserController] }) -class ApiModule {} - -const app = createApp({ modules: [ApiModule] }); -console.log(app.explain('/api/users/:id')); // auditable: the ordered chain, with origins -app.listen(3000); -``` - -```bash -curl -H 'x-token: u1' http://localhost:3000/api/users/9 -# {"requested":"9","you":{"id":"u1","name":"Diego"}} -``` - -The handler asked for `user` via `@needs('user')`. If nothing in the graph produced `user`, `createApp` would **throw at boot** with a "did you mean…" hint — you never serve `undefined`. - -## Where to next - -- [The dependency graph](/docs/concepts/the-graph/) — the mental model behind everything. -- [Dependency injection](/docs/guides/dependency-injection/) — providers, steps, and modules in depth. -- [Argument decorators](/docs/guides/arguments/) — everything a handler can inject. -- [Streaming & real-time](/docs/guides/streaming/) — SSE, WebSocket, and ndjson from one primitive. diff --git a/website/src/content/docs/guides/arguments.md b/website/src/content/docs/guides/arguments.md deleted file mode 100644 index 4f00175..0000000 --- a/website/src/content/docs/guides/arguments.md +++ /dev/null @@ -1,148 +0,0 @@ ---- -title: Argument decorators -description: "Everything a handler can inject with needs, ctx, param, query, body, header, inbound, and abort." ---- - -A handler's signature declares exactly what it wants — in any order, nothing more. Each -parameter decorator injects one thing: a graph-produced value, part of the request envelope, -or a stream handle. Some decorators add a **dependency edge** to the graph (boot-validated); -most just read from the request. - -## The decorators at a glance - -| Decorator | Injects | Adds a graph dependency? | Forms | -|---|---|---|---| -| `@needs('user')` | a value produced by a provider/step (boot-validated) | **yes** | `('key')` | -| `@ctx()` | the whole accumulated context | no | `()` | -| `@param(...)` | route params | no | `()` · `('id')` · `('id', schema)` | -| `@query(...)` | parsed query string | no | `()` · `('q')` · `(['a','b'])` · `(schema)` | -| `@body(...)` | parsed body (JSON / urlencoded / multipart) | no | `()` · `('field')` · `(schema)` | -| `@headers(...)` | request headers (whole bag or picked) | no | `()` · `('authorization')` · `(['a','b'])` · `(schema)` | -| `@header('name')` | one request header (singular alias of `@headers`) | no | `('x-trace')` · `('x-count', schema)` | -| `@inbound()` | the incoming WS message channel | no (WS only) | `()` | -| `@abort()` | an `AbortSignal` that fires on disconnect | no (stream/WS) | `()` | - -## `@needs` — a graph-produced value - -`@needs('token')` injects a value a provider or step produces, and declares a dependency edge -in the graph. Its keys are **validated at boot**: if nothing provides the token, `createApp` -throws with a clear error instead of serving `undefined`. - -```typescript -getUser(@needs('user') user: any, @param('id') id: string) { - return { requested: id, you: user }; -} -``` - -See [Dependency injection](/docs/guides/dependency-injection/) for how `needs`/`provides` build the -graph. - -## `@ctx` — the whole context - -`@ctx()` hands you the entire accumulated context — everything providers and steps have merged -in, plus built-ins. Use it to read values like `ctx.protocol` and `ctx.ip` (populated when -`trustProxy` is on). - -## Envelope decorators — `@param`, `@query`, `@body`, `@headers` - -These read from the parsed request. Each envelope decorator has **three access forms**: - -- `@query()` — the whole object -- `@query('q')` — one key -- `@query(['q','date'])` — a subset - -```typescript -@Get('/:id') -getUser(@param('id') id: string) { /* ... */ } -``` - -- **`@param`** reads route params. It always needs a name to say which param it binds - (`@param('id')`). -- **`@query`** reads the parsed query string. Query values are always strings on the wire — a - schema is often the coercion point (see below). -- **`@body`** reads the parsed body. It handles `application/json`, - `application/x-www-form-urlencoded`, and `multipart/form-data` (see the multipart note). -- **`@headers`** reads request headers — the whole bag (`@headers()`), one key - (`@headers('authorization')`), or a subset (`@headers(['a','b'])`). - -## `@header` — one header, singular alias - -`@header('name')` is the singular alias of `@headers`: it picks exactly one request header. - -```typescript -who(@header('x-trace') trace: string) { /* ... */ } -``` - -It also accepts a schema in slot 2 — `@header('x-count', schema)`. - -## Schema forms — validation & coercion - -`@body`, `@query`, `@headers`, and `@param` accept an optional **Standard Schema** (zod, -valibot, arktype, …). The value the handler receives is the schema's **parsed/coerced output**, -already typed: - -```typescript -create(@body(CreateUser) user: { email: string }) { - return { created: user.email }; -} -``` - -:::note[Access shape (asymmetry)] -`@param('id', Schema)` takes the **key in slot 1** and the schema in slot 2 — `@param` always -needs a name to say which route param it binds. `@body(Schema)`, `@query(Schema)`, and -`@headers(Schema)` take the schema as their **only** argument, validating the whole parsed -object. -::: - -A failing schema short-circuits the request with **422**. See [Validation](/docs/guides/validation/) -for the full contract (fail-fast order, error shape, async schemas, and caveats). - -## Multipart access asymmetry - -A request with `Content-Type: multipart/form-data` makes `@body()` resolve to `{ fields, files }` -instead of a plain object. - -:::caution[Access note] -For multipart, `@body('title')` returns `undefined` — the value lives at `body.fields.title`, -not `body.title`, unlike JSON/urlencoded where `@body('title')` picks the value directly. Use -`@body()` and read `.fields` / `.files`, or key into the envelope itself with `@body('fields')` -/ `@body('files')`. -::: - -```typescript -upload(@body() form: MultipartBody) { - const name = form.fields.name; // string | string[] - const avatar = form.files.avatar; // UploadedFile | UploadedFile[] - return { name, size: Array.isArray(avatar) ? undefined : avatar?.size }; -} -``` - -## Stream decorators — `@inbound` and `@abort` - -These are for streaming handlers: - -- **`@inbound()`** (WS only) gives you the incoming WebSocket message channel — the client's - messages to consume. A `@Ws` handler returns the **outbound** channel. -- **`@abort()`** (stream / WS) hands you an `AbortSignal` that fires on disconnect, so you can - tear down work when the client goes away. - -```typescript -@Ws('/echo') -echo(@inbound() incoming: AsyncIterable) { - const out = channel(); - (async () => { - for await (const msg of incoming) out.push(`echo: ${msg}`); - out.close(); - })(); - return out; -} -``` - -See [Streaming](/docs/guides/streaming/) for SSE, WebSocket duplex, and channels. - -## Where to go next - -- How injected values are produced: [Dependency injection](/docs/guides/dependency-injection/). -- The mental model: [The graph](/docs/concepts/the-graph/). -- Validating and coercing injected values: [Validation](/docs/guides/validation/). -- The full API surface: [Decorator reference](/docs/reference/decorators/). diff --git a/website/src/content/docs/guides/cli.md b/website/src/content/docs/guides/cli.md deleted file mode 100644 index aa6d768..0000000 --- a/website/src/content/docs/guides/cli.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -title: The matcha CLI -description: "Scaffold, run, and generate green-tea apps from a single native binary." ---- - -**matcha** scaffolds green-tea projects, runs them in watch mode, and generates pieces already wired into your graph. It is a native binary — installing the CLI needs no JS runtime, and it only reaches for yours when it runs or type-checks your project. - -That is deliberate: green-tea runs on Node, Deno, Bun, and the edge, so its tool shouldn't be bound to one of them. - -## Install - -```bash -curl -fsSL https://raw.githubusercontent.com/Expressive-Tea/matcha/main/install.sh | sh -``` - -Downloads a checksum-verified prebuilt binary into `~/.local/bin`. Environment variables go on the `sh` side of the pipe: - -```bash -curl -fsSL …/install.sh | MATCHA_VERSION=v26.7.0 MATCHA_INSTALL_DIR=/usr/local/bin sh -``` - -From source, if you have Rust: - -```bash -cargo install --git https://github.com/Expressive-Tea/matcha -``` - -## Scaffold — `matcha new` - -```bash -matcha new my-api # Node (the default) -matcha new my-api --runtime deno # or deno | bun -matcha new my-api --template-url gh:owner/repo # any git template -``` - -The starter is alive on the first run: it serves an `index.html` and streams a rotating zen message over `@Sse('/zen')`. Open the browser and something is already moving — you are editing a working app, not assembling one. - -Only the entry point and the config differ between runtimes. The `src/` tree is identical, which is the same portability the framework promises. - -## Run — `matcha run` - -```bash -matcha run -``` - -Detects the runtime and starts a watch loop. First match wins: - -1. `matcha.toml` — an explicit `runtime = "node" | "deno" | "bun"` -2. `deno.json` / `deno.jsonc` → deno -3. `bun.lockb` / `bun.lock` → bun -4. `package.json` → node - -Edge is a deploy target, not a `matcha run` target. - -## Generate — `matcha create` - -```bash -matcha create controller Users -matcha create step Authenticate -matcha create provider Database -matcha create module Billing -matcha create controller Users --check # type-check with your runtime afterward -``` - -Writes the file **and wires it in** — into the right `@Module` array, or into `createApp({ modules })` for a module. - -## Extend — `matcha add` - -```bash -matcha add sse # or: stream | buffer -``` - -Inserts a handler of that shape into your controller. - -## How the edits stay safe - -`create` and `add` edit your TypeScript with [tree-sitter](https://tree-sitter.github.io), not string splicing or regex. Edits are **idempotent** — running the same command twice doesn't duplicate anything — and they **revert themselves** if the result wouldn't parse. A generator that corrupts your source is worse than no generator. - -One case it deliberately refuses: if `modules` is a variable (`modules: MODULES`) rather than an array literal, `create module` won't add a second `modules` key. Duplicate keys parse cleanly, so nothing would fail — it would just silently shadow your value. It tells you instead. diff --git a/website/src/content/docs/guides/dependency-injection.md b/website/src/content/docs/guides/dependency-injection.md deleted file mode 100644 index 9382bc2..0000000 --- a/website/src/content/docs/guides/dependency-injection.md +++ /dev/null @@ -1,147 +0,0 @@ ---- -title: Dependency injection -description: "Providers, steps, and modules, and how values flow through the graph." ---- - -In green-tea the request pipeline is an explicit **dependency graph**. You declare what each -piece needs and produces; the framework computes the order, validates the wiring at boot, and -runs only the slice a route actually depends on. You never write "put this before that." - -There are three building blocks: - -- A **provider** is an app-scope singleton — constructed once, its value memoized for the - lifetime of the app. -- A **step** runs per request and transforms the context. -- A **module** sets a mountpoint and wires providers, steps, and controllers together. - -A handler's **argument decorators are its dependency declaration** — ask for what you want, in -any order. If you `@needs` a token nothing produces, you get a **boot error**, not an -`undefined` at runtime. - -## The full example - -```typescript -import 'reflect-metadata'; -import { createApp, Provider, Step, Route, Get, Module, Unauthorized, needs, param } from '@green-tea/core'; - -@Provider({ provides: 'db' }) -class Database { - provide() { return { db: { find: (id: string) => ({ id, name: 'Diego' }) } }; } -} - -@Step({ provides: 'user', needs: ['db', 'req'] }) -class Authenticate { - run(ctx: any) { - const user = ctx.db.find(ctx.req.headers['x-token']); - if (!user) throw new Unauthorized('bad token'); // throw = short-circuit the pipeline - return { user }; // return = continue, merge into ctx - } -} - -@Route('/users') -class UserController { - @Get('/:id') - getUser(@needs('user') user: any, @param('id') id: string) { - return { requested: id, you: user }; // auto-serialized as JSON - } -} - -@Module({ mountpoint: '/api', providers: [Database], steps: [Authenticate], controllers: [UserController] }) -class ApiModule {} - -const app = createApp({ modules: [ApiModule] }); -await app.listen(3000); -// GET /api/users/9 (header x-token) → { "requested": "9", "you": { "id": "...", "name": "Diego" } } - -await app.close(); // graceful shutdown: drains in-flight, closes streams + mesh links, - // then force-closes whatever is left after 10s — app.close({ timeoutMs }) -``` - -## `@Provider` — app-scope, memoized - -A provider produces a value once, when the app boots, and reuses it for every request. Its -`provide()` method returns an object whose keys become tokens in the graph — here `db`. - -```typescript -@Provider({ provides: 'db' }) -class Database { - provide() { return { db: { find: (id: string) => ({ id, name: 'Diego' }) } }; } -} -``` - -Because it's app-scope, a provider is the right home for things you build once and share: -database clients, config, connection pools. - -:::note -An optional provider (`optional: true`) that throws on boot does **not** abort startup — it is -left unregistered and logged, and the failure surfaces at request time for routes that need it. -Query the degraded set with `app.degraded()` or listen for the `boot:provider:fail` bus event. -::: - -## `@Step` — request-scope, transforms the context - -A step runs once per request. Its `run(ctx)` receives the accumulated context and either: - -- **returns an object** → the pipeline continues and the object is merged into `ctx`, or -- **throws** → the request short-circuits (here `Unauthorized` becomes a `401`). - -```typescript -@Step({ provides: 'user', needs: ['db', 'req'] }) -class Authenticate { - run(ctx: any) { - const user = ctx.db.find(ctx.req.headers['x-token']); - if (!user) throw new Unauthorized('bad token'); // throw = short-circuit the pipeline - return { user }; // return = continue, merge into ctx - } -} -``` - -This step `provides: 'user'` and `needs: ['db', 'req']` — so green-tea knows the `db` provider -and the built-in `req` must resolve before it runs, and it topologically sorts accordingly. - -## How `needs` / `provides` build the graph - -Every node declares what it **produces** (`provides`) and what it **consumes** (`needs`). The -framework reads those declarations and computes a topological order — you never specify -ordering by hand. A handler's argument decorators extend the same graph: `@needs('user')` on a -parameter is a dependency edge exactly like a step's `needs`. - -Because the graph is explicit, **each route runs only the transitive closure of its handler's -`@needs`** — nothing else. - -:::caution[Per-route execution] -A route that doesn't `@needs('user')` does **not** run the `Authenticate` step. A cross-cutting -*enforcement* step (e.g. auth that throws `401`) only protects routes that actually `@needs` -its token. To run something on **every** route regardless of needs (logging, audit, a global -guard), add it as a **plugin step** via `scope.add({ ..., provides: [] })` — steps that produce -nothing run unconditionally. Don't rely on a token-providing step to guard routes that don't -declare it. -::: - -## `@Module` — mountpoint and wiring - -A module ties everything together: a `mountpoint` prefix for the routes, and the lists of -`providers`, `steps`, and `controllers` that belong to it. - -```typescript -@Module({ mountpoint: '/api', providers: [Database], steps: [Authenticate], controllers: [UserController] }) -class ApiModule {} -``` - -Pass modules to `createApp({ modules: [ApiModule] })` to assemble the app. - -## Boot validation of `@needs` - -The payoff of declaring dependencies is that the wiring is checked before a single request is -served. When you `@needs` a token, green-tea verifies some provider or step actually produces -it. If nothing does, **`createApp` throws with a clear error** instead of letting your handler -receive `undefined`. Boot fails loudly, so you never serve `undefined`. - -## Where to go next - -- New to green-tea? Start with [Getting started](/docs/getting-started/). -- The mental model behind all of this: [The graph](/docs/concepts/the-graph/). -- Everything a handler can inject: [Argument decorators](/docs/guides/arguments/) and the - [decorator reference](/docs/reference/decorators/). -- Coerce and validate injected values with Standard Schema: [Validation](/docs/guides/validation/). -- Declare `@Sse` and return an `AsyncIterable` to push data over time: [Streaming](/docs/guides/streaming/). diff --git a/website/src/content/docs/guides/errors.md b/website/src/content/docs/guides/errors.md deleted file mode 100644 index 73547b4..0000000 --- a/website/src/content/docs/guides/errors.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: Error handling -description: "Throw typed errors anywhere; render them however you like with onError." ---- - -Errors are **thrown, not returned**. Throw a typed error anywhere in the pipeline — a provider, a step, or a handler — and green-tea converts it to a response at one place. - -## The typed errors - -All live in `@green-tea/core`: - -| Throw | Status | -|---|---| -| `Unauthorized(msg?)` | `401` | -| `NotFound(msg?)` | `404` | -| `NotModified()` | `304` | -| `Redirect(location)` | `302` + `Location` | -| `ValidationError` | `422` (raised for you by schema validation) | -| `HttpError(status, msg?, body?)` | any status | -| anything else | `500` (message hidden — internals never leak) | - -```typescript -@Step({ provides: 'user', needs: ['db', 'req'] }) -class Authenticate { - run(ctx) { - const user = ctx.db.find(ctx.req.headers['x-token']); - if (!user) throw new Unauthorized('invalid token'); // → 401, cuts the request - return { user }; - } -} -``` - -By default an error becomes JSON: `{ "error": "" }` (validation adds `source` + per-field `issues`). - -## Structured error bodies - -An `HttpError` can carry a **body** — return a structured payload instead of the default `{ error }`: - -```typescript -throw new HttpError(409, 'conflict', { code: 'DUP_EMAIL', field: 'email' }); -// → 409 { "code": "DUP_EMAIL", "field": "email" } -``` - -## Render errors your way — `onError` - -Not everything should be JSON. Pass `onError` to `createApp` to render errors however you like — HTML, [RFC 7807](https://www.rfc-editor.org/rfc/rfc7807), content-negotiated, anything. It receives the error and the request, and returns a response — or `undefined` to fall back to the default JSON. - -```typescript -import { HttpError } from '@green-tea/core'; - -const app = createApp({ - modules: [ApiModule], - onError(error, req) { - const status = error instanceof HttpError ? error.status : 500; - // negotiate: HTML for browsers, JSON for API clients - if (String(req.headers.accept).includes('text/html')) { - return { status, headers: { 'content-type': 'text/html' }, body: `

${status}

` }; - } - return undefined; // fall back to the default JSON - }, -}); -``` - -`onError` intercepts **every** HTTP error response — handler/step throws, a `404` for an unmatched route, `405`, a `413` (body too large), and a `400` (malformed body, repeated slash, or malformed path encoding) — so your error surface is consistent across the whole app. HEAD error responses keep the same status and headers but suppress the body. Streaming and WebSocket errors are out of scope (they surface as an error frame or a WebSocket close code, not a response body). - -:::note -Errors are also observable without changing the response: subscribe to `request:step:error` (and `stream:error`) on [`app.bus`](/docs/guides/plugins/) to log or trace them. -::: diff --git a/website/src/content/docs/guides/html.md b/website/src/content/docs/guides/html.md deleted file mode 100644 index 5f65752..0000000 --- a/website/src/content/docs/guides/html.md +++ /dev/null @@ -1,161 +0,0 @@ ---- -title: HTML & views -description: "The @Html decorator, the built-in template engine, and zero-config static file serving." ---- - -Most of green-tea assumes JSON, but not every route is an API endpoint. `@Html` marks a handler as serving HTML instead of going through the JSON transformer — a string, a file, or a file rendered with data. Add a static directory on top and you've got a small server-rendered site without reaching for a template framework. - -## `@Html` — three modes - -### 1. Return a string — every runtime - -Bare `@Html` sends the handler's return value as `text/html; charset=utf-8`. No filesystem involved, so this mode runs on Node, Deno, Bun, and the edge. - -```typescript -import { Route, Get, Html } from '@green-tea/core'; - -@Route('/') -class PageController { - @Get('/') - @Html - home() { - return '

Hello from green-tea

'; - } -} -``` - -### 2. Serve a file — Node/Deno/Bun - -`@Html('file.html')` reads the file at boot, caches it, and serves it verbatim — the handler still runs (for side effects, guards, etc.) but its return value is ignored. - -```typescript -@Route('/about') -class AboutController { - @Get('/') - @Html('about.html') - about() {} -} -``` - -Reading a file needs a filesystem, so this mode is Node/Deno/Bun only — see [Runtimes](/docs/guides/runtimes/) for the edge alternative. - -### 3. Render a template — Node/Deno/Bun - -`@Html('file.html', { template: true })` reads the file at boot and renders it with whatever object the handler returns, on every request. - -```typescript -@Route('/user') -class UserController { - @Get('/:id') - @Html('user.html', { template: true }) - show(@param('id') id: string) { - return { name: lookupName(id) }; - } -} -``` - -`user.html`: - -```html -

Hi {{ name }}

-``` - -Same filesystem requirement as file mode: Node/Deno/Bun only. - -:::caution[Return the right shape for each mode — never an `AsyncIterable`] -`@Html` is a buffered route, so its return contract follows the mode: bare `@Html` returns a -`string`; `@Html('file.html', { template: true })` returns the data object rendered into the -template; `@Html('file.html')` (no template) ignores the return entirely — annotate it `: void` -by convention, e.g. `page(@needs('x')): void {}`. Returning an `AsyncIterable` from any `@Html` -handler is the same buffered-route mismatch as any other `@Get`/`@Head`/`@Post`/`@Put`/`@Patch`/`@Delete`/`@Options` -handler: a 500 `TransportMismatchError`, not a silent raw stream. -::: - -## The `views` base directory - -`@Html('file.html')` paths resolve against `createApp({ views })` — a relative path joins `views`, an absolute path is used as-is (handy for a template stored outside the project, e.g. on an NFS mount). `views` defaults to `process.cwd()` when unset. - -```typescript -const app = createApp({ modules: [ApiModule], views: 'templates' }); -// @Html('about.html') -> /templates/about.html -// @Html('/srv/shared/about.html') -> /srv/shared/about.html (absolute, used as-is) -``` - -Files are read once, at boot — not on every request. - -## The built-in template engine - -Template mode renders with a small, dependency-free engine, also exported as `render` if you want to call it directly: - -```typescript -import { render } from '@green-tea/core'; - -render('

{{ name }}

', { name: 'hi' }); -// '

<b>hi</b>

' — {{ x }} HTML-escapes - -render('{{{ html }}}', { html: 'hi' }); -// 'hi' — {{{ x }}} is raw, unescaped - -render('{{ user.name }} / {{ nope }}', { user: { name: 'Diego' } }); -// 'Diego / ' — {{ a.b }} walks nested keys; a missing key renders empty -``` - -That's the whole engine: interpolation, escaped or raw, with dotted-key lookup. No loops, conditionals, or partials — reach for `viewEngine` below if you need those. - -## Bring your own engine — `viewEngine` - -`createApp({ viewEngine })` swaps in any `(source, data) => string` function for template mode — EJS, Handlebars, or your own: - -```typescript -import ejs from 'ejs'; - -const app = createApp({ - modules: [ApiModule], - views: 'templates', - viewEngine: (source, data) => ejs.render(source, data as object), -}); -``` - -`viewEngine` only affects `@Html(..., { template: true })`; string and plain file modes are unaffected. - -## Static files — `createApp({ static })` - -`static` serves a directory as a GET/HEAD fallback, tried after your declared routes and before a `404`: - -```typescript -const app = createApp({ modules: [ApiModule], static: true }); // ./public, relative to cwd -const app2 = createApp({ modules: [ApiModule], static: 'assets' }); // ./assets, relative to cwd -const app3 = createApp({ modules: [ApiModule], static: '/srv/site' }); // absolute, used as-is -``` - -- Files are served at their URL path; content-type is inferred from the extension. -- `/` (and any directory-shaped path) resolves to `index.html`. -- Only `GET` and `HEAD` are handled — other methods fall through. -- **Declared routes always win.** Static is only consulted when nothing matched, so `@Get('/api/ping')` is never shadowed by a file at `public/api/ping`. -- Path traversal (`../`, encoded or not) is rejected — a request can't escape the static root. - -Like the file/template modes of `@Html`, `static` needs a filesystem: it's Node/Deno/Bun only. Configuring it on an edge runtime throws at `createApp()` time — see [Runtimes](/docs/guides/runtimes/). - -## The boot rule - -`@Html` only supports **buffered `GET`/`POST`** routes. Boot fails fast rather than misbehaving at request time: - -```typescript -@Sse('/ticks') -@Html -ticks() { /* ... */ } -// throws at createApp(): "@Html on GET /ticks is not allowed — -// @Html only supports buffered GET/POST routes (not SSE/WS/HEAD/PUT/PATCH/DELETE/OPTIONS)" -``` - -`@Html` and `@Transformer` also can't be combined on the same handler — pick one: - -```typescript -@Get('/g') -@Html -@Transformer(myTransformer) -g() { /* ... */ } -// throws at createApp(): "@Html and @Transformer on /g conflict — use one" -``` - -Both checks run once, at boot, alongside the rest of the route validation — never per-request. diff --git a/website/src/content/docs/guides/introspection.md b/website/src/content/docs/guides/introspection.md deleted file mode 100644 index 3f50cbc..0000000 --- a/website/src/content/docs/guides/introspection.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -title: Graph introspection -description: "explain, graph, toMermaid, and the graph endpoint." ---- - -Because the request/boot pipeline is an explicit [dependency graph](/docs/concepts/the-graph/), -you can inspect it directly — visualize the whole thing, or explain exactly which nodes a -single route runs. - -## Visualize with Mermaid - -`app.toMermaid()` renders a flowchart of every node and route. `app.toDOT()` produces the -same graph as Graphviz DOT. - -```typescript -console.log(app.toMermaid()); // flowchart diagram of all nodes and routes -``` - -Enable a live `GET /__graph__` endpoint — it renders an HTML viewer with Mermaid, or the -raw Mermaid source with `Accept: text/plain`: - -```typescript -const app = createApp({ modules: [ApiModule], devGraph: true }); -// GET /__graph__ → HTML viewer -// GET /__graph__ (text/plain) → raw Mermaid source -``` - -:::caution -`devGraph` exposes your graph structure over HTTP. Keep it on in development; leave it off -in production. -::: - -## Explain a route - -`app.explain(route)` returns the exact execution chain for one route — the ordered nodes, -each with its kind, origin, and declared `needs`/`provides`: - -```typescript -const e = app.explain('/api/users/:id'); -// { pattern, method, transport, chain: [{ name, kind, origin, needs, provides }, ...] } -console.log(e.chain.map((n) => `${n.kind}:${n.name}`)); -// → ['provider:db', 'step:user', 'handler:getUser'] -``` - -The chain is the transitive closure of the handler's `@needs` — the same set the framework -actually runs for that route, and nothing more. - -`app.graph()` returns the underlying graph structure programmatically if you'd rather walk -it yourself than render it. - -## Degraded optional providers - -`app.degraded()` returns the names of optional providers that are running in a **degraded** -state — for example, an optional dependency that failed to initialize but didn't abort boot. -Use it as a health signal to surface partial availability. diff --git a/website/src/content/docs/guides/mesh.md b/website/src/content/docs/guides/mesh.md deleted file mode 100644 index 6e9fef7..0000000 --- a/website/src/content/docs/guides/mesh.md +++ /dev/null @@ -1,145 +0,0 @@ ---- -title: Mesh (alpha) -description: "Distributed dependency injection over a secret-gated WebSocket control channel." ---- - -:::caution[Alpha] -Mesh is **alpha** — its API and wire protocol may change between releases, and discovery, load-balancing, and failover are not built. It is gated behind an explicit opt-in: `createApp({ mesh, experimental: true })`, and `createApp` **throws** if you configure `mesh` without `experimental: true`. **Don't ship mesh to production yet.** -::: - -A **teacup** can depend on a token that physically lives on another node — a **teapot**. `@needs('billing')` resolves the same whether `billing` runs in this process or on a remote one. There's no gRPC layer or message-pattern DSL: there's the [graph](/docs/concepts/the-graph/), and some nodes happen to live elsewhere. - -Exports are opt-in (`export: true`) and the control channel is gated by a shared secret. - -## What runs where - -Mesh runs on **Node, Deno and Bun**, as both teapot and teacup, in any combination — a Deno teapot can serve a Node teacup. The wire is JSON over a WebSocket, so peers only have to agree on the protocol version, not the runtime. - -**Edge (Cloudflare Workers) is not supported.** The teapot's secret comparison uses `node:crypto`'s `timingSafeEqual`, which workerd's `nodejs_compat` does not provide. - -You do **not** need `listen()`. The graph boots on first use, so `Deno.serve`/`Bun.serve` work through `app.fetch`/`app.upgrade` like any other route: - -```typescript -serveDeno(teapot, { port: 3002 }); // control channel served via app.upgrade -serveBun(teacup, { port: 3003 }); // teapots connected on the first request -``` - -## Node A — teapot (exposes `config`, `auth`, and a route) - -```typescript -@Provider({ provides: 'config', export: true }) -class Config { provide() { return { config: { region: 'mx', tier: 'pro' } }; } } - -@Step({ provides: 'auth', needs: [], export: true }) -class Auth { run(ctx: any) { return { auth: { token: ctx.headers?.['x-token'] ?? 'anon' } }; } } - -@Route('/svc') -class Svc { @Get('/ping', { export: true }) ping() { return { pong: true }; } } - -@Module({ mountpoint: '/api', providers: [Config], steps: [Auth], controllers: [Svc] }) -class TeapotModule {} - -const teapot = createApp({ modules: [TeapotModule], experimental: true, mesh: { secret: 'shh' } }); -await teapot.listen(3002); -``` - -## Node B — teacup (uses `config` + `auth` with no local providers) - -```typescript -@Route('/local') -class LocalCtl { - @Get('/who') - who(@needs('config') config: any, @needs('auth') auth: any) { - return { config, auth }; // both resolved by RPC to the teapot - } -} -@Module({ mountpoint: '/api', controllers: [LocalCtl] }) -class TeacupModule {} - -const teacup = createApp({ - modules: [TeacupModule], - experimental: true, - mesh: { teapots: [{ url: 'ws://A-host:3002/__mesh__/control', secret: 'shh' }] }, -}); -await teacup.listen(3003); -// GET B:3003/api/local/who (x-token: abc) -// → { "config": { "region": "mx", "tier": "pro" }, "auth": { "token": "abc" } } -``` - -## How it resolves - -`@needs('config' | 'auth')` validates at boot because the teapot announced them in its **manifest** on connect. Scope determines the RPC cost: - -- A **provider** export is **app-scope** — resolved once and cached. -- A **step** export is **request-scope** — one RPC per request, carrying the request envelope. - -Remote tokens become synthetic nodes in the local graph with RPC-backed runners, so the rest of the pipeline is unchanged. For non-mesh apps `createApp` stays synchronous; a mesh app defers graph finalization until it boots — connecting to teapots is network I/O — and boots on whichever comes first: `app.fetch`, `app.upgrade` or `listen()`. Whoever triggers it, it happens once. - -## Inspecting a mesh graph - -`inspect()`, `graph()` and `explain()` are synchronous, but a mesh graph is not knowable until its teapots have been asked — so on a mesh app they throw until the graph is resolved. `await app.ready()` resolves it: - -```typescript -await app.ready(); // connects the teapots; a no-op on a non-mesh app -app.graph(); // now includes the remote scopes -``` - -Write those two lines and your code works against either kind of app without knowing which it got. `ready()` deliberately does **not** boot providers — resolving the graph and being ready to serve are different things, and drawing a diagram should not open your database connections. Serving (`fetch`/`upgrade`/`listen`) boots them too and shares the same memoized step, so calling both never resolves the graph twice. - -The dev routes (`/__graph__`, `/__openapi__`) need none of this: a request boots the app before the route runs. - -## Buffered routes only - -Mesh proxies **buffered** endpoints. `@Sse`, `@Stream` and `@Ws` routes are not exportable: a remote route is registered as `transport: 'buffer'`, and a handler that returns an `AsyncIterable` over a mesh call fails with `cannot proxy a streaming route`. Streams are a live socket between client and server; there is no meaningful way to relay one through an RPC hop today. - -## One teapot per route - -A route must be exported by exactly **one** teapot. If two export the same method and effective match shape — including patterns that differ only by parameter name, such as `/:id` and `/:name` — boot **fails**, naming both patterns and both teapots: - -``` -mesh: ambiguous remote route 'GET /api/shape/:name' from ws://b/__mesh__/control -conflicts with 'GET /api/shape/:id' from ws://a/__mesh__/control — load balancing -across teapots is not implemented yet, so green-tea will not choose one for you. -``` - -This is a hard error rather than a silent pick because there is no load balancing to fall back on: choosing one would be an arbitrary answer you could come to depend on. Scope tokens (`@Provider`/`@Step`) are unique for the same reason — and balancing them would be meaningless anyway, since an app-scope export is resolved once and cached. - -**Local routes win.** If you declare a route locally *and* import the same effective method/shape from a teapot, yours takes precedence — that is how you override a teapot — and green-tea warns so a shadowed export doesn't look like a broken one: - -``` -[green-tea] mesh: route 'GET /api/svc/ping' is exported by teapot ws://a/… but also -declared locally — the local route takes precedence and the remote one will not be -reached. Remove one if that is not what you meant. -``` - -## When a teapot goes away - -A dead upstream is not a broken service, and the status says which: - -| What happened | Status | -| --- | --- | -| The link is down (closed, or the heartbeat gave up) | **503** Service Unavailable | -| The link is up but the teapot didn't answer in `timeoutMs` | **504** Gateway Timeout | -| The teapot answered with an error | whatever it said | - -503 arrives **immediately** — a closed socket cannot deliver the frame, so waiting `timeoutMs` (30s by default) would just make the caller pay for a verdict already known. - -Each teacup pings its teapots every `heartbeatMs` (15s by default) and closes a link after two unanswered rounds. This is what catches a **half-open** connection — a dropped route, a killed container, a NAT that timed out — where the socket still looks open with nobody home. Without it, a teacup only finds out on the next request, which pays the full timeout first. - -```typescript -mesh: { teapots: [...], heartbeatMs: 5000 } // notice sooner, chatter more -``` - -Ping and pong are ordinary mesh frames rather than WebSocket protocol pings, because the platform `WebSocket` on Deno and Bun does not expose `ws.ping()` — a protocol-level heartbeat could not work on every runtime mesh supports. - -**An app-scope export survives its teapot.** It is resolved once and memoised, so a provider keeps answering from cache after the link drops — with a value that can go stale. Reconnect reconciliation is a known gap. - -## Protocol version - -Peers are separate processes on separate deploy cadences, so the wire is versioned: `MESH_PROTOCOL_VERSION` travels in the `hello` and `manifest` frames, and a mismatch is refused on both sides with both versions named. A teapot checks the version **before** the secret — a skewed peer is not an authentication failure, and reporting it as one would send you hunting the wrong bug. - -Bump the version and old peers refuse the connection loudly instead of misreading a frame. - -:::note[Skeleton limitations (by design)] -No discovery, load-balancing, or failover yet; app-scope remote values are not reconciled on reconnect; the request envelope omits `req.url`. -::: diff --git a/website/src/content/docs/guides/observability.md b/website/src/content/docs/guides/observability.md deleted file mode 100644 index cc65843..0000000 --- a/website/src/content/docs/guides/observability.md +++ /dev/null @@ -1,145 +0,0 @@ ---- -title: Observability -description: A correlated lifecycle event stream, an injectable logger, and where exporters go. ---- - -green-tea does not integrate with an observability vendor. It emits a **correlated event stream** and -lets you read it. A logger, a metrics exporter and a tracing bridge are three consumers of that one -stream — not three features, which is why they are one design. - -The rule that shapes all of it: core has one runtime dependency, `reflect-metadata`, and keeps it. -Nothing here imports an exporter. - -## Correlation - -Every request gets an id. Every event it causes carries that id. - -```ts -app.bus.on('request:step:leave', (event) => { - event.requestId; // "9f0c…" — the same value on every event of this request - event.route; // "/users/:id" — the pattern, never the concrete path - event.durationMs; // how long this step took -}); -``` - -Without that id the stream is unusable under any concurrency: two requests interleave their step -events and nothing tells you which is which. - -**An incoming `x-request-id` is adopted, not replaced.** A service behind a gateway must not open a -second identity for a request that already has one. - -**A `traceparent` header is carried through untouched** as `traceId`. Core parses nothing and -implements no propagation spec — W3C Trace Context belongs to the exporter that understands it. - -### `route` is the pattern, always - -`route` is `/users/:id`, never `/users/42`. This is a contract, not an implementation detail: a -metrics consumer that labels a counter with the concrete path gets one label per distinct URL, and -unbounded label cardinality takes down the metrics backend rather than the application. - -## The events - -| Event | When | -|---|---| -| `request:start` / `request:end` | a request enters and leaves the handler | -| `request:failed` | the request produced an error | -| `route:matched` / `route:unmatched` | a route matched, or none did (covers **404 and 405**) | -| `request:step:enter` / `:leave` / `:error` | one step of the pipeline | -| `boot:provider:start` / `:ok` / `:fail` | a provider booting | -| `stream:open` / `:close` / `:error` | an SSE, ndjson or WebSocket connection | -| `mesh:connect` / `:disconnect` / `:rpc:error` | mesh links | -| `plugin:mounted` | a plugin registered | - -### Where a streaming request ends - -`request:end` fires **when the handler returns**, not when a stream it produced finishes. - -A streaming route returns in milliseconds while its connection may live for hours. Ending the -request span at stream close would put hour-long SSE connections and 2 ms buffered replies in one -latency distribution, ruining both. The connection is described by `stream:open` / `stream:close`, -which carry the same `requestId` — so you can join the two yourself, and you get a meaningful -latency histogram either way. - -### Streams do not emit per message - -Lifecycle only. A per-message event on a high-rate stream is a firehose that costs more than it -reports, and the cost lands on the workload least able to absorb it. Instrument your own handler if -you need it, where you know what the messages mean. - -## The logger - -```ts -const app = createApp({ modules: [AppModule], logger: myLogger }); -``` - -Any object with `debug`, `info`, `warn` and `error` — each taking a message and optional structured -fields. Bridging `pino` or `winston` is a few lines in either direction; core defines the shape it -needs rather than adopting anyone's. - -Given none, the default writes structured JSON, or a human-readable line when the process is -attached to a TTY — decided once at boot, not per record. - -**Nothing in core writes to `console`.** That is enforced by a lint rule, not by good intentions, so -every framework diagnostic is redirectable. - -The logger is also injectable: - -```ts -@Step({ provides: 'user', needs: ['db'] }) -class LoadUser { - run(@needs('logger') log: Logger) { … } -} -``` - -Same object, two access paths. It is registered rather than declared as a provider because it has to -outlive the graph on both ends: a provider cannot report its own boot failing, and shutdown warnings -happen after the graph is gone. - -## Request logging - -Off by default. A framework that writes to stdout uninvited is one you have to configure before you -can use it. - -```ts -createApp({ modules: [AppModule], logRequests: true }); -``` - -It is an ordinary subscriber, so you can do it by hand and take it back: - -```ts -import { logRequests } from '@green-tea/core'; - -const stop = logRequests(app.bus, app.logger); -stop(); // removable, not merely optional -``` - -A logger that throws does **not** silently stop writing: the subscriber is wrapped so failures fall -back to `console`. `Bus.emit` isolates listener failures by design — an observer must never break a -request — and the wrapper keeps that guarantee without paying for it in silence. - -## Metrics and tracing - -There is no metrics registry in core and no OpenTelemetry exporter in core. Both read the stream -above from outside: - -```ts -app.bus.on('request:end', (e) => histogram.observe(e.durationMs, { route: e.route, status: e.status })); -``` - -Per-step timings are already on the events, so a per-node timing breakdown needs no extra -instrumentation — the graph already knows every node. - -## What it costs - -**About 0.29 µs per request** — roughly **7% of the framework's own work**, or **~2% of a request -measured over a real socket**, where the transport dominates. - -The cost is **per request, not per step**. Per-step timing and payload construction are skipped -entirely when nothing is subscribed, so a deep pipeline pays no more than a shallow one. What -remains is fixed: generating the request id, reading two headers, and the checks that decide -whether anyone is listening. - -Absolute throughput numbers are deliberately not quoted here. The figure above comes from an -interleaved A/B — alternating both versions round by round — because the same code measured at the -start and end of one session on the same machine differed by 12% as it warmed up. Any before/after -that does not interleave is measuring the clock as much as the code. diff --git a/website/src/content/docs/guides/openapi.md b/website/src/content/docs/guides/openapi.md deleted file mode 100644 index 7072e12..0000000 --- a/website/src/content/docs/guides/openapi.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -title: OpenAPI -description: "Generate a structural OpenAPI 3.1 document from the route graph." ---- - -Because the request pipeline is [data you can read](/docs/concepts/the-graph/), green-tea can project it — the same way it renders [Mermaid/DOT](/docs/guides/introspection/), it emits **OpenAPI**. - -## `app.openapi()` - -```typescript -const app = createApp({ modules: [ApiModule] }); -const spec = app.openapi({ title: 'My API', version: '1.0.0' }); -// → OpenAPI 3.1 document -``` - -It reads the routes and handler signatures and produces, for each route: - -- the **path**, templated — `/users/:id` → `/users/{id}`, constrained `:id(\d+)` → `{id}`, catch-all `:path*` → `{path}`; -- the **explicitly declared method**, including `@Head` and `@Options`; -- **parameters** — path params from the pattern, plus query/header params from the handler's `@query` / `@headers` / `@header` decorators; -- a **request body** entry for routes that read `@body()`; -- the systematic **responses** — `200`, a `422` when any argument is schema-validated, and `500`. - -WebSocket routes are omitted (they aren't request/response). - -A constrained path parameter remains a string parameter and carries its route expression as `schema.pattern`. Only declared operations appear: implicit HEAD and automatic OPTIONS fallbacks are runtime conveniences and are not invented in the OpenAPI document. - -## Serve it — `devOpenapi` - -Opt in to a `GET /__openapi__` endpoint that returns the document as JSON — point Swagger UI, Redoc, or a codegen client at it: - -```typescript -const app = createApp({ modules: [ApiModule], devOpenapi: true }); -// GET /__openapi__ → application/json -``` - -## What's structural (and what isn't yet) - -This is a **structural** spec: paths, methods, parameters, which routes take a body, and the standard error responses. What it does **not** include yet: - -- **Request/response body schemas.** [Standard Schema](/docs/guides/validation/) (zod/valibot/arktype) validates input but does not expose a JSON Schema representation, so body shapes are documented generically. Parameter types default to `string`. - -Full schemas — declared and enforced on the way out via a `@Produce(schema)` decorator that also validates responses — are on the roadmap for the stable release. For beta, the structural document already drives Swagger UI, client codegen, and API diffing. diff --git a/website/src/content/docs/guides/plugins.md b/website/src/content/docs/guides/plugins.md deleted file mode 100644 index a1cdc13..0000000 --- a/website/src/content/docs/guides/plugins.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -title: Plugins -description: "Extending the app safely via bus.on and scope.add." ---- - -A plugin is a function that receives the app's API at boot. It gets exactly two -capabilities: **observe** the running system through `bus.on(...)`, and **extend its own -scope** through `scope.add(...)`. That's the whole surface — and it's deliberately narrow. - -```typescript -const logger = (api: any) => { - api.bus.on('request:step:enter', (p: any) => console.log(`→ ${p.name}`)); - api.bus.on('stream:open', (p: any) => console.log(`stream open ${p.name}`)); - api.bus.on('mesh:rpc:error', (p: any) => console.error('mesh rpc failed', p.error)); -}; - -const app = createApp({ modules: [ApiModule], plugins: [logger] }); -``` - -## Isolation is structural - -A plugin can add steps and providers to **its own scope** via `scope.add(...)`. It -**cannot** reorder or delete another scope's steps. The graph — not a policy check — -enforces this: each scope owns its nodes, and a plugin has no handle on anyone else's. -There's no ordering hook to abuse and no step registry to mutate. If you want a plugin to -influence execution, it does so by contributing a node with declared `needs`/`provides`, -and the framework computes where that node lands. - -:::note -Because execution is per-route (a route runs only the transitive closure of its handler's -`@needs`), a plugin step that should run on **every** route must produce nothing — add it -with `provides: []`. A step that produces no token has nothing to gate on, so the framework -runs it unconditionally. See [The graph](/docs/concepts/the-graph/) for how the closure is -computed. -::: - -## Lifecycle & request events - -Subscribe to events on the `Bus` to observe boot, per-request execution, streaming, and -mesh activity without touching the pipeline itself: - -```typescript -api.bus.on('boot:provider:ready', (p: any) => { /* ... */ }); -api.bus.on('request:step:enter', (p: any) => { /* ... */ }); -api.bus.on('request:step:leave', (p: any) => { /* ... */ }); -``` - -The full event vocabulary, what each payload carries, and how requests are correlated across -them live in [Observability](/docs/guides/observability/). The short version: - -- `request:start | request:end | request:failed` — the request itself -- `route:matched | route:unmatched` — routing (`unmatched` covers both 404 and 405) -- `request:step:*` — a step entering/exiting/failing, with its own `durationMs` -- `boot:provider:*` — provider lifecycle during boot -- `stream:open | stream:close | stream:error` — SSE/WS stream lifecycle -- `mesh:connect | mesh:disconnect | mesh:rpc:error` — mesh link and RPC activity -- `plugin:mounted` — a plugin finished mounting - -Every per-request payload carries a `requestId`, so a plugin can attribute events to the request -that caused them — which matters the moment two requests overlap. - -Observation is read-only: handlers see the event payload but can't alter control flow. To -change behavior, contribute a node to your scope — see -[Dependency injection](/docs/guides/dependency-injection/). diff --git a/website/src/content/docs/guides/routing.md b/website/src/content/docs/guides/routing.md deleted file mode 100644 index 2ecf7de..0000000 --- a/website/src/content/docs/guides/routing.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: Routing -description: "Route constraints, specificity, HEAD and OPTIONS semantics, and path validation." ---- - -Routes are declared with method decorators on a `@Route`-prefixed controller. Patterns are matched **by segment**. - -## Method decorators - -| Decorator | Method / transport | -|---|---| -| `@Get` `@Head` `@Post` `@Put` `@Patch` `@Delete` `@Options` | buffered HTTP response | -| `@Sse` | server-sent events (`text/event-stream`) | -| `@Ws` | WebSocket duplex | -| `@Stream` | negotiated — SSE / ndjson / WS, picked from the client's `Accept` / `Upgrade` | - -```typescript -@Route('/users') -class Users { - @Get('/:id') get(@param('id') id: string) { /* ... */ } - @Post('/') create(@body() data: unknown) { /* ... */ } -} -``` - -The path a route matches is `joinPath(module.mountpoint, route.path)` — a controller under `@Module({ mountpoint: '/api' })` with `@Route('/users')` + `@Get('/:id')` serves `/api/users/:id`. - -## Pattern segments - -- **Static** — `users` matches exactly. -- **`:param`** — matches exactly one segment; the decoded value lands in `params.name` (`@param('id')`). -- **`:param(constraint)`** — matches one complete decoded segment when it satisfies a safe regex subset, for example `:id(\d+)`. -- **`:name*` catch-all** — a trailing segment that captures the **rest of the path, slashes included**, into `params.name`. - -```typescript -@Get('/users/:id(\\d+)') // /users/42 matches; /users/alice does not -@Get('/files/:path*') // /files/img/2026/logo.png → params.path = "img/2026/logo.png" -``` - -A catch-all also matches zero remaining segments (`/files` → `params.path = ""`). - -Constraints are anchored to the whole segment automatically. They allow character classes, alphanumeric/literal atoms, the escaped character classes `\d`, `\D`, `\s`, `\S`, `\w`, `\W`, and simple quantifiers (`+`, `*`, `?`, `{n}`, `{n,m}`). Groups, alternation, lookarounds, backreferences, anchors, and other arbitrary regex features are rejected at boot. Expressions are limited to 128 characters, counted quantifiers are capped, and unsafe adjacent unbounded quantifiers are rejected. This deliberately small subset avoids accepting route regexes with obvious ReDoS shapes. - -Patterns must start with `/`, parameter names must be unique and use identifier syntax, and a catch-all must be the final segment. Repeated slashes in a declared pattern fail at boot. - -## Precedence - -When more than one route matches the same path, the **most specific wins** — `static ▸ constrained :param ▸ plain :param ▸ catch-all` — compared segment by segment, independent of registration order. - -```typescript -@Get('/a/b') // wins for /a/b -@Get('/a/:id(\\d+)') // wins for /a/42 over the plain parameter -@Get('/a/:id') // wins for /a/x -@Get('/a/:rest*') // wins for /a/x/y -``` - -Two routes under the same method cannot have the same effective shape: `/users/:id` and `/users/:name` are ambiguous and make boot fail with both declarations named. The same rule applies after mesh routes join. Different methods may reuse a shape. - -## HEAD and OPTIONS - -An explicit `@Head` or `@Options` route always wins. Without an explicit HEAD route, HEAD falls back to a matching **buffered** GET handler, preserves its status and headers, and suppresses the body. Streaming GET routes do not become implicit HEAD routes. - -Without an explicit OPTIONS route, OPTIONS on an existing path returns `204` with a canonical `Allow` header. GET implies HEAD, and any existing path implies OPTIONS, so a GET/POST path reports `GET, HEAD, POST, OPTIONS`. A CORS preflight (OPTIONS with `Access-Control-Request-Method`) is handled before explicit or automatic OPTIONS when CORS is configured. - -## Path policy and 404 vs 405 - -`/path` and `/path/` are equivalent. Repeated slashes such as `/path//item` are rejected rather than collapsed, and malformed percent encoding is rejected; both return `400 Bad Request` with the configured security/CORS headers. Query strings do not participate in route matching. - -A path that no route matches returns `404`. A path that **does** exist but under a different method returns **`405 Method Not Allowed`** with an `Allow` header listing the methods that do match — not a `404`. - -## Matcher scale - -Route matching remains a **linear scan** — fine for typical route tables. A radix-tree matcher for very large route tables remains on the roadmap. - -See [Streaming & real-time](/docs/guides/streaming/) for `@Sse` / `@Ws` / `@Stream`, and [Argument decorators](/docs/guides/arguments/) for everything a handler can read from a request. diff --git a/website/src/content/docs/guides/runtimes.md b/website/src/content/docs/guides/runtimes.md deleted file mode 100644 index c790da8..0000000 --- a/website/src/content/docs/guides/runtimes.md +++ /dev/null @@ -1,174 +0,0 @@ ---- -title: Runtimes (Node, Deno, Bun, edge) -description: "Run Green Tea anywhere with app.fetch — the Web-Standards handler." ---- - -Green Tea exposes a Web-Standards handler, `app.fetch(request): Promise`, so the -same app runs on any runtime that speaks the Fetch API — for **HTTP and SSE** today. - -```ts -const app = createApp({ modules: [ApiModule] }); - -// Node (native listener, TLS, timeouts) -app.listen(3000); - -// Deno -Deno.serve(app.fetch); - -// Bun -Bun.serve({ fetch: app.fetch }); - -// Cloudflare / edge -export default { fetch: app.fetch }; -``` - -**Node is the reference implementation.** A parity suite pins `app.fetch` to Node's native -listener — identical status, headers, and body for the same request. The other runtimes drive -that *same* `app.fetch` / `app.upgrade` core, so they inherit that behaviour rather than -re-implementing it, and each carries its own smoke tests: Deno and Bun cover WebSocket and mesh, -and edge runs against real workerd (Miniflare). - -**All four runtimes now have full WebSocket support:** Node via `app.listen()`, Deno and Bun via -`serveDeno` / `serveBun`, and Cloudflare Workers / edge via `edgeHandler` (see below) — same graph, -same `@Ws` handlers, same rooms/channels everywhere. `app.listen()`, TLS and per-request timeouts -remain Node-only; on Deno/Bun/edge you get `app.fetch` + the runtime's adapter. **Mesh (alpha) -runs on Node, Deno and Bun** — teapot and teacup, in any combination — but not on edge. - -**Connection-limit enforcement is Node-only:** `limits.maxConnections` defaults to `1000`; values -`<= 0` leave Node's connection count unlimited. Positive values map to Node's -`server.maxConnections` when the app runs through `app.listen()`. When the cap is reached, Node -destroys excess sockets without sending an HTTP response. `Deno.serve` and `Bun.serve` expose no -equivalent active-socket cap, so `serveDeno` and `serveBun` cannot enforce this option. Apply the -connection limit at the deployment platform or reverse proxy on those runtimes. - -**Shutdown belongs to whoever owns the server.** `app.close()` is Node-only. On Deno and Bun the -app is served through `app.fetch` and never through `app.listen()`, so `app.close()` has no server -to drain and returns immediately — it warns if you passed `timeoutMs`. The server `serveDeno()` and -`serveBun()` return carries the same `close({ timeoutMs })` instead: - -```ts -const server = serveBun(app, { port: 3000 }); // or serveDeno(app, { port: 3000 }) -await server.close({ timeoutMs: 5_000 }); -``` - -On Cloudflare Workers there is nothing to close: `edgeHandler` is a handler, not a server, and the -platform owns the lifecycle. - -One difference the deadline cannot hide: - -| Runtime | After the deadline | -|---|---| -| Node | warns, then `closeAllConnections()` — the remainder is cut | -| Bun | warns, then `stop(true)` — the remainder is cut | -| Deno | warns, then **returns anyway**; the remainder ends with the process | - -Deno offers no force-close that composes with a drain already under way — aborting the signal its -server was started with throws `BadResource` once `shutdown()` is pending. So on Deno the deadline -bounds how long `close()` waits, not when the connections die. Exit the process after `close()` -resolves and the effect is the same; keep serving and it is not. - -**Body-size enforcement differs slightly:** on `app.fetch`, an oversized body is read in full -before the `413` is returned, whereas Node aborts mid-stream once the limit is hit — so on -non-Node runtimes, also bound request size at the platform/runtime layer. - -## WebSocket on Deno - -`app.fetch` covers HTTP + SSE on every runtime. WebSocket needs a runtime-specific -upgrade, so Deno gets a dedicated adapter at `@green-tea/core/deno`: - -```ts -import { createApp } from '@green-tea/core'; -import { serveDeno } from '@green-tea/core/deno'; - -const app = createApp({ modules: [ChatModule] }); - -// HTTP + SSE via app.fetch, WebSocket via Deno.upgradeWebSocket — one call: -serveDeno(app, { port: 8000 }); -``` - -`serveDeno` routes normal requests through `app.fetch` and WebSocket upgrades through -`app.upgrade` — the same graph, the same `@Ws` handlers, the same rooms/channels you -run on Node. Behaviour matches the Node reference. - -**Advanced:** `app.upgrade(request, socket)` is the neutral primitive `serveDeno` uses. -Any runtime can build a `WsSocket` capability (`inbound`, `abort`, `isOpen`, `send`, -`close`, `terminate`) and drive the graph — `serveBun` and `edgeHandler` build on the -same primitive (see below). - -**Still Node-only:** `app.listen()`, TLS and per-request timeouts. On Deno you get -`app.fetch` + `serveDeno`. [Mesh](/docs/guides/mesh/) works here: the control channel is -served through `app.upgrade` and the teacup connects with Deno's global `WebSocket`. - -## WebSocket on Bun - -`app.fetch` covers HTTP + SSE on every runtime. WebSocket needs a runtime-specific -upgrade, so Bun gets a dedicated adapter at `@green-tea/core/bun`: - -```ts -import { createApp } from '@green-tea/core'; -import { serveBun } from '@green-tea/core/bun'; - -const app = createApp({ modules: [ChatModule] }); - -// HTTP + SSE via app.fetch, WebSocket via Bun's server-level handler — one call: -serveBun(app, { port: 8000 }); -``` - -`serveBun` routes normal requests through `app.fetch` and WebSocket upgrades through -`app.upgrade` — the same graph, the same `@Ws` handlers, the same rooms/channels you -run on Node and Deno. Behaviour matches the Node reference. - -**Still Node-only:** `app.listen()`, TLS and per-request timeouts. On Bun you get -`app.fetch` + `serveBun`. [Mesh](/docs/guides/mesh/) works here too. - -## Cloudflare Workers / edge - -`app.fetch` covers HTTP + SSE on every runtime. WebSocket needs a runtime-specific -upgrade, so Cloudflare Workers get a dedicated adapter at `@green-tea/core/edge`: - -```ts -import { createApp } from '@green-tea/core'; -import { edgeHandler } from '@green-tea/core/edge'; - -const app = createApp({ modules: [ChatModule] }); - -export default { fetch: edgeHandler(app) }; -``` - -`edgeHandler` routes normal requests through `app.fetch` and WebSocket upgrades through -`WebSocketPair` and `app.upgrade` — the same neutral primitive `serveDeno` and `serveBun` -use. Same graph, same `@Ws` handlers, same rooms/channels as Node/Deno/Bun; behaviour -matches the Node reference; validated on real workerd (Miniflare). - -**Requirement:** the Worker must enable the `nodejs_compat` compatibility flag — -`wrangler.toml`: - -```toml -compatibility_flags = ["nodejs_compat"] -compatibility_date = "2024-09-23" # or later -``` - -Green Tea's core statically imports Node built-ins that workerd only provides under -this flag; without it, the Worker fails to load. - -**Still Node-only:** `app.listen()`, TLS and per-request timeouts. [Mesh](/docs/guides/mesh/) -is **not** supported on edge: the teapot's secret comparison needs `node:crypto`'s -`timingSafeEqual`, which `nodejs_compat` does not provide. Cloudflare's -Durable Objects and WebSocket Hibernation are **not** used — `edgeHandler` accepts -WebSockets with the standard `WebSocketPair` model, so a Worker holds the connection -open for its lifetime rather than hibernating between messages. - -## Filesystem features — Node/Deno/Bun only - -A few [HTML & views](/docs/guides/html/) features read from disk, so they need a runtime with -a filesystem: - -- `@Html('file.html')` — reads and caches the file at boot. -- `@Html('file.html', { template: true })` — same, then renders it per request. -- `createApp({ static })` — serves a directory of files. - -All three throw at boot (`createApp()`/route-build time) on a runtime without a -filesystem, rather than failing per-request. On the edge, use bare `@Html` returning a -string instead — pair it with the exported `render` over a template string you `import` -as a module (so it ships in the bundle, no disk read), and serve other assets (images, -CSS, JS) from a CDN in front of the Worker. diff --git a/website/src/content/docs/guides/security.md b/website/src/content/docs/guides/security.md deleted file mode 100644 index 8cf89a6..0000000 --- a/website/src/content/docs/guides/security.md +++ /dev/null @@ -1,103 +0,0 @@ ---- -title: Transport security -description: "TLS and wss, secure-by-default headers, CORS, and trustProxy." ---- - -Four `createApp` options cover TLS, proxying, CORS, and response headers: `tls`, -`trustProxy`, `cors`, and `security`. See the [`createApp` reference](/docs/reference/createapp/) -for the full option list. - -## TLS (native https/wss) - -```typescript -import { readFileSync } from 'fs'; - -const app = createApp({ - modules: [App], - tls: { key: readFileSync('key.pem'), cert: readFileSync('cert.pem') }, -}); -``` - -When `tls` is set the server serves https, and WebSocket upgrades become wss on the same -port — no other changes. - -## `trustProxy` - -```typescript -const app = createApp({ modules: [App], trustProxy: true }); -``` - -Behind a reverse proxy, reads `X-Forwarded-Proto` / `X-Forwarded-For` to populate -`ctx.protocol` (`'http' | 'https'`) and `ctx.ip` (read via `@ctx()`). Off by default — -forwarded headers are ignored (and spoofable) until you opt in. It trusts the immediate hop -unconditionally; there's no CIDR allowlist yet. - -## CORS - -Off unless `origins` is set. - -```typescript -const app = createApp({ - modules: [App], - cors: { origins: 'https://app.example.com', credentials: true }, -}); -``` - -`origins` accepts `string | string[] | '*' | (origin) => boolean`. A preflight `OPTIONS` -request (with `Access-Control-Request-Method`) is auto-answered with 204 before explicit or -automatic OPTIONS routing. A bare OPTIONS request is instead handled by an explicit `@Options` -route or the router's automatic `204` + `Allow` response. - -- With `credentials: true`, the server **never** sends `Access-Control-Allow-Origin: *` — it - echoes the concrete allowed origin (or blocks the request). - -:::caution[Reflect-any foot-gun] -`origins: '*'` together with `credentials: true` reflects *any* origin with credentials -attached. Only combine them if you truly intend an open credentialed API; prefer an explicit -allowlist. -::: - -## `security` (headers, ON by default) - -Applied to every HTTP response. Disable everything with `security: false`, or override -individual headers with an options object. - -| Header | Default | -|---|---| -| `X-Content-Type-Options` | `nosniff` | -| `X-Frame-Options` | `SAMEORIGIN` | -| `Referrer-Policy` | `no-referrer` | -| `X-DNS-Prefetch-Control` | `off` | -| `Strict-Transport-Security` | `max-age=15552000` (180d) — **only when the connection is secure** (native TLS, or `trustProxy` + `X-Forwarded-Proto: https`); no `includeSubDomains`/`preload` | -| `Content-Security-Policy` | not set — pass `security: { csp: "..." }` | - -```typescript -const app = createApp({ modules: [App], security: { csp: "default-src 'self'" } }); -``` - -:::note[Scope caveat] -`security` and `cors` headers apply to HTTP responses; they do **not** apply to the -WebSocket handshake (101/upgrade) response. -::: - -:::caution[TLS + trustProxy] -HSTS is emitted only when the connection is judged secure. With `trustProxy: true` that -judgement trusts the incoming `X-Forwarded-Proto` header — so a client that spoofs -`X-Forwarded-Proto: http` past a permissive proxy can make the server treat the request as -insecure and **suppress the HSTS header**. Only enable `trustProxy` behind a proxy that -strips and sets forwarded headers itself, and terminate TLS where you control that hop. -::: - -## Defaults - -| Option | Default | -|---|---| -| `tls` | off (plain http/ws) | -| `trustProxy` | off | -| `cors` | off (same-origin only) | -| `security` | ON (HSTS only when the connection is secure) | - -## Related - -- [`createApp` reference](/docs/reference/createapp/) — every construction option -- [File uploads / multipart](/docs/guides/uploads/) — request-body handling diff --git a/website/src/content/docs/guides/streaming.md b/website/src/content/docs/guides/streaming.md deleted file mode 100644 index 6755975..0000000 --- a/website/src/content/docs/guides/streaming.md +++ /dev/null @@ -1,116 +0,0 @@ ---- -title: Streaming & real-time -description: "SSE, ndjson, and WebSocket duplex from one AsyncIterable primitive." ---- - -Most stacks treat "push data over time" as a bolt-on: Express reaches for a `ws` or SSE library, Fastify for a plugin, NestJS for a separate **WebSocket Gateway** with its own adapter and decorators. That's a second mental model, a second error surface, glued to your HTTP app. - -green-tea has one model: an **`AsyncIterable`**. A handler that returns a sequence of values over time *is* a stream — the same shape you'd return from any function. You **declare the mode** with a decorator; the framework handles framing, backpressure, cleanup, and disconnects. - -## One primitive, three modes - -| Declare | Direction | Transport | Reach for it when | -|---|---|---|---| -| `@Sse` | server → client | `text/event-stream` | live updates to a browser (`EventSource`) | -| `@Ws` | duplex | WebSocket | chat, collaboration — anything two-way | -| `@Stream` | negotiated | SSE / ndjson / WS, picked from the client's `Accept` / `Upgrade` | one handler, the client chooses | - -The primitive never changes — it's always an `AsyncIterable`. What changes is **direction and framing**, and you declare which. That's the difference between each iterable green-tea hands you: - -- **`@Sse`** — you return **one** iterable: the *outbound* stream. Each `yield` becomes an SSE event, or an ndjson line. -- **`@Ws` (duplex)** — **two** iterables. `@inbound()` gives you the client's *incoming* messages to consume; the one you **return** is the *outbound* stream to the client. `@abort()` hands you an `AbortSignal` for teardown. -- **`@Stream`** — you write the handler once; the client's request decides whether it arrives as SSE, ndjson, or a WebSocket. No branching in your code. - -:::note -Streaming bypasses the response transformer — the transport frames each value directly, handles backpressure, and cleans up on disconnect. See [arguments](/docs/guides/arguments/) for the full list of argument decorators, including the stream-only `@inbound()` and `@abort()`. -::: - -## Streaming — SSE - -A route decorated `@Sse` streams — that's what triggers it, not the return value. It must return an `AsyncIterable`; the transport frames each value as an SSE event, handles backpressure, and cleans up on disconnect (the transformer is bypassed). - -```typescript -import { Route, Sse } from '@green-tea/core'; - -@Route('/feed') -class FeedController { - @Sse('/ticks') - ticks() { - return (async function* () { - for (let n = 1; n <= 3; n++) yield { tick: n }; - })(); - } -} -// GET /feed/ticks (Accept: text/event-stream) -// data: {"tick":1} -// data: {"tick":2} -// data: {"tick":3} -``` - -`@Stream(path)` negotiates the transport by header (`Accept: text/event-stream` → SSE, `Upgrade: websocket` → WS, else ndjson chunked). - -## Streaming — WebSocket duplex - -A WS handler receives the **inbound** channel and returns the **outbound** channel — a step that consumes one channel and produces another. - -```typescript -import { Route, Ws, inbound, channel } from '@green-tea/core'; - -@Route('/chat') -class ChatController { - @Ws('/echo') - echo(@inbound() incoming: AsyncIterable) { - const out = channel(); - (async () => { - for await (const msg of incoming) out.push(`echo: ${msg}`); - out.close(); - })(); - return out; - } -} -``` - -`channel()` is a multicast `AsyncIterable` with `push` / `close` / `fail` and an optional bounded buffer (`channel({ buffer: 100 })`, drop-oldest). - -:::note[WebSocket needs the `ws` peer] -`@Ws` (and mesh) require the optional [`ws`](https://github.com/websockets/ws) peer dependency — `npm i ws`. SSE, ndjson, and plain HTTP need nothing extra. -::: - -## Fan-out — `channel()` and `rooms` - -Fan-out is a primitive too: `channel()` is a **multicast** `AsyncIterable` (bounded, drop-oldest) so one source feeds many subscribers, and `rooms` are named broadcast hubs — publish once, every connection in the room receives it. - -```typescript -@Route('/live') -class Live { - @Sse('/prices') // one iterable out — each yield is an event - prices() { - return (async function* () { - while (true) { yield { btc: await getPrice() }; await sleep(1000); } - })(); - } - - @Ws('/echo') // duplex — consume @inbound, return the outbound stream - echo(@inbound() incoming: AsyncIterable) { - const out = channel(); - (async () => { for await (const m of incoming) out.push(`echo: ${m}`); out.close(); })(); - return out; - } -} -``` - -Same `@Route`, same handler shape, same `AsyncIterable` — real-time is not a separate framework you also have to learn. - -`rooms` is the built-in shared `Rooms` primitive (one instance app-wide). A typical chat handler pumps the `@inbound()` channel into `rooms.room(name)` and returns that same room as its outbound channel, so every joined socket multicasts to the others. A handshake `@Step` can read `?token=` and throw `Unauthorized` — which closes the socket with code **4401** (`4000 + status`). See [security](/docs/guides/security/) for handshake authentication. - -## Transport is declared, not inferred - -A route streams **because** it's declared `@Sse`, `@Stream`, or `@Ws` — never because a handler happened to return an `AsyncIterable`. In most frameworks the return type decides the wire format; in green-tea the decorator decides, and the return value is enforced against it: - -| Declare | Handler must return | Otherwise | -|---|---|---| -| `@Get` / `@Head` / `@Post` / `@Put` / `@Patch` / `@Delete` / `@Options` (buffered) | a value | returning an `AsyncIterable` fails with a 500 `TransportMismatchError` | -| `@Sse` / `@Ws` (streaming) | an `AsyncIterable` | returning a plain value fails with a 500 `TransportMismatchError` | -| `@Stream` (negotiate) | either | the client picks via `Accept` / `Upgrade` — no mismatch | - -This is the anti-Express guarantee: your wire contract is what you **declared**, never a surprise sprung by a return value. A buffered route can't accidentally start streaming because someone returned a generator; a streaming route can't silently downgrade to a buffered response because someone forgot a `yield`. Declare `@Sse` / `@Stream` / `@Ws` to stream — the return value never changes a route's transport. diff --git a/website/src/content/docs/guides/testing.md b/website/src/content/docs/guides/testing.md deleted file mode 100644 index b9ff592..0000000 --- a/website/src/content/docs/guides/testing.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -title: Testing -description: "Swap any node with createApp overrides for fast, isolated tests." ---- - -Any provider or step is addressable by its **token**, so you can swap it for a test double -at construction time — no monkey-patching, no module rewiring. - -## Override tokens in tests - -Pass `overrides` to `createApp`. Each key is a token; each value is either a plain object -(wrapped as `{ token: value }`) or a function runner: - -```typescript -const app = createApp({ - modules: [ApiModule], - overrides: { - db: { find: () => ({ id: 'test-user' }) }, // plain object — wrapped as { db: value } - user: () => ({ user: { id: 'stub' } }), // function runner - }, -}); -``` - -Overrides replace **only** the named token's runner; the rest of the graph is untouched. The -route still runs its full closure — you've just substituted what one node produces. - -:::note -An override for an unknown token throws. The set of tokens is validated against the real -graph, so a typo'd or stale override is a construction-time error, not a silent no-op. -::: - -This pairs well with [`app.explain(route)`](/docs/guides/introspection/) — explain the chain to -see which tokens a route actually depends on, then override exactly those. diff --git a/website/src/content/docs/guides/uploads.md b/website/src/content/docs/guides/uploads.md deleted file mode 100644 index e0275af..0000000 --- a/website/src/content/docs/guides/uploads.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -title: File uploads -description: "multipart parsing via the optional busboy peer dependency." ---- - -A request with `Content-Type: multipart/form-data` makes `@body()` resolve to `{ fields, files }` instead of a plain object. - -:::caution[multipart needs the optional `busboy` peer] -Multipart parsing uses the optional [`busboy`](https://github.com/mscdex/busboy) peer dependency — install it with `npm i busboy`. A `multipart/form-data` request to a server without busboy installed returns **`501`**. (JSON and urlencoded need nothing extra.) -::: - -```typescript -import { Route, Post, body } from '@green-tea/core'; -import type { MultipartBody } from '@green-tea/core'; - -@Route('/profile') -class ProfileController { - @Post('/avatar') - upload(@body() form: MultipartBody) { - const name = form.fields.name; // string | string[] - const avatar = form.files.avatar; // UploadedFile | UploadedFile[] - return { name, size: Array.isArray(avatar) ? undefined : avatar?.size }; - } -} -``` - -`UploadedFile` is `{ filename, contentType, data: Buffer, size }` — the whole file is buffered in memory, no temp files. - -:::note[Access asymmetry] -For multipart, `@body('title')` returns `undefined` — the value lives at `body.fields.title`, not `body.title`, unlike JSON/urlencoded where `@body('title')` picks the value directly. Use `@body()` and read `.fields`/`.files`, or key into the envelope itself with `@body('fields')` / `@body('files')`. See [arguments](/docs/guides/arguments/) for how `@body()` behaves across content types. -::: - -## Repeated fields — `bodyDuplicates` - -By default, a repeated field name keeps the **last** value (`'last'`, matching urlencoded). Set `bodyDuplicates: 'array'` on `createApp` to accumulate repeats into a `string[]` instead — this applies to **both** urlencoded and multipart text fields: - -```typescript -const app = createApp({ modules: [ApiModule], bodyDuplicates: 'array' }); -``` - -Files under a repeated field name always become an array (`UploadedFile[]`), regardless of `bodyDuplicates`. - -## Per-endpoint override - -```typescript -@Post('/upload', { duplicates: 'array' }) -upload(@body() form: MultipartBody) { /* ... */ } -``` - -Precedence: route `duplicates` → app `bodyDuplicates` → `'last'`. - -## Limits - -Uploaded files are held in memory, so they're bounded by the same `maxBodyBytes` limit as any other request body (over the limit → **413**). `maxParts` (default `1000`) caps the number of multipart parts per request: - -```typescript -const app = createApp({ modules: [ApiModule], limits: { maxParts: 500 } }); -``` - -Both limits can be overridden **per route** — an upload endpoint can allow a larger body than the rest of the API: - -```typescript -@Post('/avatar', { maxBodyBytes: 5_000_000, maxParts: 20 }) -uploadAvatar(@body() form: MultipartBody) { /* ... */ } -``` - -A route's `maxBodyBytes` / `maxParts` fall back to the server-wide `limits` when unset. A malformed multipart body (bad boundary, missing headers, truncated part) → **400**. - -:::note -To validate parsed fields against a schema, pass a Standard Schema to `@body()` — see [validation](/docs/guides/validation/). -::: diff --git a/website/src/content/docs/guides/validation.md b/website/src/content/docs/guides/validation.md deleted file mode 100644 index ce735c8..0000000 --- a/website/src/content/docs/guides/validation.md +++ /dev/null @@ -1,84 +0,0 @@ ---- -title: Validation -description: "Validate and coerce input with Standard Schema (zod, valibot, arktype)." ---- - -`@body`, `@query`, `@headers`, and `@param` accept an optional **Standard Schema** -(the [`~standard` interface](https://standardschema.dev) shared by zod, valibot, arktype, -and others). green-tea's core has **zero runtime dependency** on any of them — bring -whichever validator you already use. - -```typescript -import { z } from 'zod'; -import { Route, Post, body } from '@green-tea/core'; - -const CreateUser = z.object({ email: z.string().email() }); - -@Route('/users') -class UserController { - @Post('/') - create(@body(CreateUser) user: { email: string }) { - return { created: user.email }; - } -} -``` - -## Parsed value replaces the argument; `ctx` stays raw - -The value the handler receives is the schema's **parsed/coerced output**, not the raw -input — `ctx.body` (via `@ctx()` or a `@needs`-fed step) stays exactly what the transport -parsed. Query strings are always strings on the wire, so a schema is often the coercion -point: - -```typescript -const ListQuery = z.object({ page: z.coerce.number() }); - -@Get('/list') -list(@query(ListQuery) q: { page: number }) { - return { page: q.page, isNum: typeof q.page === 'number' }; // GET /list?page=2 → true -} -``` - -## Where the schema goes (the one asymmetry) - -:::note[Access shape] -`@param('id', Schema)` takes the key in slot 1 and the schema in slot 2 — `@param` always -needs a name to say which route param it binds. `@body(Schema)`, `@query(Schema)`, and -`@headers(Schema)` take the schema as their **only** argument, validating the whole parsed -object (all of `body`/`query`/`headers`). -::: - -See [Argument decorators](/docs/guides/arguments/) for the full slot semantics of each decorator. - -## Failure: 422 with per-field issues - -A failing schema short-circuits the request with **422**: - -```json -{ "error": "Validation failed", "source": "body", "issues": [{ "path": "email", "message": "Invalid email" }] } -``` - -`source` is which envelope failed (`'body' | 'query' | 'params' | 'headers'`); `issues` is -the schema's issues flattened to `{ path, message }` (`path` is dot-joined). - -## Caveats - -- **Fail-fast.** Arguments validate in order; the **first** failing one throws — later args in - the same handler are not checked in that request. -- **Steps see raw input.** Only the resolved handler argument is coerced/validated; a `@Step` - reading the same data via `ctx.body`/`ctx.query`/etc. always sees the untouched value. -- **A throwing schema is a 500, not a 422.** The Standard Schema contract says `validate()` - returns `{ issues }` on failure — it isn't supposed to throw. If it does anyway, that - propagates as an uncaught error (→ 500), since it signals a bug in the schema, not user input. -- **Async schemas are awaited** — `validate()` returning a `Promise` works transparently. - -:::note[Not covered yet] -Response/output validation, validating a `@Step`'s own inputs, and mesh remote-route -validation are all out of scope for this feature. -::: - -## Related - -- [Argument decorators](/docs/guides/arguments/) — every slot decorator and its parsing rules -- [File uploads / multipart](/docs/guides/uploads/) — how multipart bodies are parsed before validation -- [`createApp` reference](/docs/reference/createapp/) — app construction options diff --git a/website/src/content/docs/index.mdx b/website/src/content/docs/index.mdx deleted file mode 100644 index b774c65..0000000 --- a/website/src/content/docs/index.mdx +++ /dev/null @@ -1,47 +0,0 @@ ---- -title: Green Tea. -description: A zen, opinionated, type-safe framework — your API is a graph you can see, slice, and trust, not a chain. -template: splash -hero: - image: - file: ../../assets/logo.svg - alt: Green Tea - tagline: A zen, opinionated, type-safe framework. Your API is a dependency graph you can see, slice, and trust — not a mutable bag threaded through positional middleware. That's the tea. 🍵 - actions: - - text: Get started - link: /docs/getting-started/ - icon: right-arrow - variant: primary - - text: The idea - link: /docs/concepts/the-graph/ - icon: open-book - variant: minimal ---- - -import { Card, CardGrid } from '@astrojs/starlight/components'; - -## Less to hold in your head - -Most frameworks make you keep the whole request in your head: which middleware ran, whether `req.user` exists by now, what fired in what order. green-tea puts the request **on the page** — you declare what each step _needs_ and _produces_, and the framework computes the order, type-checks the wiring, and can print the whole thing. - - - - Declare `needs`/`provides`; green-tea topologically sorts it. No ordering bugs, no positional guesswork — each route runs only its slice of the graph. - - - In the typed `flow` core, a handler that reads `ctx.user` **fails to compile** if no step produces `user`. "It was undefined in prod" disappears at build time. - - - `app.explain('/users/:id')` prints the ordered chain; `GET /__graph__` renders it as a live diagram. Onboarding and audits are reading, not archaeology. - - - Declare `@Sse`, `@Stream`, or `@Ws` and return an `AsyncIterable` — the transport streams it (SSE, ndjson, or a WebSocket duplex) with backpressure and cleanup handled. No separate gateway. - - - Node, Deno, Bun, and the edge — the same app, you only swap the entry point. HTTP, SSE, and WebSocket behave identically on all four. - - - -:::note[Beta] -green-tea is **beta**, on the RC track. One runtime dependency (`reflect-metadata`); `ws` and `busboy` are optional peers. [mesh](/docs/guides/mesh/) is alpha and gated behind an explicit opt-in. -::: diff --git a/website/src/content/docs/reference/createapp.md b/website/src/content/docs/reference/createapp.md deleted file mode 100644 index 937e556..0000000 --- a/website/src/content/docs/reference/createapp.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -title: createApp options -description: "Every option accepted by createApp and every method on the App it returns." ---- - -```typescript -const app = createApp(options); -``` - -## Options - -| Option | Type | Default | Meaning | -|---|---|---|---| -| `modules` | `Ctor[]` | — | the `@Module` classes to wire (required) | -| `plugins` | `Plugin[]` | `[]` | plugins, each limited to `bus.on` + `scope.add` ([plugins](/docs/guides/plugins/)) | -| `limits` | `RequestLimits` | see below | body-size and timeout ceilings | -| `devGraph` | `boolean` | `false` | mount `GET /__graph__` ([introspection](/docs/guides/introspection/)) | -| `devOpenapi` | `boolean` | `false` | mount `GET /__openapi__` serving the [OpenAPI](/docs/guides/openapi/) document | -| `overrides` | `Record` | — | swap any node by token ([testing](/docs/guides/testing/)) | -| `tls` | `TlsOptions` | — | serve over https/wss | -| `trustProxy` | `boolean` | `false` | honor `X-Forwarded-*` for `ctx.protocol` / `ctx.ip` | -| `security` | `boolean \| SecurityOptions` | `true` | secure-by-default headers ([security](/docs/guides/security/)) | -| `cors` | `CorsOptions` | — | CORS handling | -| `bodyDuplicates` | `'array' \| 'last'` | `'last'` | policy for repeated form fields | -| `onError` | `ErrorRenderer` | — | render errors your way ([error handling](/docs/guides/errors/)); returns a response or `undefined` to fall back to JSON | -| `views` | `string` | `process.cwd()` | base dir `@Html('file.html')` paths resolve against — relative paths join it, absolute paths are used as-is ([HTML & views](/docs/guides/html/)) | -| `viewEngine` | `(source: string, data: unknown) => string` | built-in `render` | swap in your own template engine for `@Html(..., { template: true })`; template mode only ([HTML & views](/docs/guides/html/)) | -| `static` | `boolean \| string` | — | serve a directory as a `GET`/`HEAD` fallback (after declared routes, before `404`); `true` → `./public`, a string → that dir; path-traversal-safe; needs a filesystem — Node/Deno/Bun only ([HTML & views](/docs/guides/html/)) | -| `logger` | `Logger` | structured JSON (readable on a TTY) | where every framework diagnostic is written; also injectable as `@needs('logger')` ([observability](/docs/guides/observability/)) | -| `logRequests` | `boolean` | `false` | log one line per completed request and per failure; a removable Bus subscriber, not a middleware ([observability](/docs/guides/observability/)) | -| `shutdownTimeoutMs` | `number` | `10_000` | how long `close()` gives in-flight work before forcing the rest shut; `close({ timeoutMs })` still wins per call. Set it here when `close()` is reached from a signal handler or shutdown hook you do not own ([runtimes](/docs/guides/runtimes/)) | -| `mesh` | `MeshConfig` | — | distributed DI — **requires `experimental: true`** ([mesh](/docs/guides/mesh/)) | -| `experimental` | `boolean` | `false` | opt in to alpha features (currently gates `mesh`) | -| `warnGraphDepth` | `number \| false` | `20` | warn when one route resolves to more than this many steps; `false` disables the design warning | - -### `RequestLimits` - -| Field | Default | -|---|---| -| `maxBodyBytes` | `1_000_000` (→ `413` when exceeded) | -| `maxConnections` | `1000` (Node only; `<= 0` means unlimited) | -| `requestTimeoutMs` | `30_000` | -| `headersTimeoutMs` | `10_000` | -| `keepAliveTimeoutMs` | `5_000` | -| `maxParts` | `1000` (multipart) | - -### `TlsOptions` - -`{ key, cert, ca?, passphrase? }` — `key`/`cert` are `Buffer | string`. - -### `CorsOptions` - -`{ origins, methods?, allowedHeaders?, exposedHeaders?, credentials?, maxAge? }`. `origins` is a string, array, `'*'`, or a `(origin) => boolean` predicate. `credentials: true` is never combined with `'*'`. - -### `SecurityOptions` - -`{ hsts?, frameOptions?, referrerPolicy?, noSniff?, dnsPrefetchControl?, csp? }`. HSTS is only emitted on secure connections. `csp` is opt-in. - -### `MeshConfig` - -`{ secret?, teapots?, timeoutMs?, heartbeatMs? }` — `teapots` is `{ url, secret }[]`; `timeoutMs` bounds an RPC (default 30s, → 504), `heartbeatMs` is the ping gap that detects a half-open link (default 15s, → 503). See [Mesh](/docs/guides/mesh/). - -## The `App` - -`createApp` returns an `App`: - -| Member | Returns | Notes | -|---|---|---| -| `listen(port)` | `Promise` | boots providers, then serves | -| `close({ timeoutMs? })` | `Promise` | drains in-flight, closes streams + mesh links; after the deadline (default `10s`, or `createApp({ shutdownTimeoutMs })`) it warns and force-closes what is left. Node-only — see [runtimes](/docs/guides/runtimes/) | -| `ready()` | `Promise` | resolves the graph and mesh links without booting providers | -| `fetch(request)` | `Promise` | Web-Standards HTTP/SSE handler for Node, Deno, Bun, and edge | -| `upgrade(request, socket)` | `Promise` | neutral WebSocket upgrade used by non-Node adapters | -| `inspect(route)` | `InspectLine[]` | the provider/step/handler chain for a route | -| `explain(route)` | `Explain` | the chain annotated with each node's needs/provides | -| `graph()` | `GraphView` | the full node + route graph | -| `toMermaid()` / `toDOT()` | `string` | render the graph | -| `openapi(info?)` | `OpenApiDoc` | structural OpenAPI 3.1 document ([details](/docs/guides/openapi/)) | -| `degraded()` | `string[]` | optional providers running degraded (empty until providers boot through `fetch`, `upgrade`, or `listen`) | -| `bus` | `Bus` | lifecycle + request event bus ([observability](/docs/guides/observability/)) | -| `logger` | `Logger` | the app's logger — the one passed in, or the default | - -:::note -On mesh apps, `graph` / `explain` / `inspect` / `degraded` are only available after `ready()` or the first serving call — the graph is finalized once remote scopes connect. -::: diff --git a/website/src/content/docs/reference/decorators.md b/website/src/content/docs/reference/decorators.md deleted file mode 100644 index b915a7a..0000000 --- a/website/src/content/docs/reference/decorators.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -title: Decorators -description: "Full reference for every class, method, and argument decorator." ---- - -Every decorator green-tea exports, grouped by where it applies. All require `experimentalDecorators: true` in your `tsconfig` — see [Why legacy decorators](/docs/concepts/the-graph/#why-legacy-decorators). - -## Structure - -### `@Module(options)` - -Marks a class as a module and records what it wires together. - -```typescript -@Module({ - mountpoint: '/api', // path prefix for this module's controllers (required) - providers: [Database], // app-scope @Provider classes - steps: [Authenticate], // request-scope @Step classes - controllers: [UserCtl], // @Route classes -}) -class ApiModule {} -``` - -### `@Route(prefix)` - -Marks a class as a controller; `prefix` is prepended to each route path. - -## Providers & steps - -### `@Provider(options)` - -An app-scope value, built once at boot and cached, addressable by `provides`. - -| Option | Type | Default | Meaning | -|---|---|---|---| -| `provides` | `string` | — | the token this provider produces (required) | -| `needs` | `string[]` | `[]` | tokens it depends on | -| `optional` | `boolean` | `false` | if it throws on boot, degrade instead of aborting ([details](/docs/guides/dependency-injection/)) | -| `export` | `boolean` | `false` | expose over the mesh control channel ([mesh](/docs/guides/mesh/)) | - -### `@Step(options)` - -A request-scope transform that merges keys into the context. Same options as `@Provider`. - -### `@Transformer(fn)` - -Method decorator. Turns a handler's return value into `{ status?, headers?, body }`. `JsonTransformer` is the default. - -### `@Html` / `@Html(path, opts?)` - -Method decorator. Marks a buffered `GET`/`POST` handler as serving HTML instead of going through the JSON transformer. Three modes ([details](/docs/guides/html/)): - -| Form | Behavior | -|---|---| -| `@Html` (bare) | sends the handler's returned string as `text/html` | -| `@Html('file.html')` | serves that file verbatim; the handler's return value is ignored | -| `@Html('file.html', { template: true })` | renders the file with the handler's returned data, via the built-in `render` engine or `viewEngine` ([createApp](/docs/reference/createapp/)) | - -Only buffered `GET`/`POST` routes are supported, and `@Html` can't be combined with `@Transformer` on the same handler — both are validated at boot, not per-request. - -## Routes - -Method decorators on a controller. All accept `(path, opts?)` where `opts = { export?: boolean, duplicates?: 'array' | 'last', maxBodyBytes?: number, maxParts?: number }`. `maxBodyBytes` / `maxParts` override the server-wide [`limits`](/docs/reference/createapp/) for this route only. - -| Decorator | Method | Transport | -|---|---|---| -| `@Get` `@Head` `@Post` `@Put` `@Patch` `@Delete` `@Options` | as named | buffered response | -| `@Sse` | GET | `text/event-stream` | -| `@Ws` | GET | WebSocket duplex | -| `@Stream` | GET | negotiated (SSE / ndjson / WS) | - -```typescript -@Get('/ping', { export: true }) // exportable over mesh -@Post('/upload', { duplicates: 'array' }) // repeated form fields → arrays -@Post('/avatar', { maxBodyBytes: 5_000_000, maxParts: 20 }) // per-route upload limits -``` - -See [Routing](/docs/guides/routing/) for pattern matching and [Streaming](/docs/guides/streaming/) for the transports. - -`@Head` and `@Options` declare explicit handlers. When they are absent, the router can provide an implicit buffered-GET HEAD response or an automatic `204` OPTIONS response; those fallbacks are runtime behavior, not decorator metadata. - -## Arguments - -A handler's signature declares exactly what it wants, in any order. - -| Decorator | Injects | Forms | -|---|---|---| -| `@needs('user')` | a graph-produced value (boot-validated) | `('key')` | -| `@ctx()` | the whole accumulated context | `()` | -| `@param(...)` | route params | `()` · `('id')` · `('id', schema)` | -| `@query(...)` | parsed query string | `()` · `('q')` · `(['a','b'])` · `(schema)` | -| `@body(...)` | parsed body (JSON / urlencoded / multipart) | `()` · `('field')` · `(schema)` | -| `@headers(...)` | request headers (whole bag or picked) | `()` · `('authorization')` · `(['a','b'])` · `(schema)` | -| `@header('name')` | one request header (singular alias of `@headers`) | `('x-trace')` · `('x-count', schema)` | -| `@inbound()` | the incoming message stream (WebSocket) | `()` | -| `@abort()` | the request's `AbortSignal` | `()` | - -Passing a [Standard Schema](/docs/guides/validation/) validates and coerces the value before the handler sees it. Full details in [Argument decorators](/docs/guides/arguments/). diff --git a/website/src/styles/brand.css b/website/src/styles/brand.css deleted file mode 100644 index 0f94940..0000000 --- a/website/src/styles/brand.css +++ /dev/null @@ -1,32 +0,0 @@ -/* Green Tea. — brand theme for Starlight */ -@import url('https://fonts.googleapis.com/css2?family=Zen+Maru+Gothic:wght@500;700&display=swap'); - -/* Accent = matcha (dark theme in :root, light overridden below) */ -:root { - --sl-color-accent-low: #14352a; - --sl-color-accent: #348a5f; - --sl-color-accent-high: #b9e8cf; - --sl-color-text-accent: #6fc599; - --gt-purple: #a78bfa; -} -:root[data-theme='light'] { - --sl-color-accent-low: #d3efe1; - --sl-color-accent: #2f8a5f; - --sl-color-accent-high: #123528; - --sl-color-text-accent: #2f8a5f; - --gt-purple: #7c6cf0; -} - -/* Brand type: Zen Maru for the site title and headings */ -.site-title, -h1, h2, h3 { - font-family: 'Zen Maru Gothic', var(--sl-font, sans-serif); -} -.site-title { font-weight: 700; } -.site-title img { height: 1.7rem; width: auto; } - -/* Splash hero logo */ -.hero img { max-height: 190px; width: auto; } - -/* A little zen: soften the accent link underlines */ -a { text-underline-offset: 0.15em; } diff --git a/website/tsconfig.json b/website/tsconfig.json deleted file mode 100644 index 8bf91d3..0000000 --- a/website/tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "extends": "astro/tsconfigs/strict", - "include": [".astro/types.d.ts", "**/*"], - "exclude": ["dist"] -} From 9f72604cbb8233bd34bf3ed29f6fddcde875481a Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Mon, 17 Aug 2026 10:32:23 -0500 Subject: [PATCH 31/46] docs(plans): design the shutdown teardown surface, before any code Task 2.5 has been open since it was raised while deciding #15, deliberately: it needs public API, and the API freeze is the next milestone. Three things the design settles that the task description did not anticipate. Teardown reaches the graph through hooks, PluginApi and a provider dispose(), but all three are doors into one registry with one order and one failure policy. Shipping the plugin half now and providers later would freeze two mechanisms with different semantics around the less common case: the thing that holds a database connection is a provider, not a plugin. The hooks framing also means PluginApi's signature never changes, so nothing breaks at all, which widening it directly would not have achieved. Callbacks receive nothing. State lives in the closure that registered it, so no handle crosses a scope and no container, app reference or transport is needed. That is what makes this a registry rather than an event bus. It fires from each runtime's real close, not app.close(), which returns at its no-server guard on everything except Node. Edge cannot participate at all and that is documented as a capability difference rather than hidden. Recorded while verifying: "isolation is structural" protects the registration surface, not the runtime context. A plugin's step can already overwrite context keys, and a plugin mounting before provideBuiltins can replace the logger and rooms builtins. Pre-existing and unrelated to teardown, noted so the finding outlives the conversation that produced it. D8, the shared timeout budget, is marked open rather than settled: whether lowering teardownTimeoutMs reserves its slice or merely caps it was not decided, and the two differ in whether a slow drain can starve teardown of the time it needs. Signed-off-by: Diego Resendez --- .../2026-08-17-shutdown-teardown-design.md | 209 ++++++++++++++++++ 1 file changed, 209 insertions(+) create mode 100644 docs/plans/2026-08-17-shutdown-teardown-design.md diff --git a/docs/plans/2026-08-17-shutdown-teardown-design.md b/docs/plans/2026-08-17-shutdown-teardown-design.md new file mode 100644 index 0000000..47f4eab --- /dev/null +++ b/docs/plans/2026-08-17-shutdown-teardown-design.md @@ -0,0 +1,209 @@ +# Shutdown teardown — Design + +**Task:** 2.5 in the [trust-release plan](./2026-08-16-trust-release-plan.md) · Trust Release §14, CTO P0-4 · **Status:** awaiting review, no code written · **Constraint:** no new runtime dependency + +--- + +## The diagnosis + +An application closing a database connection today writes `process.on('SIGTERM', …)` by hand, because the framework offers nowhere to put that. `closeApp` (`src/app/index.ts:1009`) closes mesh links, streams and the HTTP server, and knows nothing about plugins or providers. `LifecycleEvent` (`src/bus.ts:2`) has no shutdown event at all — a plugin cannot even *observe* that the app is closing, let alone act on it. + +The framework owns the plumbing everywhere else. This is the hole. + +### Why the existing `Bus` cannot carry it + +`Bus.on` takes a synchronous listener (`src/bus.ts:62`) and `emit` neither awaits nor surfaces failures (`src/bus.ts:85`). Both are deliberate: observers must never break the pipeline. A plugin closing a database connection needs shutdown to *wait for it*, and needs its failure to be visible. + +The observability design already settled this rather than leaving it open — `D2` of [2026-08-16-observability-design.md](./2026-08-16-observability-design.md): + +> **This is exactly why shutdown teardown does not belong here.** A teardown must be *awaited*; an observer must not be. Same word, opposite guarantees, so they get different surfaces. + +Conceptually this is still an event — *"the app is closing, do you have anything to do first?"* — and callers may reasonably think of registering as subscribing. Mechanically it is a separate await-aware registry, because bending `Bus` to do both would cost the guarantee that makes `Bus` safe. + +### What "isolation is structural" actually protects + +`src/plugin.ts:26` reads *"Hand the plugin ONLY on() and add(). No emit, no other scope. Isolation is structural."* That sentence is load-bearing and it is easy to over-read, so this design states what it does and does not cover — verified against the code, because the answer surprised both people in the conversation that produced this document. + +**Enforced today:** + +- A plugin receives only `bus.on` and `scope.add` — no `emit`, so it cannot fabricate lifecycle events, and no reach into the registry. +- `setRunner` (`src/app/index.ts:320`) throws on duplicate names, so a plugin cannot silently replace an existing provider or step. +- Plugin nodes carry `origin: 'plugin'` and stay attributable in the graph. + +**Not enforced today:** + +- `runSteps` passes the live context object to every step and merges its output with `Object.assign(context, output)` (`src/pipeline.ts:73-74`). No collision check. A plugin's step can mutate the context directly and can overwrite any key another step provided. +- `mountPlugins` (`src/app/index.ts:161`) runs *before* `provideBuiltins` (`:162`), and `provideBuiltins` skips anything already registered — so a plugin registering a node named `logger` or `rooms` replaces the builtin. + +So the guarantee is about the **registration surface**, not about the **runtime context**. Teardown touches neither: it adds a third thing a plugin may register, and never sees a request context. The context-integrity question is real but pre-existing and out of scope here — it is recorded at the end so it is not lost. + +--- + +## Decisions + +### D1 — A teardown registry, not a `Bus` event + +One list of callbacks, owned by the app, awaited on close. Not a `LifecycleEvent`, for the reason `D2` of the observability design already gives. + +The registry is the entire mechanism. Everything below is a door into it. + +### D2 — Three doors, one registry: one order, one failure policy + +| Door | Who uses it | Shape | +|---|---|---| +| `hooks: [...]` in `createApp` | an application that wants lifecycle participation and nothing else | `onShutdown()` | +| `PluginApi.onShutdown` | a plugin that also extends the graph | `onShutdown()` | +| `dispose()` on a `@Provider` class | the provider that opened the resource | optional method | + +Three entry points, **one** registry, **one** order, **one** failure policy. If they ever acquire separate ordering relative to each other, this design has failed and two mechanisms exist again. + +The doors differ by intent, not by semantics. Today the only way into the lifecycle is to write a plugin, and a plugin means *"I want to extend the graph"* — someone who only wants to close a connection is forced to declare an extension they do not want. + +### D3 — `PluginApi` gains a property; the `Plugin` signature does not change + +`Plugin = (api: PluginApi) => void` is untouched. `onShutdown` joins `bus` and `scope` on the object a plugin already receives. Every existing plugin ignores it and behaves identically. + +This is why the hooks framing is better than widening the plugin contract directly: it removes the only break the earlier sketch had. See "What breaks" below — the answer is now *nothing at runtime*. + +### D4 — Teardown callbacks receive no arguments + +```ts +type TeardownFn = () => void | Promise; +``` + +State lives where the resource was created, and the closure already holds it: + +```ts +class MyPlugin { + #db = new Pool(); + mount(api: PluginApi) { + api.onShutdown(() => this.#db.end()); // the closure already has it + } +} +``` + +A provider's `dispose()` is the same picture — the instance holds its own connection. + +**Nothing needs to cross scopes**, which is what makes a container reference, an app reference, or any transport mechanism unnecessary here. A bus solves *"tell someone I do not know"*. Teardown is *"run this thing I registered"*. Handing a hook a resolver would make the container reachable from a hook and would be a genuine widening — declined. + +If an argument is ever needed, adding one to a callback that receives none is additive. The reverse is not. + +### D5 — Order is the reverse of boot + +Providers boot in topological order (`bootProviders`, `src/app/index.ts:664`), so they tear down in reverse: if `cache` needs `db`, `cache` closes first. Registration order within the same tier is preserved. + +Sequential, not parallel. Reverse-topological order only means something if it is respected, and parallel teardown discards it. + +### D6 — A failing teardown is logged and shutdown continues + +The failure goes to the injectable `Logger` and `close()` still resolves. One plugin's broken teardown must not strand the remaining ones or hang the process. + +This mirrors `Bus`'s philosophy — a subscriber cannot break the system — but with the visibility `Bus` lacks. `Bus` swallows silently because no logger existed when it was written; one exists now. + +The counter-argument was weighed and rejected: a `close()` that reports success after losing data is arguably worse than one that fails loudly. It loses because the alternative is worse in the common case — a process that will not exit is a worse operational failure than one that exited with a warning in the log, and the warning is not silent. + +### D7 — Triggered from each runtime's real close + +`app.close()` returns at its `if (!server)` guard on Deno, Bun and the edge (`src/app/index.ts:1026`). Hanging teardown off `app.close()` would make behaviour differ per runtime, which the multi-runtime constraint forbids. + +| Runtime | Entry point | +|---|---| +| Node | `app.close()` → `closeApp` | +| Deno | `serveDeno(app).close()` → `closeWithDeadline` | +| Bun | `serveBun(app).close()` → `closeWithDeadline` | +| edge (workerd) | **none — no shutdown exists** | + +`serveDeno` and `serveBun` already receive the app, so their `close()` can run its teardown without the user calling two things. `closeWithDeadline` (`src/http/shutdown.ts`) is already shared by both *"so the two adapters cannot drift into different meanings of the same `timeoutMs`"* — the same argument applies here, and it is why teardown belongs in that shared function rather than in each adapter. + +Node, Deno and Bun behave identically. **Edge cannot, and no design fixes it**: workerd never closes, so there is nothing to intercept. A plugin that depends on teardown for correctness is broken there. This is a runtime capability difference and belongs in the `runtimes.md` table beside `@Html` file mode and mesh, not in a footnote. + +### D8 — Teardown shares the close budget, and `close()` never exceeds `timeoutMs` + +`timeoutMs` is a hard ceiling on the whole of `close()`. That is what it is for, and nothing here is allowed to make `close()` take longer than the caller asked for. + +- Drain runs first. Teardown runs after, within the same budget. +- `teardownTimeoutMs` is optional and defaults to `timeoutMs` — no separate cap, teardown may use whatever the drain left. +- Setting it lower **reserves**: the drain is bounded to `timeoutMs − teardownTimeoutMs`, so teardown is guaranteed its slice. +- `teardownTimeoutMs > timeoutMs` is rejected at `createApp`, not silently clamped. + +> **Open for review — this is an interpretation, not a settled instruction.** "Shares, default `timeoutMs`, may be lowered, never above `timeoutMs`" was the direction given. Whether lowering it should **reserve** (as written above) or merely **cap** teardown's slice was not stated. Reserve is written here because it answers the failure it was raised to answer: with cap-only, a drain that eats the whole budget leaves teardown zero milliseconds and the database does not close. If cap-only is intended, D8 changes and that starvation case stays open. + +--- + +## The contract + +```ts +/** A teardown callback. Receives nothing: state lives in the closure that registered it. */ +export type TeardownFn = () => void | Promise; + +/** Lifecycle participation without extending the graph. Methods are optional so later + * stages (onBoot, onReady) can join without a breaking change. */ +export interface Hooks { + onShutdown?: TeardownFn; +} + +/** Unchanged except for the third capability. `Plugin` keeps its signature. */ +export interface PluginApi { + bus: { on: Bus['on'] }; + scope: ScopeApi; + onShutdown(fn: TeardownFn): void; +} + +createApp({ + modules: [...], + plugins: [...], + hooks: [...], // new + shutdownTimeoutMs: 10_000, // existing + teardownTimeoutMs: 2_000, // new, optional; <= shutdownTimeoutMs +}); + +@Provider({ provides: 'db' }) +class Db { + provide() { /* ... */ } + async dispose() { /* optional; called if present */ } +} +``` + +### What this costs internally + +`collectProviders` (`src/app/index.ts:345`) constructs each provider with `new ProviderClass()` and captures the instance in a closure. **The instance is never stored anywhere reachable**, and `Container.bindings` is private with no iteration, so there is no handle to call `dispose()` on today. + +Keeping provider instances requires a new field on `Registry`. That is internal, not public API, and it is the part nobody sees coming from reading "add `onShutdown` to `PluginApi`". + +### What breaks + +**At runtime: nothing.** `Plugin`'s signature is unchanged, `Hooks` methods are optional, and `dispose()` is called only if present. + +**At compile time: nothing either**, given D3. Widening `PluginApi` would have broken anyone constructing one as a literal — typically a test mock — but `onShutdown` is a required property on an object the framework builds and hands out, never one a user implements. Should that turn out to be wrong for some consumer, it goes in the CHANGELOG with the reason: making it optional would force every plugin to check for it and would turn a capability into a conditional forever. + +--- + +## Out of scope, deliberately + +- **`onBoot` / `onReady`.** `Hooks` is shaped as an object of optional methods so they can be added without a breaking change, but only `onShutdown` ships. The shape accommodates them; this design does not build them. +- **Request-scope cleanup.** Request values are recomputed per resolve (`src/container.ts`) and are garbage, not resources. Only app-scope teardown is in scope. +- **Edge teardown.** Not possible. Documented, not worked around. +- **A context argument for teardown callbacks.** D4. Additive later if a real case appears. +- **Context integrity.** A plugin's step can overwrite context keys and can replace the `logger` and `rooms` builtins. Real, pre-existing, unrelated to teardown, and recorded here only so the finding is not lost with this conversation. + +--- + +## Verification this design must survive + +1. A plugin registering `onShutdown` has it awaited before `close()` resolves — on Node, Deno and Bun, asserted per runtime rather than once. +2. A provider with `dispose()` has it called; one without is skipped. +3. Reverse-topological order: `cache` needing `db` tears down first. +4. A throwing teardown is logged and the remaining ones still run; `close()` resolves. +5. A hanging teardown does not make `close()` exceed `timeoutMs`. +6. `teardownTimeoutMs > shutdownTimeoutMs` throws at `createApp`. +7. An existing plugin that never calls `onShutdown` behaves exactly as before. +8. `close()` on an app with no teardown registered costs nothing measurable — this is not a request path, but it is still on the shutdown path of every app that uses none of it. + +## Documentation this design changes + +All of these now live in [green-tea-docs](https://github.com/Expressive-Tea/green-tea-docs): + +- `guides/plugins.md:7` — states plugins have exactly two capabilities. Becomes three, and the isolation wording needs the precision from the diagnosis above rather than a restatement. +- `guides/runtimes.md:44` — the shutdown table gains teardown, and edge gains its exception. +- `guides/dependency-injection.md:56` — describes what `close()` does; it now does one more thing. +- `README.md` — new public API, per `AGENTS.md:83`. From e778f6290269da8cbcacca4c6070a89fe1e4ef3c Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Mon, 17 Aug 2026 10:40:32 -0500 Subject: [PATCH 32/46] docs(plans): settle D8 as a reservation, and plan the implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit D8 was the one decision left open: the teardown shares close()'s budget and may never exceed timeoutMs, but whether lowering teardownTimeoutMs reserves its slice or merely caps it was never stated. It reserves. A cap only bounds how long teardown may run and does nothing about the case the decision exists for — a drain that spends the whole budget leaves teardown zero milliseconds and the connection stays open. Reserving is what makes the option a guarantee rather than a ceiling on something that may never get to run. The plan orders the work so nothing is observable until close() is wired in Task 4, and puts the Deno/Bun parity at Task 5 rather than last, because it is the task most likely to surface something the design did not foresee and finding that out early is worth more than a tidy sequence. Two notes carried into it for whoever executes it. Provider dispose() is registered as the provider boots rather than as it is collected, so the reverse-topological order D5 asks for falls out of the registry's reverse registration rule instead of needing a second sort. And the Deno and Bun suites are not part of npm test, so that task cannot be called done on the strength of vitest passing. Signed-off-by: Diego Resendez --- .../2026-08-17-shutdown-teardown-design.md | 4 +- .../2026-08-17-shutdown-teardown-plan.md | 141 ++++++++++++++++++ 2 files changed, 143 insertions(+), 2 deletions(-) create mode 100644 docs/plans/2026-08-17-shutdown-teardown-plan.md diff --git a/docs/plans/2026-08-17-shutdown-teardown-design.md b/docs/plans/2026-08-17-shutdown-teardown-design.md index 47f4eab..60f1264 100644 --- a/docs/plans/2026-08-17-shutdown-teardown-design.md +++ b/docs/plans/2026-08-17-shutdown-teardown-design.md @@ -1,6 +1,6 @@ # Shutdown teardown — Design -**Task:** 2.5 in the [trust-release plan](./2026-08-16-trust-release-plan.md) · Trust Release §14, CTO P0-4 · **Status:** awaiting review, no code written · **Constraint:** no new runtime dependency +**Task:** 2.5 in the [trust-release plan](./2026-08-16-trust-release-plan.md) · Trust Release §14, CTO P0-4 · **Status:** reviewed, D1–D8 settled · **Constraint:** no new runtime dependency --- @@ -126,7 +126,7 @@ Node, Deno and Bun behave identically. **Edge cannot, and no design fixes it**: - Setting it lower **reserves**: the drain is bounded to `timeoutMs − teardownTimeoutMs`, so teardown is guaranteed its slice. - `teardownTimeoutMs > timeoutMs` is rejected at `createApp`, not silently clamped. -> **Open for review — this is an interpretation, not a settled instruction.** "Shares, default `timeoutMs`, may be lowered, never above `timeoutMs`" was the direction given. Whether lowering it should **reserve** (as written above) or merely **cap** teardown's slice was not stated. Reserve is written here because it answers the failure it was raised to answer: with cap-only, a drain that eats the whole budget leaves teardown zero milliseconds and the database does not close. If cap-only is intended, D8 changes and that starvation case stays open. +Reserve rather than cap, and the difference is the whole reason this decision exists. A cap only bounds how long teardown *may* run; it does nothing when the drain has already spent the budget, and teardown then gets zero milliseconds and the database does not close. Reserving is what makes `teardownTimeoutMs` a guarantee rather than a ceiling on something that may never run. --- diff --git a/docs/plans/2026-08-17-shutdown-teardown-plan.md b/docs/plans/2026-08-17-shutdown-teardown-plan.md new file mode 100644 index 0000000..183ef0b --- /dev/null +++ b/docs/plans/2026-08-17-shutdown-teardown-plan.md @@ -0,0 +1,141 @@ +# Shutdown teardown — Implementation Plan + +> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. + +**Design:** [2026-08-17-shutdown-teardown-design.md](./2026-08-17-shutdown-teardown-design.md) — reviewed, D1–D8 settled. Do not re-decide them here. + +**Goal:** Give plugins, providers and applications somewhere to put teardown, so closing a database connection stops meaning `process.on('SIGTERM', …)` by hand. Closes Task 2.5 of the [trust-release plan](./2026-08-16-trust-release-plan.md); Trust Release §14, CTO P0-4. + +**Architecture:** A new `src/lifecycle.ts` holds the registry and nothing else. `src/plugin.ts` and `src/app/index.ts` gain doors into it; `src/app/index.ts` (`closeApp`) and `src/http/shutdown.ts` (`closeWithDeadline`) gain the call that drains it. No new runtime dependency — `reflect-metadata` stays the only one. + +**The thing to keep hold of:** three doors, one registry, one order, one failure policy. Any task that gives a door its own ordering or its own error handling has broken D2, whatever the tests say. + +--- + +## Order + +Tasks 1–3 build the mechanism and the doors; nothing observable changes until Task 4 wires it into `close()`. Task 5 is the runtime parity that D7 demands and is the one most likely to surface a surprise, so it does not go last. Documentation is Task 7 because it should describe the finished API rather than be rewritten twice. + +--- + +### Task 1: The registry + +**Files:** +- Create: `src/lifecycle.ts` +- Create: `test/lifecycle.test.ts` + +The whole mechanism, with no knowledge of plugins, providers, apps or HTTP. + +```ts +export type TeardownFn = () => void | Promise; +``` + +It needs: register a callback, and run everything registered — sequentially, in reverse registration order (D5), awaiting each, catching each (D6), never throwing. A failing callback is reported through the injectable `Logger` and the next one still runs. + +Keep the timeout **out** of here. Bounding is the caller's job, and it is already solved twice over by `closeApp` and `closeWithDeadline`; a third implementation is how the three drift into different meanings of the same number. + +Tests: order is reverse of registration; a throwing callback is logged and does not stop the rest; a rejecting async callback is treated the same; an empty registry resolves; running twice does not re-run callbacks (`close()` is called twice by more real applications than anyone expects). + +### Task 2: The plugin and hook doors + +**Files:** +- Modify: `src/plugin.ts` +- Modify: `src/app/index.ts` — `mountPlugins`, `createApp` options +- Modify: `src/app/types.ts` — `Hooks` on the public options +- Modify: `test/plugin.test.ts` + +`PluginApi` gains `onShutdown(fn: TeardownFn): void`, bound to the app's registry. `mountPlugin`'s comment at `src/plugin.ts:26` currently says a plugin gets `on()` and `add()` and nothing else; it now gets three things, and the comment says which and why — the isolation wording in the design's diagnosis is the precise version, not "isolation is gone". + +`createApp({ hooks })` takes `Hooks[]`, an object of optional methods so `onBoot`/`onReady` can join later without a breaking change. Only `onShutdown` exists now. + +Tests: a plugin registering `onShutdown` lands in the registry; a plugin that never calls it behaves exactly as before (D3 — this is the no-break guarantee, so it gets an explicit test rather than an assumption); hooks and plugins interleave in one order rather than running as two groups. + +### Task 3: Provider `dispose()` + +**Files:** +- Modify: `src/app/index.ts` — `collectProviders`, `Registry` +- Modify: `test/app.test.ts` + +`collectProviders` (`src/app/index.ts:345`) builds each provider with `new ProviderClass()` and captures the instance in a closure where nothing can reach it. Keep the instances on `Registry` so a `dispose()` can be called. + +Registration order must follow boot order, not declaration order, so that D5's reverse-topological teardown falls out of the registry's reverse-registration rule rather than needing a second sort. That means registering a provider's `dispose()` as it boots in `bootProviders` (`:664`), not when it is collected. + +A provider that failed to boot must not have `dispose()` called — it never provided anything. Optional providers that degraded (`degradedProviders`) are exactly this case and already tracked. + +Tests: `dispose()` is called; a provider without one is skipped; `cache` needing `db` tears down first; a provider that failed to boot is not disposed. + +### Task 4: Drain the registry on close — Node + +**Files:** +- Modify: `src/app/index.ts` — `closeApp` +- Modify: `test/app.test.ts` + +Teardown runs **after** the server drain and **before** `close()` resolves (D8): in-flight requests may still need the database while draining. + +The budget: `timeoutMs` is a hard ceiling on the whole of `close()`. `teardownTimeoutMs` defaults to `timeoutMs`; when set lower it **reserves**, so the drain is bounded to `timeoutMs − teardownTimeoutMs` and teardown is guaranteed its slice. `teardownTimeoutMs > shutdownTimeoutMs` throws at `createApp` rather than being clamped silently. + +`closeApp` already arms a timer before `finish` exists, for a reason its comment spells out at length. Read that comment before touching the ordering. + +Tests: a registered teardown is awaited before `close()` resolves; a hanging teardown does not let `close()` exceed `timeoutMs`; a slow drain plus a set `teardownTimeoutMs` still leaves teardown its reserved slice; `teardownTimeoutMs > shutdownTimeoutMs` throws at `createApp`. + +### Task 5: Runtime parity — Deno and Bun + +**Files:** +- Modify: `src/http/shutdown.ts` — `closeWithDeadline` +- Modify: `src/deno.ts`, `src/bun.ts` +- Modify: `test/deno/*`, `test/bun/*` + +`app.close()` returns at its `if (!server)` guard on Deno and Bun (`src/app/index.ts:1026`), so teardown cannot hang off it without behaviour differing per runtime — which the multi-runtime constraint forbids (D7). + +`serveDeno(app)` and `serveBun(app)` already hold the app, so their `close()` runs the teardown and the user calls one thing, not two. It goes in `closeWithDeadline` rather than in each adapter, for the reason that function already exists: so the two cannot drift into different meanings of the same `timeoutMs`. + +Deno cannot escalate from graceful to forced — its deadline bounds how long `close()` waits, not when connections die. That asymmetry already exists and this must not make it worse. + +These suites are **not** in `npm test`. Run `npm run test:deno` and `npm run test:bun` explicitly, and do not report this task done on the strength of vitest passing. + +Tests, per runtime rather than once: a teardown registered on a Deno/Bun app is awaited by that server's `close()`. + +### Task 6: Edge — document the hole, do not paper over it + +**Files:** +- Modify: `src/edge.ts` — doc comment only + +workerd never closes, so there is nothing to intercept and no design fixes it. A plugin depending on teardown for correctness is broken there. + +No shim, no fake `close()`, no best-effort call on an unload event that does not exist. The only change is a doc comment stating it, so someone reading `edgeHandler` learns it there rather than in production. The user-facing half is Task 7. + +### Task 7: Documentation + +**Files:** all in [green-tea-docs](https://github.com/Expressive-Tea/green-tea-docs) +- Modify: `src/content/docs/guides/plugins.md` — line 7 says plugins have exactly two capabilities; it is three now, and the isolation sentence needs the design's precision rather than a restatement +- Modify: `src/content/docs/guides/runtimes.md` — the shutdown table gains teardown, and edge gains its row +- Modify: `src/content/docs/guides/dependency-injection.md` — line 56 describes what `close()` does +- Modify: `README.md` in core — new public API, per `AGENTS.md:83` +- Modify: `CHANGELOG.md` in core + +Two repositories, one change. This is the first real test of the seam Phase 4 opened, and nothing fails if it is skipped — which is the point of doing it in the same session rather than leaving it to a follow-up. + +--- + +## Out of scope + +- `onBoot` / `onReady`. `Hooks` is shaped to accommodate them; this plan does not build them. +- Request-scope cleanup. Request values are recomputed per resolve and are garbage, not resources. +- Edge teardown. Not possible. +- A context argument for teardown callbacks (D4). Additive later if a real case appears. +- Context integrity — a plugin's step can overwrite context keys and replace the `logger` and `rooms` builtins. Real, pre-existing, and recorded in the design's out-of-scope section so it is not lost. + +## Verification + +The design's list, restated as the gate for calling this done: + +1. A plugin's `onShutdown` is awaited before `close()` resolves — asserted on Node, Deno and Bun separately. +2. A provider with `dispose()` has it called; one without is skipped; one that failed to boot is not disposed. +3. Reverse-topological order: `cache` needing `db` tears down first. +4. A throwing teardown is logged, the rest still run, `close()` resolves. +5. A hanging teardown does not make `close()` exceed `timeoutMs`. +6. `teardownTimeoutMs > shutdownTimeoutMs` throws at `createApp`. +7. An existing plugin that never calls `onShutdown` behaves exactly as before. +8. `close()` on an app with no teardown registered costs nothing measurable. + +Plus the gates every change here passes: `npm run lint`, `npm run complexity:check`, `npm run typecheck`, `npm test`, and — because Task 5 exists — `npm run test:deno`, `npm run test:bun`, `npm run test:edge`. From a5c1fda886d6795d7ea46a32057aa543a561c254 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Mon, 17 Aug 2026 10:44:43 -0500 Subject: [PATCH 33/46] =?UTF-8?q?docs(plans):=20add=20Phase=204.5=20?= =?UTF-8?q?=E2=80=94=20move=20the=20JSR=20gate=20off=20the=20tag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task 2.5 adds public API, and exported types are what JSR's slow-types check polices. Writing that surface with no JSR gate on pull requests means finding out at release time whether the shape is publishable, so the phase is numbered as an insertion and says it runs first. The first reading of this was wrong and the correction is the useful part: release.yml already runs `deno publish --dry-run`, before either registry ships, and a dry run passes today with the slow-types check included. The gap is not a missing gate, it is when it runs — only on a version tag, so a Deno-typecheck break or a slow type lands on main in silence and surfaces while cutting a release. That is the moment release.yml's own npm-audit comment identifies as having the least time to judge a fix; the workflow makes that argument for advisories and not for JSR. Measured rather than assumed: the dry run takes 0.68s against 2.0s for the whole vitest suite, so it goes in the runtimes job's Deno leg, which already installs Deno, and needs no more thought than that. npm test stays Node-only. The runtimes job already covers Deno, Bun and edge on every push, so they are not unguarded — what is missing is one command a contributor can run before pushing, which is test:all. Also recorded: every dry run warns that experimentalDecorators is deprecated and may be removed. Nothing to fix, no workaround worth inventing early, but it is a dependency on a deprecated compiler option in a runtime we publish to, and it belongs in Honest scope rather than in a warning nobody reads. Signed-off-by: Diego Resendez --- docs/plans/2026-08-16-trust-release-plan.md | 46 +++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/docs/plans/2026-08-16-trust-release-plan.md b/docs/plans/2026-08-16-trust-release-plan.md index ecacc51..fc39c83 100644 --- a/docs/plans/2026-08-16-trust-release-plan.md +++ b/docs/plans/2026-08-16-trust-release-plan.md @@ -243,6 +243,52 @@ The split trades CI coupling for drift risk: docs and code can now disagree with --- +## Phase 4.5: Move the JSR gate off the tag — **run this before Task 2.5's code** + +Numbered as an insertion because that is what it is, the same way Task 2.5 was. It is small, and its position is the whole point: **Task 2.5 adds public API** — `Hooks`, `TeardownFn`, `PluginApi.onShutdown` — and exported types are exactly what JSR's slow-types check polices. Writing that surface with no JSR gate on pull requests means learning at release time whether the shape is publishable. + +Verified before writing this, because the first reading was wrong: `release.yml:42` **already** runs `deno publish --dry-run`, before publishing to either registry, and its comment already makes the argument — *"JSR checks things npm never looks at — slow types, module analysis — and learning about them after npm has published leaves the tag half-shipped."* Phase 1 already published to JSR, and a dry run passes today, slow-types check included. + +The gap is not that the gate is missing. It is **when it runs**: only on a version tag. A change that breaks Deno's type-checker or introduces a slow type lands on `main` in silence and surfaces while cutting a release — the moment `release.yml`'s own npm-audit comment identifies as having the least time to judge a fix. The workflow makes that argument for advisories and not for JSR. + +Worth stating plainly: `deno publish --dry-run` type-checks the four entry points with **Deno's** checker and lib, which is not the same pass as `tsc --noEmit -p tsconfig.json`. A second compiler over the same source is a real gate, not a formality — Task 1.1 exists because that second compiler found a hole the first one did not. And JSR serves `src/` directly, so anything it would reject is something a JSR user gets. + +### Task 4.5.1: Run the JSR gate on every push and pull request + +**Files:** +- Modify: `.github/workflows/ci.yml` + +Add `deno publish --dry-run` to the `runtimes` job's Deno leg, which already installs Deno. Measured at **0.68s** against 2.0s for the whole vitest suite — cheap enough that placing it anywhere else is over-thinking. + +Leave `release.yml` alone. The tag-time gate stays: it is the one that protects an immutable JSR version, and a gate that runs twice is not a duplication worth removing. + +### Task 4.5.2: One command for the whole matrix + +**Files:** +- Modify: `package.json` +- Modify: `README.md` + +`npm test` is Node-only, deliberately — it is the fast local loop, 2s, and booting Deno, Bun and workerd into it would tax every run to catch what CI already catches on every push. The `runtimes` job means these suites are not unguarded; what is missing is a way for a contributor to run everything with one command before pushing. + +Add `test:all` — `npm test` plus `test:deno`, `test:bun`, `test:edge`, and the JSR dry run. Say in `README.md` which one is the fast loop and which one is the pre-push check, so the split reads as a decision rather than an oversight. + +### Task 4.5.3: Record the decorator deprecation as a known risk + +**Files:** +- Modify: `README.md` (*Honest scope*), or wherever Phase 6 puts the stability contract + +Every `deno publish --dry-run` prints: + +``` +Warning experimentalDecorators compiler option is deprecated and may be removed at any time +``` + +This framework is decorator-driven and depends on `emitDecoratorMetadata`, which the TC39 decorators that replace it do not provide an equivalent for. Nothing to fix today, and no workaround worth inventing ahead of the change. + +What is worth doing is naming it, because it is a dependency on a deprecated compiler option in the runtime the package publishes to. It belongs beside the other things *Honest scope* already admits. Do not turn the warning into an error to force the issue — that breaks releases on someone else's schedule. + +--- + ## Phase 5: Close #13 as documentation ### Task 5.1: Write the circuit-breaker recipe From 78b5034936c00ee9f24d5cc02c771e0627a59962 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Mon, 17 Aug 2026 11:19:41 -0500 Subject: [PATCH 34/46] =?UTF-8?q?docs(plans):=20drop=204.5.3=20=E2=80=94?= =?UTF-8?q?=20the=20decorator=20warning=20is=20already=20documented,=20and?= =?UTF-8?q?=20the=20reason=20given=20for=20it=20was=20wrong?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two corrections to the phase added an hour ago. The task asked for documentation that exists. README.md:233 "Why legacy decorators" and concepts/the-graph.md:43 in the docs repository both already carry the argument, and carry it better: parameter decorators are deliberately absent from the TC39 Stage 3 proposal, so a handler taking `@param('id') id: string` is only expressible with legacy decorators, and Stage 3 means the replacement is not finalized either. Writing a third, shorter version of that in Honest scope would have made it worse. The task also justified itself with a claim that is false. It said the framework depends on emitDecoratorMetadata. It does not: `grep -rn 'design:type\|design:paramtypes' src/` returns nothing. The flag is set in tsconfig.json and deno.json, but no design:* reflection is read anywhere in src/ — argument positions are recorded explicitly. Both documents already state this, which is how the error surfaced. What survives is a note rather than a task, because the warning arrives in CI together with the new gate and would otherwise read as something the gate found. Signed-off-by: Diego Resendez --- docs/plans/2026-08-16-trust-release-plan.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/plans/2026-08-16-trust-release-plan.md b/docs/plans/2026-08-16-trust-release-plan.md index fc39c83..0f6370d 100644 --- a/docs/plans/2026-08-16-trust-release-plan.md +++ b/docs/plans/2026-08-16-trust-release-plan.md @@ -272,10 +272,7 @@ Leave `release.yml` alone. The tag-time gate stays: it is the one that protects Add `test:all` — `npm test` plus `test:deno`, `test:bun`, `test:edge`, and the JSR dry run. Say in `README.md` which one is the fast loop and which one is the pre-push check, so the split reads as a decision rather than an oversight. -### Task 4.5.3: Record the decorator deprecation as a known risk - -**Files:** -- Modify: `README.md` (*Honest scope*), or wherever Phase 6 puts the stability contract +### The decorator warning is expected — no task, and no new documentation Every `deno publish --dry-run` prints: @@ -283,9 +280,11 @@ Every `deno publish --dry-run` prints: Warning experimentalDecorators compiler option is deprecated and may be removed at any time ``` -This framework is decorator-driven and depends on `emitDecoratorMetadata`, which the TC39 decorators that replace it do not provide an equivalent for. Nothing to fix today, and no workaround worth inventing ahead of the change. +Whoever adds this gate to CI will see that warning arrive with it and should not treat it as something the gate found. It is **already documented, and better than a new note would manage**: `README.md:233` (*Why legacy decorators*) and `concepts/the-graph.md:43` in the docs repository both carry the reasoning — parameter decorators are deliberately absent from the TC39 Stage 3 proposal, so `handler(@param('id') id: string)` is only expressible with legacy decorators, and Stage 3 means the replacement is not finalized either. -What is worth doing is naming it, because it is a dependency on a deprecated compiler option in the runtime the package publishes to. It belongs beside the other things *Honest scope* already admits. Do not turn the warning into an error to force the issue — that breaks releases on someone else's schedule. +An earlier draft of this phase claimed the framework "depends on `emitDecoratorMetadata`". That is **wrong**, and both documents already say so: argument positions are recorded explicitly, and `grep -rn 'design:type\|design:paramtypes' src/` returns nothing — the flag is set in `tsconfig.json` and `deno.json`, but no `design:*` reflection is read anywhere. Legacy parameter decorators are the only legacy surface this project actually depends on. + +Do not turn the warning into an error to force the issue: that breaks releases on someone else's schedule. --- From bfe8b66127810544fff33538655948f888e949b4 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Mon, 17 Aug 2026 11:21:43 -0500 Subject: [PATCH 35/46] ci: run the JSR gate on every push, not only on a release tag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit release.yml has always run `deno publish --dry-run` before publishing to either registry, and keeps doing so — that copy is the last thing standing between a tag and a JSR version number that can never be replaced. It runs too late to be feedback, though. A slow type in the public API or a Deno type error lands on main in silence and surfaces while cutting a release, which is the same "least time to judge a fix" the audit steps are already ordered to avoid. The workflow made that argument for advisories and not for the registry that type-checks us. This matters more in the next few commits than it did in the last hundred: Task 2.5 adds Hooks, TeardownFn and PluginApi.onShutdown, and exported types are exactly what the slow-types check polices. It is a second compiler over the same source rather than a packaging formality. `npm run typecheck` is tsc with this repo's config; this is Deno's checker with Deno's lib, and it is what found the BodyInit hole on the fetch path that tsc accepted. JSR serves src/ directly, so what it rejects is what a JSR consumer would have received. Measured at 0.68s against 2.0s for the whole vitest suite, so it goes in the runtimes job's Deno leg, which already installs Deno. test:all covers the same ground locally. npm test stays Node-only on purpose — it is the loop you run constantly, and booting three more runtimes into it would tax every run to catch what CI already catches on every push. Verified end to end: 393 vitest, 9 Deno, 5 Bun, edge, and the dry run, in 6.1s. It passes --allow-dirty and CI does not, deliberately: locally you are checking work in progress, and in CI a checkout that is not clean is worth failing on. Signed-off-by: Diego Resendez --- .github/workflows/ci.yml | 16 ++++++++++++++++ README.md | 13 ++++++++++++- package.json | 1 + 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b40873a..258b92d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,3 +87,19 @@ jobs: - if: matrix.runtime == 'bun' uses: oven-sh/setup-bun@v2 - run: npm run test:${{ matrix.runtime }} + # JSR's gate, moved off the release tag. `release.yml` runs this too and keeps doing so — + # that copy protects an immutable JSR version and is the last thing standing between a tag + # and a version number that can never be replaced. This copy exists because that one runs + # too late to be useful as feedback: a slow type or a Deno type error would otherwise land + # on `main` in silence and surface while cutting a release, which is the same "least time + # to judge a fix" the audit steps above are ordered to avoid. + # + # It is a second compiler over the same source, not a formality. `npm run typecheck` is tsc + # with this repo's tsconfig; this is Deno's checker with Deno's lib, and it is what found + # the `BodyInit` hole on the fetch path that tsc accepted. JSR serves `src/` directly, so + # anything it rejects is something a JSR consumer would have received. + # + # 0.68s against 2.0s for the whole vitest suite. No `--allow-dirty`: a checkout is clean, + # and if it somehow is not, that is worth failing on. + - if: matrix.runtime == 'deno' + run: deno publish --dry-run diff --git a/README.md b/README.md index 8fa21ea..454dfc6 100644 --- a/README.md +++ b/README.md @@ -259,7 +259,8 @@ green-tea is **beta**, on the road to a release candidate. Express and Fastify h ```bash npm install -npm test # vitest (Node only — CI additionally runs the three below on every push) +npm test # vitest (Node only) — the fast loop, ~2s +npm run test:all # everything below, plus the JSR gate — the pre-push check npm run test:deno # deno test } a change to shared code can pass `npm test` npm run test:bun # bun test } and still be broken on one of these npm run test:edge # workerd via miniflare @@ -268,6 +269,16 @@ npm run build # emit dist/ (tsup: dual ESM + CJS) npm run bench # regenerate BENCHMARKS.md ``` +`npm test` stays Node-only on purpose: it is the loop you run constantly, and booting Deno, Bun and +workerd into it would tax every run to catch what CI already catches on every push. Nothing here is +unguarded — the `runtimes` job runs all three, and `deno publish --dry-run` gates JSR. `test:all` is +for the moment before you push, when you would rather find out locally. + +That last one is a second type-checker, not a packaging formality: `npm run typecheck` is `tsc` with +this repository's config, while `deno publish --dry-run` is Deno's checker with Deno's lib plus JSR's +slow-types rules over the public API. JSR serves `src/` directly, so what it rejects is what a JSR +consumer would have received. + ## Roadmap - ✅ **transport security** — native TLS/wss, CORS, secure-by-default headers, `trustProxy`. diff --git a/package.json b/package.json index f88ff05..40b08a6 100644 --- a/package.json +++ b/package.json @@ -91,6 +91,7 @@ "test:deno": "deno test --allow-net --allow-read --allow-run --allow-env --no-check test/deno/", "test:bun": "bun test test/bun/", "test:edge": "tsx test/edge/run.ts", + "test:all": "npm test && npm run test:deno && npm run test:bun && npm run test:edge && deno publish --dry-run --allow-dirty", "typecheck": "tsc --noEmit -p tsconfig.json", "typecheck:bench": "tsc --noEmit -p bench/tsconfig.json", "lint": "eslint src", From 24feca481cbd2ddb822954a9db2c8f3d2e625a48 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Mon, 17 Aug 2026 11:37:31 -0500 Subject: [PATCH 36/46] feat: shutdown teardown for plugins, providers and applications MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closing a connection meant writing process.on('SIGTERM') by hand: closeApp drained the server and mesh links and knew nothing about the graph, and the Bus had no shutdown event at all, so a plugin could not even observe that the app was going away. Implements docs/plans/2026-08-17-shutdown-teardown-design.md, D1-D8. Three doors into one registry, with one order and one failure policy — a @Provider may declare dispose(), a plugin may call api.onShutdown(fn), and an application that wants neither passes createApp({ hooks: [{ onShutdown }] }). Shipping only the plugin half would have frozen the public API around the less common case: the thing that holds a database connection is a provider. Callbacks take no arguments. Whatever needs closing is already in the closure that registered it, so nothing crosses a scope and the registry needs no container, app reference or transport. That is what keeps this a registry rather than a second event bus — Bus.on is synchronous and emit swallows failures on purpose, and a teardown needs the opposite of both. Provider dispose() is registered as the provider boots rather than as it is collected, so reverse-registration is reverse-topological order for free: a cache that needs db closes before the db it is holding, with no second sort to keep in step. It registers inside the try, so a provider that failed to boot is never disposed — nothing it might close was ever opened. Teardown runs after the drain, because an in-flight request may still be using what a teardown is about to close, and inside the same timeoutMs, because that number is a promise about when close() returns. teardownTimeoutMs reserves a slice of that budget rather than extending it, and is rejected at boot rather than clamped. Node, Deno and Bun reach it through the close() each runtime actually uses. app.close() returns at its no-server guard everywhere but Node, so the Deno and Bun adapters chain it after their own drain — and app.close() now runs teardown on that path too, since an app served through app.fetch still booted providers that opened things. The registry drains once, so both entry points are safe. Edge gets a doc comment and nothing else. workerd has no shutdown to intercept; a best-effort call on an event that does not exist would be worse than saying so. Recorded in mountPlugin's comment while widening it: "isolation is structural" is a guarantee about the registration surface, not about the request context. A plugin's step already receives the live context and can overwrite keys in it. Pre-existing, unrelated, and now written where the next reader will look. Signed-off-by: Diego Resendez --- CHANGELOG.md | 19 ++ README.md | 5 +- .../2026-08-17-shutdown-teardown-design.md | 6 +- .../2026-08-17-shutdown-teardown-plan.md | 2 +- src/app/index.ts | 154 ++++++++++++- src/app/types.ts | 12 + src/bun.ts | 7 +- src/deno.ts | 7 +- src/edge.ts | 7 + src/lifecycle.ts | 70 ++++++ src/plugin.ts | 25 +- test/bun/shutdown.test.ts | 20 ++ test/deno/shutdown.test.ts | 21 ++ test/lifecycle.test.ts | 86 +++++++ test/plugin.test.ts | 39 +++- test/teardown.test.ts | 215 ++++++++++++++++++ 16 files changed, 670 insertions(+), 25 deletions(-) create mode 100644 src/lifecycle.ts create mode 100644 test/lifecycle.test.ts create mode 100644 test/teardown.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index bece1f2..8cddd15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,25 @@ npm treats versions as semver and semver forbids leading zeros. ### Added +- Shutdown is now an extension point. A `@Provider` may declare `dispose()`, a plugin may call + `api.onShutdown(fn)`, and an application may pass `createApp({ hooks: [{ onShutdown }] })` — three + doors into one registry, so an app closing a connection no longer writes `process.on('SIGTERM')` + by hand. Callbacks are **awaited**, unlike `bus.on` listeners, and take no arguments: whatever + needs closing is already in the closure that registered it. + + They run in reverse boot order, so a `cache` that needs `db` closes before the `db` it is holding. + A failing teardown is logged and the rest still run — one broken callback must not leave the + process up. Everything happens inside `close()`'s existing deadline; `createApp({ teardownTimeoutMs })` + reserves a slice of that budget when a connection must get its chance to close, and is rejected at + boot if it exceeds `shutdownTimeoutMs`. + + Node, Deno and Bun behave identically — on Deno and Bun the teardown runs from the `close()` on the + server `serveDeno()`/`serveBun()` returned. **The edge cannot participate**: workerd has no + shutdown to intercept, so anything that must be released belongs in the request that acquired it. + + Nothing changes for existing code. `Plugin`'s signature is unchanged, `Hooks` methods are optional, + and `dispose()` is called only if present. + - `limits.maxConnections` changes Node's previously unlimited concurrent socket count to a default cap of `1000`; values `<= 0` leave Node unlimited. Deno and Bun have no equivalent runtime setting and require a platform or reverse-proxy connection cap. diff --git a/README.md b/README.md index 454dfc6..3bf4398 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ npm install busboy # multipart/form-data file uploads - **One primitive for real-time.** Declare the transport — SSE, ndjson, or a WebSocket duplex — and return an `AsyncIterable`; backpressure and cleanup are handled. *Why it matters:* no separate gateway, adapter, or library to bolt on. - **The same app runs on Node, Deno, Bun, and the edge.** One codebase, one import; you swap the entry point (`app.listen` → `serveDeno` / `serveBun` / `edgeHandler`) and nothing else. HTTP, SSE, and WebSocket — including rooms and channels — behave identically on all four. *Why it matters:* the graph model isn't a bet on one runtime's future, and no other opinionated/DI framework runs everywhere. - **A remote dependency looks like a local one.** `@needs('billing')` resolves the same whether `billing` lives in this process or on another node (mesh, experimental). *Why it matters:* no gRPC layer or message-pattern DSL to learn — there's the graph, and some nodes happen to live elsewhere. -- **Plugins can't sabotage you.** A plugin gets `bus.on(...)` (observe) and `scope.add(...)` (extend its own scope). There is no API to reorder or delete another scope's steps. *Why it matters:* installing a plugin can't break your body parser. +- **Plugins can't sabotage you.** A plugin gets `bus.on(...)` (observe), `scope.add(...)` (extend its own scope) and `onShutdown(...)` (release what it opened). There is no API to reorder or delete another scope's steps. *Why it matters:* installing a plugin can't break your body parser. ## Real-time is a primitive, not a second framework @@ -111,7 +111,8 @@ Beta shipped the parts a real API needs, without growing the runtime dependency - **HTML without a view layer.** `@Html` returns a string, serves a file, or renders one with the built-in `{{ }}` template engine — swap in EJS or handlebars with `createApp({ viewEngine })`. `createApp({ static: true })` serves `./public` with path-traversal guards and no mime dependency. - **Ceilings that are already on.** `limits` caps body size (`413`), multipart parts, concurrent Node connections (default `1000`; `<= 0` leaves connections unlimited), and the request / headers / keep-alive timeouts — defaulting to `30s` / `10s` / `5s`, tighter than Node's own two-minute default. When Node's connection cap is reached, excess sockets are destroyed without an HTTP response. Deno and Bun expose no equivalent active-socket cap, so enforce one at the deployment platform or reverse proxy there. Configurable, and safe before you configure anything. - **Observability without an integration.** Every request carries an id and a trace id through every lifecycle event, each step reports its own duration, and `createApp({ logger })` accepts any logger — the default writes structured JSON. Nothing in core writes to `console`. Metrics and tracing exporters read the same stream from outside core. -- **Graceful shutdown, with a deadline.** `app.close()` drains in-flight requests and closes live streams and mesh links, then warns and force-closes whatever is still open after 10 seconds — so a stuck handler cannot hold a deploy open forever. Change the number per call with `close({ timeoutMs })` or for the whole app with `createApp({ shutdownTimeoutMs })`. `app.close()` is Node-only; on Deno and Bun the server `serveDeno()`/`serveBun()` returns carries the same `close({ timeoutMs })`. +- **Graceful shutdown, with a deadline.** `app.close()` drains in-flight requests and closes live streams and mesh links, then warns and force-closes whatever is still open after 10 seconds — so a stuck handler cannot hold a deploy open forever. Change the number per call with `close({ timeoutMs })` or for the whole app with `createApp({ shutdownTimeoutMs })`. Connection *draining* is Node-only; on Deno and Bun the server `serveDeno()`/`serveBun()` returns carries the same `close({ timeoutMs })`. +- **Shutdown is an extension point, not a `SIGTERM` handler you write.** A provider that opened a pool closes it in `dispose()`; a plugin registers `onShutdown(...)`; an application that wants neither passes `createApp({ hooks: [{ onShutdown }] })`. All three land in one registry, run in reverse boot order — a `cache` that needs `db` closes first — and are *awaited*, unlike a `bus.on` listener. A failure is logged and the rest still run, because one broken teardown must not leave the process up. Everything happens inside `close()`'s deadline; `createApp({ teardownTimeoutMs })` reserves a slice of it when a connection must get its chance. *Not available on the edge* — workerd has no shutdown to hook. - **Testable by construction.** `createApp({ overrides: { db: fakeDb } })` swaps any node in one line. - **Dual ESM + CommonJS.** Ships both builds behind an `exports` map — `import` and `require` both resolve, with matching type declarations. diff --git a/docs/plans/2026-08-17-shutdown-teardown-design.md b/docs/plans/2026-08-17-shutdown-teardown-design.md index 60f1264..dc1d19d 100644 --- a/docs/plans/2026-08-17-shutdown-teardown-design.md +++ b/docs/plans/2026-08-17-shutdown-teardown-design.md @@ -122,10 +122,12 @@ Node, Deno and Bun behave identically. **Edge cannot, and no design fixes it**: `timeoutMs` is a hard ceiling on the whole of `close()`. That is what it is for, and nothing here is allowed to make `close()` take longer than the caller asked for. - Drain runs first. Teardown runs after, within the same budget. -- `teardownTimeoutMs` is optional and defaults to `timeoutMs` — no separate cap, teardown may use whatever the drain left. -- Setting it lower **reserves**: the drain is bounded to `timeoutMs − teardownTimeoutMs`, so teardown is guaranteed its slice. +- **Unset** (the default): the drain may use the whole of `timeoutMs`, and teardown gets whatever is left — possibly nothing. No reservation is taken from a caller who never asked for one. +- **Set**: it **reserves**. The drain is bounded to `timeoutMs − teardownTimeoutMs`, so teardown is guaranteed its slice. - `teardownTimeoutMs > timeoutMs` is rejected at `createApp`, not silently clamped. +An earlier draft of this decision said the option "defaults to `timeoutMs`". Read together with the reservation rule that gives the drain `timeoutMs − timeoutMs`, which is zero, and no drain at all. The default is *no reservation*, which is a different statement. + Reserve rather than cap, and the difference is the whole reason this decision exists. A cap only bounds how long teardown *may* run; it does nothing when the drain has already spent the budget, and teardown then gets zero milliseconds and the database does not close. Reserving is what makes `teardownTimeoutMs` a guarantee rather than a ceiling on something that may never run. --- diff --git a/docs/plans/2026-08-17-shutdown-teardown-plan.md b/docs/plans/2026-08-17-shutdown-teardown-plan.md index 183ef0b..07d63e8 100644 --- a/docs/plans/2026-08-17-shutdown-teardown-plan.md +++ b/docs/plans/2026-08-17-shutdown-teardown-plan.md @@ -72,7 +72,7 @@ Tests: `dispose()` is called; a provider without one is skipped; `cache` needing Teardown runs **after** the server drain and **before** `close()` resolves (D8): in-flight requests may still need the database while draining. -The budget: `timeoutMs` is a hard ceiling on the whole of `close()`. `teardownTimeoutMs` defaults to `timeoutMs`; when set lower it **reserves**, so the drain is bounded to `timeoutMs − teardownTimeoutMs` and teardown is guaranteed its slice. `teardownTimeoutMs > shutdownTimeoutMs` throws at `createApp` rather than being clamped silently. +The budget: `timeoutMs` is a hard ceiling on the whole of `close()`. `teardownTimeoutMs` **unset** means no reservation — the drain may use all of `timeoutMs` and teardown gets what is left, possibly nothing. **Set**, it reserves: the drain is bounded to `timeoutMs − teardownTimeoutMs`. `teardownTimeoutMs > shutdownTimeoutMs` throws at `createApp` rather than being clamped silently. `closeApp` already arms a timer before `finish` exists, for a reason its comment spells out at length. Read that comment before touching the ordering. diff --git a/src/app/index.ts b/src/app/index.ts index 281f8be..836bff1 100644 --- a/src/app/index.ts +++ b/src/app/index.ts @@ -12,6 +12,8 @@ import { matchWsRoute, runWsConnection, trackUntil, type WsRequest, type WsSocke import { isAsyncIterable } from '../channel'; import { JsonTransformer, type ErrorRenderer } from '../transformers'; import { mountPlugin, Plugin, ScopeApi, ScopeNode } from '../plugin'; +import { TeardownRegistry } from '../lifecycle'; +import type { Hooks } from './types'; import { Ctor, getModuleMeta, @@ -48,6 +50,13 @@ interface Registry { stepNodes: GraphNode[]; runners: Map; providerMeta: Map; + /** + * The `@Provider` instance behind each node, kept only so a `dispose()` can be reached. + * + * `collectProviders` used to build the instance and let it live on solely inside the runner's + * closure, which meant nothing could ever call a method on it again. + */ + providerInstances: Map void | Promise }>; routePlans: RoutePlan[]; exportedProviders: string[]; exportedSteps: string[]; @@ -86,6 +95,14 @@ interface PipelineDeps { export function createApp(opts: { modules: Ctor[]; plugins?: Plugin[]; + /** + * Lifecycle participation without extending the graph. + * + * A plugin means "I want to add nodes"; someone who only needs to close a connection should not + * have to declare an extension they do not want. Methods are optional so later stages can join + * without a breaking change — only `onShutdown` exists today. + */ + hooks?: Hooks[]; mesh?: MeshConfig; limits?: RequestLimits; devGraph?: boolean; @@ -111,6 +128,17 @@ export function createApp(opts: { * where passing it per call is not an option. */ shutdownTimeoutMs?: number; + /** + * Milliseconds reserved out of the shutdown budget for teardown, in ms (default: none reserved). + * + * Teardown runs after the drain and inside the same `timeoutMs`, so `close()` never takes longer + * than the caller asked for. Left unset, the drain may use the whole budget and teardown gets + * whatever remains — possibly nothing. Set it when a connection *must* get its chance to close: + * the drain is then bounded to `timeoutMs - teardownTimeoutMs` and this slice is guaranteed. + * + * Must not exceed `shutdownTimeoutMs`; `createApp` throws rather than clamping silently. + */ + teardownTimeoutMs?: number; /** * Where every framework diagnostic is written (default: structured JSON, human-readable on a TTY). * @@ -158,7 +186,8 @@ export function createApp(opts: { const viewsCtx: ViewsContext = { views: opts.views, viewEngine: opts.viewEngine }; const registry = collectModules(opts.modules, viewsCtx); const { providerNodes, stepNodes, runners, providerMeta, routePlans } = registry; - mountPlugins(opts.plugins, bus, registry); + const teardown = buildTeardownRegistry(opts.hooks, opts.teardownTimeoutMs, opts.shutdownTimeoutMs); + mountPlugins(opts.plugins, bus, registry, teardown); provideBuiltins(registry, logger); // For each route, resolve which providers/steps feed it via topo order. @@ -236,7 +265,7 @@ export function createApp(opts: { registry, opts.overrides, () => orderedProviders, - { runners, container, providerMeta, bus, logger }, + { runners, container, providerMeta, providerInstances: registry.providerInstances, teardown, bus, logger }, degradedProviders, ready, ); @@ -292,7 +321,7 @@ export function createApp(opts: { }; const close = (options: { timeoutMs?: number } = {}): Promise => - closeApp(server, meshLinks, streams, options, opts.shutdownTimeoutMs, logger); + closeApp(server, meshLinks, streams, options, opts.shutdownTimeoutMs, logger, teardown, opts.teardownTimeoutMs); return { listen, @@ -327,6 +356,7 @@ function emptyRegistry(): Registry { stepNodes: [], runners, providerMeta: new Map(), + providerInstances: new Map(), routePlans: [], exportedProviders: [], exportedSteps: [], @@ -343,6 +373,7 @@ function collectProviders(providers: Ctor[], origin: string, registry: Registry) registry.providerMeta.set(meta.provides, { optional: meta.optional }); if (meta.export) registry.exportedProviders.push(meta.provides); const instance: any = new ProviderClass(); + registry.providerInstances.set(meta.provides, instance); registry.setRunner(meta.provides, (ctx) => instance.provide(ctx)); } } @@ -459,12 +490,40 @@ function collectModules(modules: Ctor[], viewsCtx: ViewsContext): Registry { return registry; } +/** + * Builds the teardown registry, seeds it with the application's hooks, and validates the reservation. + * + * Hooks land before plugins, so the registry running in reverse tears plugins down before the hooks + * an application registered around them. Both go into the same list: one order, one failure policy. + */ +function buildTeardownRegistry( + hooks: Hooks[] | undefined, + teardownTimeoutMs: number | undefined, + shutdownTimeoutMs: number | undefined, +): TeardownRegistry { + const budget = shutdownTimeoutMs ?? 10_000; + + // Rejected rather than clamped: a reservation larger than the budget it is carved from is a + // mistake in the caller's numbers, and quietly shrinking it would hide which of the two they got + // wrong — at boot, where there is time to fix it, rather than during a shutdown. + if (teardownTimeoutMs !== undefined && teardownTimeoutMs > budget) { + throw new Error( + `teardownTimeoutMs (${teardownTimeoutMs}) cannot exceed shutdownTimeoutMs (${budget}) — ` + + 'it is reserved out of that budget, not added to it', + ); + } + + const teardown = new TeardownRegistry(); + for (const hook of hooks ?? []) if (hook.onShutdown) teardown.add(hook.onShutdown); + return teardown; +} + /** Mounts plugins and splices any steps/providers they add into the registry as their own scope. */ -function mountPlugins(plugins: Plugin[] | undefined, bus: Bus, registry: Registry): void { +function mountPlugins(plugins: Plugin[] | undefined, bus: Bus, registry: Registry, teardown: TeardownRegistry): void { const extraSteps: ScopeNode[] = []; const scope: ScopeApi = { add: (node) => extraSteps.push(node) }; - for (const plugin of plugins ?? []) mountPlugin(plugin, bus, scope); + for (const plugin of plugins ?? []) mountPlugin(plugin, bus, scope, (fn) => teardown.add(fn)); for (const scopeNode of extraSteps) { const node = { name: scopeNode.name, needs: scopeNode.needs, provides: scopeNode.provides, origin: 'plugin' }; @@ -667,11 +726,13 @@ async function bootProviders( runners: Map; container: Container; providerMeta: Map; + providerInstances: Map void | Promise }>; + teardown: TeardownRegistry; bus: Bus; logger: Logger; }, ): Promise { - const { runners, container, providerMeta, bus, logger } = deps; + const { runners, container, providerMeta, providerInstances, teardown, bus, logger } = deps; const degraded: string[] = []; for (const node of orderedProviders) { @@ -681,6 +742,15 @@ async function bootProviders( const value = await runners.get(node.name)!(await snapshot(container, node.needs)); container.register(node.name, 'app', () => value); await container.resolve(node.name); // warm the cache + // Registered here, as it boots, rather than where it was collected. `orderedProviders` is + // topologically sorted, so registration order *is* boot order — and the registry running in + // reverse then gives dependants teardown before their dependencies for free, with no second + // sort to keep in step with this one. + // + // Inside the try on purpose: a provider that threw never provided anything, and calling + // dispose() on a half-constructed one is how a teardown finds a null connection. + const instance = providerInstances.get(node.name); + if (instance?.dispose) teardown.add(() => instance.dispose!()); bus.emit('boot:provider:ok', { name: node.name }); } catch (error) { bus.emit('boot:provider:fail', { name: node.name, error }); @@ -717,6 +787,8 @@ function makeAppBooter( runners: Map; container: Container; providerMeta: Map; + providerInstances: Map void | Promise }>; + teardown: TeardownRegistry; bus: Bus; logger: Logger; }, @@ -1006,6 +1078,46 @@ function buildWsRoutes(routePlans: RoutePlan[], deps: PipelineDeps): WsRouteDef[ })); } +/** + * Runs registered teardown, bounded so it cannot push `close()` past the budget it was given. + * + * Bounding lives here rather than in {@link TeardownRegistry} because the registry has no business + * knowing about deadlines — `closeApp` and `closeWithDeadline` each already own one, and a third + * implementation is how the three drift into different meanings of the same `timeoutMs`. + * + * A teardown that overruns is left running rather than awaited: the callback is someone else's code + * and there is no way to interrupt it, so the choice is between returning on time and waiting + * indefinitely. It resolves on its own timer for the same reason `closeWithDeadline` does. + */ +function runTeardown(teardown: TeardownRegistry, logger: Logger, budgetMs: number): Promise { + if (teardown.size === 0) return Promise.resolve(); + + return new Promise((resolve) => { + let settled = false; + + const finish = (): void => { + if (settled) return; + settled = true; + clearTimeout(timer); + resolve(); + }; + + const timer = setTimeout( + () => { + if (settled) return; + logger.warn(`shutdown teardown exceeded its ${Math.max(0, budgetMs)}ms budget — returning without it`, { + budgetMs: Math.max(0, budgetMs), + }); + finish(); + }, + Math.max(0, budgetMs), + ); + + timer.unref?.(); + void teardown.run(logger).then(finish, finish); + }); +} + function closeApp( server: http.Server | undefined, meshLinks: Link[], @@ -1013,8 +1125,17 @@ function closeApp( options: { timeoutMs?: number }, defaultTimeoutMs: number | undefined, logger: Logger, + teardown: TeardownRegistry, + reservedMs: number | undefined, ): Promise { - return new Promise((resolve) => { + const timeoutMs = options.timeoutMs ?? defaultTimeoutMs ?? 10_000; + const startedAt = Date.now(); + // Unset reserves nothing: the drain may use the whole budget and teardown takes what is left. + // Set, it is carved out of the same budget rather than added to it, so `close()` still returns + // within `timeoutMs` — which is the whole reason the caller set that number. + const drainBudget = timeoutMs - (reservedMs ?? 0); + + const drain = new Promise((resolve) => { // A mesh app booted through `app.fetch` has links but no server, and would leak every // teapot connection otherwise — so links close before we even check for a server. closeLinks(meshLinks); @@ -1026,16 +1147,20 @@ function closeApp( if (!server) { if (options.timeoutMs !== undefined) { logger.warn( - 'close({ timeoutMs }) has no effect here — this app has no listen()ed server. On Deno ' + - 'and Bun, call close() on the server serveDeno()/serveBun() returned; it takes the ' + - 'same option. On the edge the platform owns the lifecycle.', + 'close({ timeoutMs }) does not drain connections here — this app has no listen()ed ' + + 'server, so it only bounds teardown. On Deno and Bun, call close() on the server ' + + 'serveDeno()/serveBun() returned; it takes the same option and drains too. On the ' + + 'edge the platform owns the lifecycle.', ); } + // Falls through to teardown rather than returning from close(). An app served through + // `app.fetch` still booted its providers, so it still has connections that were opened and + // are owed a close — the transport being someone else's job does not make them not ours. + // Running teardown twice is safe: the registry drains once, whichever entry point is first. return resolve(); } - const timeoutMs = options.timeoutMs ?? defaultTimeoutMs ?? 10_000; let settled = false; // The timer is armed before `finish` exists, rather than the other way round, and the ordering @@ -1056,7 +1181,7 @@ function closeApp( // below — `engines` in package.json only guarantees >=18, so this matters. server.closeAllConnections(); finish(); - }, timeoutMs); + }, drainBudget); timer.unref?.(); @@ -1072,6 +1197,11 @@ function closeApp( for (const closeStream of streams) closeStream(); server.closeIdleConnections(); }); + + // Teardown runs after the drain and before close() resolves: an in-flight request may still be + // using the connection a teardown is about to close, so draining first is not an ordering + // preference. It gets whatever is left of the budget — at least the reservation, if one was made. + return drain.then(() => runTeardown(teardown, logger, timeoutMs - (Date.now() - startedAt))); } /** Best-effort close of every mesh link, ignoring individual failures. */ diff --git a/src/app/types.ts b/src/app/types.ts index 52e857d..2322acc 100644 --- a/src/app/types.ts +++ b/src/app/types.ts @@ -1,6 +1,7 @@ import type http from 'http'; import type { Bus } from '../bus'; import type { Logger } from '../logger'; +import type { TeardownFn } from '../lifecycle'; import type { GraphNode } from '../graph'; import type { GraphView } from '../graph-viz'; import type { HttpMethod, Transport } from '../metadata'; @@ -103,3 +104,14 @@ export interface MeshConfig { */ heartbeatMs?: number; } + +/** + * Lifecycle participation for an application that does not want to be a plugin. + * + * Every method is optional, and the shape is an object rather than a single callback so later + * stages (`onBoot`, `onReady`) can be added without a breaking change. Only `onShutdown` exists. + */ +export interface Hooks { + /** Run before the app closes. Awaited, bounded by `close()`'s deadline, failures logged. */ + onShutdown?: TeardownFn; +} diff --git a/src/bun.ts b/src/bun.ts index 0857809..50f66d0 100644 --- a/src/bun.ts +++ b/src/bun.ts @@ -119,7 +119,12 @@ export function serveBun(app: App, options?: BunServeShortOptions): BunServeResu return Object.assign(server, { close: (closeOptions: { timeoutMs?: number } = {}): Promise => closeWithDeadline( - () => server.stop(false), + // Drain, then hand over to the app so registered teardown runs — D7 of the teardown design. + // `app.close()` returns at its no-server guard on Bun, but still drains the teardown + // registry, which is what makes one `close()` enough here instead of two. Called without + // options on purpose: passing a timeout it cannot use to drain would only earn its warning, + // and the deadline below already bounds the whole call. + () => server.stop(false).then(() => app.close()), () => void server.stop(true), closeOptions.timeoutMs ?? 10_000, (ms) => diff --git a/src/deno.ts b/src/deno.ts index 809acce..4deca38 100644 --- a/src/deno.ts +++ b/src/deno.ts @@ -78,7 +78,12 @@ export function serveDeno(app: App, options?: DenoServeOptions): DenoServer { return Object.assign(server, { close: (closeOptions: { timeoutMs?: number } = {}): Promise => closeWithDeadline( - () => server.shutdown(), + // Drain, then hand over to the app so registered teardown runs — D7 of the teardown design. + // `app.close()` returns at its no-server guard on Deno, but still drains the teardown + // registry, which is what makes one `close()` enough here instead of two. Called without + // options on purpose: passing a timeout it cannot use to drain would only earn its warning, + // and the deadline below already bounds the whole call. + () => server.shutdown().then(() => app.close()), // Nothing to force, and that is Deno's constraint rather than an omission here. Its two // levers are mutually exclusive: aborting the serve signal after `shutdown()` is already // pending throws `BadResource: Bad resource ID` from Deno's own abort listener, which diff --git a/src/edge.ts b/src/edge.ts index a064aa2..183a022 100644 --- a/src/edge.ts +++ b/src/edge.ts @@ -15,6 +15,13 @@ declare const WebSocketPair: { new (): { 0: EdgeWebSocket; 1: EdgeWebSocket } }; * Cloudflare Workers / edge handler: HTTP + SSE via app.fetch, WebSocket via WebSocketPair. * Use as `export default { fetch: edgeHandler(app) }`. Requires the `nodejs_compat` * compatibility flag. The WS lifecycle runs on ctx.waitUntil so it survives past the 101 response. + * + * **Shutdown teardown never runs here, and nothing can make it.** Node, Deno and Bun all reach the + * teardown registry through a `close()` that some object owns; workerd has no shutdown to intercept + * — an isolate is discarded, not closed. A plugin or provider that relies on `onShutdown`/`dispose()` + * to release something is therefore *silently* inert on the edge, which is why this says so rather + * than a best-effort call on an event that does not exist. Anything that must be released belongs in + * the request that acquired it, or in a platform binding that manages its own lifetime. */ export function edgeHandler( app: App, diff --git a/src/lifecycle.ts b/src/lifecycle.ts new file mode 100644 index 0000000..8987220 --- /dev/null +++ b/src/lifecycle.ts @@ -0,0 +1,70 @@ +// src/lifecycle.ts — the teardown registry. Knows nothing about plugins, providers, apps or HTTP; +// the doors into it live where those things do. +import type { Logger } from './logger'; + +/** + * Something to run before the app goes away. + * + * Takes no arguments on purpose. State lives in the closure that registered it — a provider's + * `dispose()` already holds its own connection, and a plugin's callback already holds whatever the + * plugin built. Nothing has to cross a scope, which is what makes this a registry rather than an + * event bus: a bus solves "tell someone I do not know", and this is "run the thing I registered". + */ +export type TeardownFn = () => void | Promise; + +/** + * Await-aware teardown, deliberately not the {@link Bus}. + * + * `Bus.on` takes a synchronous listener and `emit` swallows failures, both so that an observer can + * never break the pipeline. A teardown needs the opposite of each: it must be awaited, and its + * failure must be visible. Same word, opposite guarantees — see D1 of the design. + * + * Bounding is deliberately *not* here. `closeApp` and `closeWithDeadline` already implement a + * deadline each, and a third implementation is how the three drift into different meanings of the + * same `timeoutMs`. + */ +export class TeardownRegistry { + private readonly callbacks: TeardownFn[] = []; + private drained = false; + + /** Register `fn` to run on shutdown. Later registrations run first — see {@link run}. */ + add(fn: TeardownFn): void { + this.callbacks.push(fn); + } + + /** How many callbacks are registered; lets a caller skip the whole path when nothing wants it. */ + get size(): number { + return this.callbacks.length; + } + + /** + * Run every callback, newest first, awaiting each. + * + * **Reverse registration order is load-bearing.** Providers register as they boot, and they boot + * in topological order, so reversing registration is what gives dependants teardown before their + * dependencies: a `cache` that needs `db` closes before the `db` it is still holding. + * + * Sequential rather than parallel, for the same reason — an order only means something if it is + * waited on. + * + * A failing callback is reported and the next one still runs. One broken teardown must not strand + * the rest or leave the process up. This mirrors `Bus`'s "a subscriber cannot break the system", + * but with the visibility `Bus` lacks: `Bus` swallows silently because no logger existed when it + * was written, and one exists now. + * + * Never throws, and never runs twice — `close()` is called twice by more real applications than + * anyone expects, and a second call must not re-close what the first one closed. + */ + async run(logger: Logger): Promise { + if (this.drained) return; + this.drained = true; + + for (let index = this.callbacks.length - 1; index >= 0; index--) { + try { + await this.callbacks[index](); + } catch (error) { + logger.warn(`a shutdown teardown failed: ${(error as Error)?.message ?? String(error)}`, { error }); + } + } + } +} diff --git a/src/plugin.ts b/src/plugin.ts index 2a0eb6f..92dfa33 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -1,4 +1,5 @@ import { Bus } from './bus'; +import type { TeardownFn } from './lifecycle'; /** A step or provider a plugin contributes to the graph. */ export interface ScopeNode { @@ -13,18 +14,34 @@ export interface ScopeNode { export interface ScopeApi { add(node: ScopeNode): void; } -/** The capabilities handed to a plugin: event subscription and node registration only. */ +/** The capabilities handed to a plugin: event subscription, node registration, and teardown. */ export interface PluginApi { bus: { on: Bus['on'] }; scope: ScopeApi; + /** + * Run something before the app closes — closing a pool, stopping a timer, flushing a buffer. + * + * Takes no arguments: whatever needs closing is already in the closure of the plugin that opened + * it. It is awaited, unlike a `bus.on` listener, and a failure is logged rather than swallowed. + */ + onShutdown(fn: TeardownFn): void; } /** A plugin: a function that wires itself up through the provided PluginApi. */ export type Plugin = (api: PluginApi) => void; /** Runs a plugin against a restricted API, then emits `plugin:mounted`. */ -export function mountPlugin(plugin: Plugin, bus: Bus, scope: ScopeApi): void { - // Hand the plugin ONLY on() and add(). No emit, no other scope. Isolation is structural. - const api: PluginApi = { bus: { on: bus.on.bind(bus) }, scope }; +export function mountPlugin(plugin: Plugin, bus: Bus, scope: ScopeApi, onShutdown: (fn: TeardownFn) => void): void { + // Hand the plugin ONLY on(), add() and onShutdown(). No emit, no other scope, no container. + // + // "Isolation is structural" means this list and nothing else — it is a guarantee about the + // *registration surface*, not about the request context. A plugin's step receives the live + // context like any other step and can overwrite keys in it (`src/pipeline.ts`, `Object.assign`), + // which is a separate, pre-existing question this list has never covered. + // + // `onShutdown` is the first capability here the framework must *wait* for: nothing a plugin did + // before could delay the process. It cannot delay it without bound — `close()`'s deadline still + // caps the whole shutdown. + const api: PluginApi = { bus: { on: bus.on.bind(bus) }, scope, onShutdown }; plugin(api); bus.emit('plugin:mounted', { name: plugin.name || 'anonymous' }); } diff --git a/test/bun/shutdown.test.ts b/test/bun/shutdown.test.ts index f0fc33a..d6919d4 100644 --- a/test/bun/shutdown.test.ts +++ b/test/bun/shutdown.test.ts @@ -49,3 +49,23 @@ test('serveBun close() drains an in-flight request rather than cutting it', asyn expect(await inFlight).toEqual({ ok: true }); }); + +// D7 of the teardown design: proving the Node path works proves nothing here, because app.close() +// returns at its no-server guard on Bun. The teardown has to run from the close() Bun actually uses. +test('serveBun close() runs registered teardown', async () => { + const closed: string[] = []; + const app = createApp({ + modules: [M], + hooks: [{ onShutdown: () => void closed.push('hook') }], + plugins: [(api) => api.onShutdown(async () => { + await Bun.sleep(10); + closed.push('plugin'); + })], + }); + const server = serveBun(app, { port: 0 }); + + await server.close({ timeoutMs: 2000 }); + + // Reverse registration order: the plugin registered after the hook, so it tears down first. + expect(closed).toEqual(['plugin', 'hook']); +}); diff --git a/test/deno/shutdown.test.ts b/test/deno/shutdown.test.ts index 8cee2da..74c43bf 100644 --- a/test/deno/shutdown.test.ts +++ b/test/deno/shutdown.test.ts @@ -63,3 +63,24 @@ Deno.test('a caller-supplied signal still aborts the server', async () => { ac.abort(); await server.finished; // hangs here if chaining the caller's signal into ours dropped it }); + +// D7 of the teardown design: a teardown must run on every runtime that has a shutdown, and it must +// run from the close() the runtime actually uses. app.close() returns at its no-server guard here, +// so proving the Node path works proves nothing about this one — hence a Deno assertion of its own. +Deno.test('serveDeno close() runs registered teardown', async () => { + const closed: string[] = []; + const app = createApp({ + modules: [M], + hooks: [{ onShutdown: () => void closed.push('hook') }], + plugins: [(api) => api.onShutdown(async () => { + await new Promise((r) => setTimeout(r, 10)); + closed.push('plugin'); + })], + }); + const server = serveDeno(app, { port: 0 }); + + await server.close({ timeoutMs: 2000 }); + + // Reverse registration order: the plugin registered after the hook, so it tears down first. + if (closed.join(',') !== 'plugin,hook') throw new Error(`expected plugin,hook — got ${closed.join(',')}`); +}); diff --git a/test/lifecycle.test.ts b/test/lifecycle.test.ts new file mode 100644 index 0000000..975e891 --- /dev/null +++ b/test/lifecycle.test.ts @@ -0,0 +1,86 @@ +import { describe, it, expect, vi } from 'vitest'; +import { TeardownRegistry, type TeardownFn } from '../src/lifecycle'; +import type { Logger } from '../src/logger'; + +const silentLogger = (): Logger => ({ debug: vi.fn(), info: vi.fn(), warn: vi.fn(), error: vi.fn() }); + +describe('TeardownRegistry', () => { + it('runs callbacks newest first, so a dependant tears down before its dependency', async () => { + const order: string[] = []; + const registry = new TeardownRegistry(); + // Providers register as they boot, and they boot in topological order — so `db` registering + // before `cache` is what a `cache` needing `db` actually looks like here. + registry.add(() => void order.push('db')); + registry.add(() => void order.push('cache')); + + await registry.run(silentLogger()); + + expect(order).toEqual(['cache', 'db']); + }); + + it('awaits each callback before starting the next', async () => { + const order: string[] = []; + const registry = new TeardownRegistry(); + registry.add(async () => { + await new Promise((resolve) => setTimeout(resolve, 20)); + order.push('slow'); + }); + registry.add(() => void order.push('fast')); + + await registry.run(silentLogger()); + + // 'fast' is registered last so it runs first; 'slow' must still have finished by return. + expect(order).toEqual(['fast', 'slow']); + }); + + it('logs a throwing callback and still runs the rest', async () => { + const logger = silentLogger(); + const order: string[] = []; + const registry = new TeardownRegistry(); + registry.add(() => void order.push('first')); + registry.add(() => { + throw new Error('boom'); + }); + registry.add(() => void order.push('third')); + + await expect(registry.run(logger)).resolves.toBeUndefined(); + expect(order).toEqual(['third', 'first']); + expect(logger.warn).toHaveBeenCalledOnce(); + expect(vi.mocked(logger.warn).mock.calls[0][0]).toMatch(/boom/); + }); + + it('treats a rejecting async callback the same as a throwing one', async () => { + const logger = silentLogger(); + const registry = new TeardownRegistry(); + registry.add(() => Promise.reject(new Error('async boom'))); + registry.add(() => Promise.resolve()); + + await expect(registry.run(logger)).resolves.toBeUndefined(); + expect(vi.mocked(logger.warn).mock.calls[0][0]).toMatch(/async boom/); + }); + + it('does not re-run callbacks on a second close()', async () => { + let runs = 0; + const registry = new TeardownRegistry(); + registry.add(() => void runs++); + + await registry.run(silentLogger()); + await registry.run(silentLogger()); + + expect(runs).toBe(1); + }); + + it('resolves when nothing is registered, and reports an empty size', async () => { + const registry = new TeardownRegistry(); + expect(registry.size).toBe(0); + await expect(registry.run(silentLogger())).resolves.toBeUndefined(); + }); + + it('reports how many callbacks are registered', () => { + const registry = new TeardownRegistry(); + const noop: TeardownFn = () => {}; + registry.add(noop); + registry.add(noop); + expect(registry.size).toBe(2); + }); +}); diff --git a/test/plugin.test.ts b/test/plugin.test.ts index c1f620b..edc8afa 100644 --- a/test/plugin.test.ts +++ b/test/plugin.test.ts @@ -1,6 +1,9 @@ import { expect, test, vi } from 'vitest'; import { Bus } from '../src/bus'; import { mountPlugin, Plugin, ScopeApi } from '../src/plugin'; +import type { TeardownFn } from '../src/lifecycle'; + +const noTeardown = (): ((fn: TeardownFn) => void) => () => {}; test('plugin can observe via bus.on and add to its own scope', () => { const bus = new Bus(); @@ -14,7 +17,7 @@ test('plugin can observe via bus.on and add to its own scope', () => { const mounted = vi.fn(); bus.on('plugin:mounted', mounted); - mountPlugin(logger, bus, scope); + mountPlugin(logger, bus, scope, noTeardown()); expect(added).toEqual(['log']); expect(mounted).toHaveBeenCalled(); @@ -26,5 +29,37 @@ test('plugin api does NOT expose bus.emit', () => { const plugin: Plugin = (api) => { expect((api.bus as any).emit).toBeUndefined(); }; - mountPlugin(plugin, bus, scope); + mountPlugin(plugin, bus, scope, noTeardown()); +}); + +test('plugin can register a teardown, and it reaches the registry', () => { + const bus = new Bus(); + const registered: TeardownFn[] = []; + const plugin: Plugin = (api) => { + api.onShutdown(() => {}); + }; + + mountPlugin(plugin, bus, { add: () => {} }, (fn) => registered.push(fn)); + + expect(registered).toHaveLength(1); +}); + +// D3's no-break guarantee, asserted rather than assumed: `Plugin`'s signature did not change, so a +// plugin written before this capability existed must mount and behave exactly as it did. +test('a plugin that never calls onShutdown behaves exactly as before', () => { + const bus = new Bus(); + const added: string[] = []; + const registered: TeardownFn[] = []; + const legacy: Plugin = (api) => { + api.bus.on('stream:open', () => {}); + api.scope.add({ kind: 'provider', name: 'thing', needs: [], provides: ['thing'], run: () => ({}) }); + }; + + const mounted = vi.fn(); + bus.on('plugin:mounted', mounted); + mountPlugin(legacy, bus, { add: (n) => added.push(n.name) }, (fn) => registered.push(fn)); + + expect(added).toEqual(['thing']); + expect(mounted).toHaveBeenCalled(); + expect(registered).toHaveLength(0); }); diff --git a/test/teardown.test.ts b/test/teardown.test.ts new file mode 100644 index 0000000..d99f907 --- /dev/null +++ b/test/teardown.test.ts @@ -0,0 +1,215 @@ +import 'reflect-metadata'; +import { describe, expect, it, vi } from 'vitest'; +import { Provider, Module, Route, Get } from '../src/metadata'; +import { createApp } from '../src/app'; +import type { Plugin } from '../src/plugin'; +import type { Logger } from '../src/logger'; + +const silentLogger = (): Logger => ({ debug: vi.fn(), info: vi.fn(), warn: vi.fn(), error: vi.fn() }); + +@Route('/') +class Ctl { + @Get('/ping') ping() { + return { ok: true }; + } +} + +describe('shutdown teardown', () => { + it('awaits a plugin onShutdown before close() resolves', async () => { + const order: string[] = []; + const plugin: Plugin = (api) => { + api.onShutdown(async () => { + await new Promise((r) => setTimeout(r, 20)); + order.push('plugin torn down'); + }); + }; + + @Module({ mountpoint: '/', controllers: [Ctl] }) + class M {} + const app = createApp({ modules: [M], plugins: [plugin], logger: silentLogger() }); + await app.listen(0); + await app.close(); + order.push('close returned'); + + expect(order).toEqual(['plugin torn down', 'close returned']); + }); + + it('runs a hook onShutdown without the app declaring a plugin', async () => { + const seen: string[] = []; + @Module({ mountpoint: '/', controllers: [Ctl] }) + class M {} + const app = createApp({ + modules: [M], + hooks: [{ onShutdown: () => void seen.push('hook') }], + logger: silentLogger(), + }); + await app.listen(0); + await app.close(); + + expect(seen).toEqual(['hook']); + }); + + it('calls a provider dispose(), and skips a provider without one', async () => { + const closed: string[] = []; + + @Provider({ provides: 'db' }) + class Db { + provide() { + return { db: {} }; + } + async dispose() { + closed.push('db'); + } + } + @Provider({ provides: 'plain' }) + class Plain { + provide() { + return { plain: {} }; + } + } + + @Module({ mountpoint: '/', providers: [Db, Plain], controllers: [Ctl] }) + class M {} + const app = createApp({ modules: [M], logger: silentLogger() }); + await app.listen(0); + await app.close(); + + expect(closed).toEqual(['db']); + }); + + // D5, and the reason dispose() is registered as a provider boots rather than as it is collected. + it('tears a dependant down before the dependency it needs', async () => { + const closed: string[] = []; + + @Provider({ provides: 'db' }) + class Db { + provide() { + return { db: {} }; + } + dispose() { + closed.push('db'); + } + } + @Provider({ provides: 'cache', needs: ['db'] }) + class Cache { + provide() { + return { cache: {} }; + } + dispose() { + closed.push('cache'); + } + } + + // Declared dependency-last on purpose: the order must come from the graph, not the array. + @Module({ mountpoint: '/', providers: [Cache, Db], controllers: [Ctl] }) + class M {} + const app = createApp({ modules: [M], logger: silentLogger() }); + await app.listen(0); + await app.close(); + + expect(closed).toEqual(['cache', 'db']); + }); + + it('does not dispose a provider that failed to boot', async () => { + const closed: string[] = []; + + @Provider({ provides: 'broken', optional: true }) + class Broken { + provide(): unknown { + throw new Error('cannot connect'); + } + dispose() { + closed.push('broken'); + } + } + + @Module({ mountpoint: '/', providers: [Broken], controllers: [Ctl] }) + class M {} + const app = createApp({ modules: [M], logger: silentLogger() }); + await app.listen(0); + await app.close(); + + expect(closed).toEqual([]); + }); + + it('logs a failing teardown, runs the rest, and still resolves', async () => { + const logger = silentLogger(); + const closed: string[] = []; + const plugin: Plugin = (api) => { + api.onShutdown(() => { + throw new Error('teardown boom'); + }); + api.onShutdown(() => void closed.push('survivor')); + }; + + @Module({ mountpoint: '/', controllers: [Ctl] }) + class M {} + const app = createApp({ modules: [M], plugins: [plugin], logger }); + await app.listen(0); + await expect(app.close()).resolves.toBeUndefined(); + + expect(closed).toEqual(['survivor']); + expect(vi.mocked(logger.warn).mock.calls.some((c) => /teardown boom/.test(c[0]))).toBe(true); + }); + + it('does not let a hanging teardown push close() past its deadline', async () => { + const plugin: Plugin = (api) => { + api.onShutdown(() => new Promise(() => {})); // never settles + }; + + @Module({ mountpoint: '/', controllers: [Ctl] }) + class M {} + const app = createApp({ modules: [M], plugins: [plugin], logger: silentLogger() }); + await app.listen(0); + + const startedAt = Date.now(); + await app.close({ timeoutMs: 300 }); + expect(Date.now() - startedAt).toBeLessThan(1500); + }); + + it('rejects a reservation larger than the budget it comes out of', () => { + @Module({ mountpoint: '/', controllers: [Ctl] }) + class M {} + expect(() => createApp({ modules: [M], shutdownTimeoutMs: 1000, teardownTimeoutMs: 2000 })).toThrow( + /cannot exceed shutdownTimeoutMs/, + ); + }); + + it('tears down an app that was never listen()ed, since its providers still booted', async () => { + const closed: string[] = []; + + @Provider({ provides: 'db' }) + class Db { + provide() { + return { db: {} }; + } + dispose() { + closed.push('db'); + } + } + + @Module({ mountpoint: '/', providers: [Db], controllers: [Ctl] }) + class M {} + const app = createApp({ modules: [M], logger: silentLogger() }); + await app.fetch(new Request('http://x/ping')); // boots providers, no server + await app.close(); + + expect(closed).toEqual(['db']); + }); + + it('drains only once when close() is called twice', async () => { + let runs = 0; + const plugin: Plugin = (api) => { + api.onShutdown(() => void runs++); + }; + + @Module({ mountpoint: '/', controllers: [Ctl] }) + class M {} + const app = createApp({ modules: [M], plugins: [plugin], logger: silentLogger() }); + await app.listen(0); + await app.close(); + await app.close(); + + expect(runs).toBe(1); + }); +}); From 62d0b7aa3a2df0334e9d99cf0cb75a4487c98d8c Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Mon, 17 Aug 2026 11:44:49 -0500 Subject: [PATCH 37/46] test: execute the circuit-breaker recipe the docs publish MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The recipe closing #13 lives in the documentation repository, which imports nothing from here — so nothing fails when the page and the framework drift apart. That is the seam Phase 4 opened, and a worked example that quietly stops working is the worst version of it: it is the page a reader trusts most, because it looks like code that ran. This executes the three claims the page rests on rather than asserting them in prose. That breaker state survives across requests, which is the entire reason the recipe uses a provider and not a step. That the window re-opens after it elapses. And that a failed trial in half-open re-opens immediately instead of making a recovering upstream earn the full threshold again. Beyond the file list Phase 5 asked for, which named only the guide page. Kept because it is small and it turns Task 4.4's written rule into something that fails, for one page at least. Signed-off-by: Diego Resendez --- test/circuit-breaker-recipe.test.ts | 164 ++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 test/circuit-breaker-recipe.test.ts diff --git a/test/circuit-breaker-recipe.test.ts b/test/circuit-breaker-recipe.test.ts new file mode 100644 index 0000000..704b2f2 --- /dev/null +++ b/test/circuit-breaker-recipe.test.ts @@ -0,0 +1,164 @@ +// Executes the circuit-breaker recipe published at +// https://green-tea.expressive-tea.io/docs/guides/circuit-breaker/ +// +// The recipe lives in the documentation repository, which imports nothing from here, so nothing +// fails when the two drift apart. This is the smallest thing that makes the page's load-bearing +// claims executable rather than merely written: that breaker state survives across requests (which +// is why it is a provider and not a step), that the window re-opens, and that a failed trial in +// half-open re-opens immediately instead of earning the threshold again. +// +// Keep the class below identical to the page. If you change one, change both. +import 'reflect-metadata'; +import { describe, expect, it } from 'vitest'; +import { Provider, Module, Route, Get } from '../src/metadata'; +import { createApp } from '../src/app'; +import { HttpError } from '../src/signals'; +import { needs } from '../src/params'; + +// ---- the recipe, verbatim --------------------------------------------------------------------- + +type BreakerState = 'closed' | 'open' | 'half-open'; + +class CircuitBreaker { + #state: BreakerState = 'closed'; + #failures = 0; + #openedAt = 0; + + constructor( + private readonly threshold: number, + private readonly resetMs: number, + private readonly now: () => number = Date.now, + ) {} + + get state(): BreakerState { + return this.#state; + } + + async call(operation: () => Promise): Promise { + if (this.#state === 'open') { + if (this.now() - this.#openedAt < this.resetMs) { + throw new HttpError(503, 'billing is unavailable'); + } + this.#state = 'half-open'; + } + + try { + const result = await operation(); + this.#state = 'closed'; + this.#failures = 0; + return result; + } catch (error) { + this.#failures++; + if (this.#state === 'half-open' || this.#failures >= this.threshold) { + this.#state = 'open'; + this.#openedAt = this.now(); + } + throw error; + } + } +} + +interface BillingApi { + charge(userId: string): Promise<{ ok: true }>; +} + +@Provider({ provides: 'billing', needs: ['billingApi'] }) +class GuardedBilling { + #breaker = new CircuitBreaker(3, 30_000); + + provide({ billingApi }: { billingApi: BillingApi }) { + return { + billing: { + charge: (userId: string) => this.#breaker.call(() => billingApi.charge(userId)), + }, + billingBreaker: this.#breaker, + }; + } +} + +// ---- the test --------------------------------------------------------------------------------- + +describe('circuit-breaker recipe', () => { + it('opens after the threshold and short-circuits, sharing state across requests', async () => { + let calls = 0; + + @Provider({ provides: 'billingApi' }) + class FailingBilling { + provide() { + return { + billingApi: { + charge: async () => { + calls++; + throw new Error('upstream down'); + }, + } satisfies BillingApi, + }; + } + } + + @Route('/') + class Ctl { + @Get('/pay') + async pay(@needs('billing') billing: { charge(id: string): Promise }) { + try { + await billing.charge('u1'); + return { ok: true }; + } catch (error) { + return { failed: (error as Error).message }; + } + } + } + + @Module({ mountpoint: '/', providers: [FailingBilling, GuardedBilling], controllers: [Ctl] }) + class M {} + const app = createApp({ modules: [M] }); + + const hit = async () => (await (await app.fetch(new Request('http://x/pay'))).json()) as { failed: string }; + + // Three real attempts trip it; the fourth never reaches the upstream. The breaker survives + // across requests, which is the whole reason it is a provider and not a step. + expect((await hit()).failed).toBe('upstream down'); + expect((await hit()).failed).toBe('upstream down'); + expect((await hit()).failed).toBe('upstream down'); + expect(calls).toBe(3); + + expect((await hit()).failed).toBe('billing is unavailable'); + expect(calls).toBe(3); // short-circuited — upstream was not called again + + await app.close(); + }); + + it('half-opens after the reset window and closes again on success', async () => { + let clock = 0; + let fail = true; + const breaker = new CircuitBreaker(2, 1000, () => clock); + const call = () => + breaker.call(async () => { + if (fail) throw new Error('down'); + return 'ok'; + }); + + await expect(call()).rejects.toThrow('down'); + await expect(call()).rejects.toThrow('down'); + expect(breaker.state).toBe('open'); + + await expect(call()).rejects.toThrow('billing is unavailable'); // still inside the window + + clock = 2000; + fail = false; + await expect(call()).resolves.toBe('ok'); + expect(breaker.state).toBe('closed'); + }); + + it('re-opens when the trial request in half-open fails', async () => { + let clock = 0; + const breaker = new CircuitBreaker(1, 1000, () => clock); + + await expect(breaker.call(async () => Promise.reject(new Error('down')))).rejects.toThrow('down'); + expect(breaker.state).toBe('open'); + + clock = 2000; + await expect(breaker.call(async () => Promise.reject(new Error('down')))).rejects.toThrow('down'); + expect(breaker.state).toBe('open'); // one failed trial is enough, threshold not restarted + }); +}); From 38b73cebce7ed672445bc077748b492092033e40 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Mon, 17 Aug 2026 11:56:50 -0500 Subject: [PATCH 38/46] docs(readme): say which parts are settled and which still move MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The last thing a reader needs before betting on a beta, and the one thing Honest scope did not answer: it admits what is missing, not what is likely to change under them. Present state only. No dates, no delivery commitment, and deliberately not a roadmap — this is one person's spare-time work, and a schedule it cannot keep would cost more trust than the schedule earns. The API freeze stays declared under **next**, untouched, and gets planned near the RC. Every tier is read off the history rather than asserted. The graph is settled because graph.ts and container.ts have not been touched since the beta hardening on 7 July, and because the changes to metadata.ts since then only add decorators (@Head, @Options, @Html) rather than redefine the ones that were there. The plugin API is listed as moving because it moved this week. The pipeline context is listed because 4081106 made it one object mutated in place, which changed what a step that captured it observes — a real semantic change, not a perf note, and worth a reader knowing. Two claims the trust-release plan proposed are not made. It grouped decorator syntax with the volatile things; the volatility there is TC39's, not ours, and README already explains it. And it listed the CLI, which ships from its own repository on its own version line, so nothing here can honestly speak for it. Signed-off-by: Diego Resendez --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 3bf4398..dda1bdb 100644 --- a/README.md +++ b/README.md @@ -253,6 +253,8 @@ green-tea is **beta**, on the road to a release candidate. Express and Fastify h **mesh is alpha.** Distributed DI works, but discovery, load-balancing, and failover are not built, and its API and wire protocol may change between releases. It is gated behind an explicit opt-in — `createApp({ mesh, experimental: true })` — and `createApp` throws if you configure `mesh` without it. Don't ship mesh to production yet. +**What is settled, and what is still moving.** Present state, not a roadmap and not the API freeze — this is spare-time work by one person, and a schedule it cannot keep would cost more than it earns. The **graph is the settled part**: `needs`/`provides`, the order derived from them, and the boot-time failure when nothing provides a key have not changed since the beta hardening on 7 July, and `@Provider`, `@Step`, `@Route` and handler shapes still mean what they meant then — the decorator *set* has grown (`@Head`, `@Options`, `@Html`), which only ever adds. **Still moving:** the plugin API, which gained `onShutdown` this week; `createApp`'s options, which gain fields most months; and the pipeline context, which in July became one object mutated in place rather than copied per step — so a step that captured it now sees later steps' writes. **Alpha:** mesh, above. Legacy decorators are a standing *external* risk rather than a green-tea one — see [Why legacy decorators](#why-legacy-decorators). The [matcha](https://github.com/Expressive-Tea/matcha) CLI ships from its own repository on its own version line, so nothing here speaks for it. + ## Docs & development - **[green-tea.expressive-tea.io/docs](https://green-tea.expressive-tea.io/docs)** — getting started, concepts (the graph, `flow`), and guides: routing, DI, validation, uploads, streaming, HTML, security, errors, introspection, OpenAPI, plugins, mesh, runtimes, testing. Its source lives in [green-tea-docs](https://github.com/Expressive-Tea/green-tea-docs); a change to public API here needs a matching change there, because nothing fails when the two disagree. From cd6e2f073f4959dea6c230a47ca7b8b840f2460a Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Mon, 17 Aug 2026 12:11:29 -0500 Subject: [PATCH 39/46] docs: put the docs-drift rule where a contributor reads it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task 4.4's obligation was to state the risk the docs split opens, and the first pass met it in the two places that publish rather than the two that govern: both READMEs. The core README's copy sits in "Docs & development", a section a user reads and a contributor about to rename a decorator does not. AGENTS.md and CONTRIBUTING.md both already carried "New public API needs a note in README.md". Both were written before the split and neither was updated for it, so the two documents actually read mid-change said nothing about the new repository — the rule existed everywhere except where it applies. Both now name green-tea-docs and carry the reason, because a rule without one is the first thing dropped when a change is nearly finished. #18 is that reason, and it happened while the two still lived in the same repository. Neither automated option was built, and the plan now records which is worth building and why: a link check against the published package targets #18's real failure mode — a page naming a decorator, a createApp option or a method that no longer exists — and needs only the identifiers in the pages' code blocks compared against the package's exports. It catches lies rather than staleness. A docs job triggered from core releases is weaker: it fires after the API has already shipped. Signed-off-by: Diego Resendez --- AGENTS.md | 2 +- CONTRIBUTING.md | 2 +- docs/plans/2026-08-16-trust-release-plan.md | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 09d4f29..66d3473 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -80,4 +80,4 @@ GitHub does not run workflows on fork pull requests until a maintainer approves - Comments carry reasoning the code cannot show. When editing a block, keep them; if one explains an ordering or a version floor, it is load-bearing. - A new option or method on a public interface has to change `src/app/types.ts` too. An implementation that grows a parameter alone is unreachable for anyone consuming the package. - Behaviour that differs between runtimes must be explicit. An "unavailable here" is fine; silently accepting an option that does nothing is a bug. -- New public API needs a note in `README.md`. +- New public API needs a note in `README.md` **and a matching change in the documentation repository**, [green-tea-docs](https://github.com/Expressive-Tea/green-tea-docs). Since the split, nothing here imports those pages and nothing fails when they disagree with this code — the CI job that used to build them is gone. That makes this the only thing standing between a rename and a guide that quietly documents a version nobody can install. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dab7834..b757c26 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -148,7 +148,7 @@ npm run build - `complexity:check` caps the cognitive complexity of every function in `src/`. What it measures is how much you have to hold in your head to follow a function from top to bottom, and it charges nesting more heavily than branching: a condition inside a closure inside a function costs several times what the same condition costs at the top level. Going over the threshold is not a verdict on your code — it means one function has grown to ask too much of whoever reads it next. The fix is nearly always to lift a nested closure out to module scope, where its branches are charged once instead of three times over. Raising `COMPLEXITY_MAX` is not the fix, even though the script suggests it. - Keep runtime dependencies at zero beyond `reflect-metadata`. - A new option or method on a public interface has to change that interface too. An implementation that grows a parameter without `src/app/types.ts` growing it as well is unreachable for anyone consuming the package. -- New public API needs a doc note in `README.md`. +- New public API needs a doc note in `README.md`, **and the page that documents it in [green-tea-docs](https://github.com/Expressive-Tea/green-tea-docs) updated in the same pull request.** The documentation site used to be built by this repository's CI, so a stale page broke the build; it is now a separate repository that imports nothing from here, and nothing fails when the two disagree. Issue #18 happened when the two still lived together, which is the reason this line exists rather than a hope. - If your change only works on one runtime, say so in the pull request. green-tea runs on Node, Deno, Bun and the edge, and behavior that quietly differs between them is treated as a bug — an explicit "not available here" is fine, silence is not. On GitHub, workflows do not run on pull requests from forks until a maintainer approves them, so your first push may sit without any checks for a while. That is not a rejection. diff --git a/docs/plans/2026-08-16-trust-release-plan.md b/docs/plans/2026-08-16-trust-release-plan.md index 0f6370d..26b9017 100644 --- a/docs/plans/2026-08-16-trust-release-plan.md +++ b/docs/plans/2026-08-16-trust-release-plan.md @@ -241,6 +241,14 @@ Delete the three `ci.yml` steps, the two `package.json` scripts, and `website/`. The split trades CI coupling for drift risk: docs and code can now disagree without anything failing. #18 exists precisely because docs fell behind an API change. Decide what catches that — a link check against the published package, a docs job triggered from core releases, or an explicit accepted risk written down. Do not leave it unstated. +**Resolved 2026-08-17: accepted risk, stated where the rule is read rather than where it is published.** The first pass put it in both READMEs and stopped there, which satisfies the letter of "do not leave it unstated" and little else — the core README's copy sits in *Docs & development*, a section a user reads and a contributor changing an API does not. + +What governs behaviour is `AGENTS.md:83` and the pre-PR checklist in `CONTRIBUTING.md`, both of which already carried *"New public API needs a note in `README.md`"* — written before the split and never updated for it, so the two documents that a contributor (or an assistant) actually reads mid-change said nothing about the new repository. Both now name it and say why the rule exists, since a rule without its reason is the first one dropped under time pressure. + +Neither automated option was built. The **link check against the published package** remains the one worth building: it targets #18's actual failure mode — a page naming a decorator, a `createApp` option or a method that no longer exists — and it is cheap, because it only has to extract identifiers from the pages' code blocks and compare them against the package's exports. It catches lies, not staleness. A **docs job triggered from core releases** is the weaker of the two: it fires after the API has already shipped. + +One page is covered by more than a rule: `test/circuit-breaker-recipe.test.ts` executes the recipe published in `guides/circuit-breaker.md`. That is one page of twenty-five, and is not a substitute for the check above. + --- ## Phase 4.5: Move the JSR gate off the tag — **run this before Task 2.5's code** From 21765c2a47f13066377ae2cea5adef367847ce72 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Mon, 17 Aug 2026 12:17:30 -0500 Subject: [PATCH 40/46] docs: put the docs-drift warning where nobody can miss it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The rule was already in both READMEs, and in both it was a subordinate clause at the end of something else — a trailing "because nothing fails when the two disagree" here, a closing section titled "The seam this repository opens" there. Written, and easy to read past. Both are now a callout: what breaks, that nothing tells you, and what to do instead. The docs repository's moves to the top, above how to run it, because someone opening that repository is usually about to edit a page. Deliberately not in the marketing site. That risk belongs to whoever changes the API, not to whoever is deciding whether to try the framework. Signed-off-by: Diego Resendez --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dda1bdb..9232a26 100644 --- a/README.md +++ b/README.md @@ -257,9 +257,12 @@ green-tea is **beta**, on the road to a release candidate. Express and Fastify h ## Docs & development -- **[green-tea.expressive-tea.io/docs](https://green-tea.expressive-tea.io/docs)** — getting started, concepts (the graph, `flow`), and guides: routing, DI, validation, uploads, streaming, HTML, security, errors, introspection, OpenAPI, plugins, mesh, runtimes, testing. Its source lives in [green-tea-docs](https://github.com/Expressive-Tea/green-tea-docs); a change to public API here needs a matching change there, because nothing fails when the two disagree. +- **[green-tea.expressive-tea.io/docs](https://green-tea.expressive-tea.io/docs)** — getting started, concepts (the graph, `flow`), and guides: routing, DI, validation, uploads, streaming, HTML, security, errors, introspection, OpenAPI, plugins, mesh, runtimes, testing. Its source lives in [green-tea-docs](https://github.com/Expressive-Tea/green-tea-docs). - **[matcha](https://github.com/Expressive-Tea/matcha)** — the CLI. `matcha new` scaffolds a project (Node, Deno, or Bun), `matcha create` generates and auto-wires controllers/steps/providers/modules, `matcha run` detects your runtime and watches. A standalone Rust binary — no JS runtime needed to install it. +> **Changing public API? The docs are a separate repository now, and nothing tells you when you break them.** +> [green-tea-docs](https://github.com/Expressive-Tea/green-tea-docs) imports nothing from here, so no build fails and no test turns red when a guide describes an API that no longer exists. **A pull request that changes public API updates the page documenting it, in the same pull request.** This is a rule rather than a check because no check exists yet — issue #18 is what a stale page looks like from a user's side, and that happened while both still lived in this repository. + ```bash npm install npm test # vitest (Node only) — the fast loop, ~2s From 0414aff6657177d1091d086ef463638b130423e7 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Mon, 17 Aug 2026 12:32:01 -0500 Subject: [PATCH 41/46] docs(plans): reject the docs link check, and record what measuring it showed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was recommended in this plan as the automated guard worth building. Building enough of it to decide argued the other way, and the reasoning is worth keeping so the next person does not spend the afternoon rediscovering it. The narrow version is clean and useless: all 24 symbols the pages import from @green-tea/core exist among the package's 101 exports, so it finds nothing — and it structurally could not have caught #18, the one incident there is. That was close() gaining an option the docs never mentioned. Imports are the part that does not drift. Widening it to options and methods produced 17 findings and all 17 were false. A regex cannot separate a nested tls: { key, cert } from a top-level option, or prose describing Express's app.use() from a green-tea call. A check that cries wolf 17 times out of 17 is worse than none, because people learn to skip it. Type-checking the code blocks would catch the real class, and costs the documentation repository a dependency on the framework plus examples that must compile — buying the guarantee back by spending the independence the split was for. The accepted risk stands, now chosen rather than defaulted to. Signed-off-by: Diego Resendez --- docs/plans/2026-08-16-trust-release-plan.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/plans/2026-08-16-trust-release-plan.md b/docs/plans/2026-08-16-trust-release-plan.md index 26b9017..6999de4 100644 --- a/docs/plans/2026-08-16-trust-release-plan.md +++ b/docs/plans/2026-08-16-trust-release-plan.md @@ -245,7 +245,14 @@ The split trades CI coupling for drift risk: docs and code can now disagree with What governs behaviour is `AGENTS.md:83` and the pre-PR checklist in `CONTRIBUTING.md`, both of which already carried *"New public API needs a note in `README.md`"* — written before the split and never updated for it, so the two documents that a contributor (or an assistant) actually reads mid-change said nothing about the new repository. Both now name it and say why the rule exists, since a rule without its reason is the first one dropped under time pressure. -Neither automated option was built. The **link check against the published package** remains the one worth building: it targets #18's actual failure mode — a page naming a decorator, a `createApp` option or a method that no longer exists — and it is cheap, because it only has to extract identifiers from the pages' code blocks and compare them against the package's exports. It catches lies, not staleness. A **docs job triggered from core releases** is the weaker of the two: it fires after the API has already shipped. +**The link check was prototyped and then rejected, on measurement rather than taste.** It had been recommended here as the one worth building; building enough of it to decide showed otherwise. + +- Every symbol the pages import is real: **24 distinct imports from `@green-tea/core` across 25 pages, all present** among the package's 101 exports. No bug for it to find today. +- More decisively, **an import check could not have caught #18**. That issue was *"docs still describe `close()` without the timeout"* — the method existed; the **option** was undocumented. Imports are the part that does not drift. Options, option shapes and method signatures are. +- Extending it to options and methods was tried and produced **17 findings, all 17 false** — a regex cannot tell a nested `tls: { key, cert }` from a top-level option, `app.example.com` in a CORS example from an `app.*` call, or prose describing Express's `app.use()` from a green-tea API. A check with that signal-to-noise trains people to ignore it, which is worse than not having one. +- What would genuinely catch #18's class is **type-checking the code blocks** (twoslash / Expressive Code). That requires the documentation repository to depend on `@green-tea/core` and its examples to be complete and compilable — many are deliberately fragments. It buys the guarantee back by spending exactly the independence this split was for. + +So the accepted risk stands, now as an informed choice rather than a default. A **docs job triggered from core releases** was the other option and remains the weaker one: it fires after the API has already shipped. One page is covered by more than a rule: `test/circuit-breaker-recipe.test.ts` executes the recipe published in `guides/circuit-breaker.md`. That is one page of twenty-five, and is not a substitute for the check above. From bead3c1569fad40856e96ffb96b50010d9ddb90a Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Mon, 17 Aug 2026 12:38:09 -0500 Subject: [PATCH 42/46] docs: make the docs rule followable by the people it addresses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two problems with the rule added earlier today, both found by asking what it means for the beta rather than whether to automate it. green-tea is public and green-tea-docs was private, so CONTRIBUTING.md — read by external contributors — pointed them at a repository that answered 404 and asked them to change a page they could not see. The repository is now public, which is what makes the rule possible at all; nothing in it was ever private, since the history came from this repository's own website/ directory. And "in the same pull request" cannot be done: a pull request does not span two repositories. It is a companion pull request, linked to the first, and both documents now say so. Added the escape hatch the rule was missing. A contributor who does not want to write the docs change can say so and a maintainer writes it — what this line exists to prevent is an API change nobody mentions, not an unwritten page, and a rule with no honest way out gets ignored rather than followed. Neither the automation decision nor the accepted risk changes. The link check stays rejected on the measurement recorded in the trust-release plan. Signed-off-by: Diego Resendez --- AGENTS.md | 2 +- CONTRIBUTING.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 66d3473..a0858be 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -80,4 +80,4 @@ GitHub does not run workflows on fork pull requests until a maintainer approves - Comments carry reasoning the code cannot show. When editing a block, keep them; if one explains an ordering or a version floor, it is load-bearing. - A new option or method on a public interface has to change `src/app/types.ts` too. An implementation that grows a parameter alone is unreachable for anyone consuming the package. - Behaviour that differs between runtimes must be explicit. An "unavailable here" is fine; silently accepting an option that does nothing is a bug. -- New public API needs a note in `README.md` **and a matching change in the documentation repository**, [green-tea-docs](https://github.com/Expressive-Tea/green-tea-docs). Since the split, nothing here imports those pages and nothing fails when they disagree with this code — the CI job that used to build them is gone. That makes this the only thing standing between a rename and a guide that quietly documents a version nobody can install. +- New public API needs a note in `README.md` **and a companion pull request to the documentation repository**, [green-tea-docs](https://github.com/Expressive-Tea/green-tea-docs) — separate, because a pull request cannot span two repositories. Since the split, nothing here imports those pages and nothing fails when they disagree with this code — the CI job that used to build them is gone. That makes this the only thing standing between a rename and a guide that quietly documents a version nobody can install. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b757c26..bce09df 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -148,7 +148,7 @@ npm run build - `complexity:check` caps the cognitive complexity of every function in `src/`. What it measures is how much you have to hold in your head to follow a function from top to bottom, and it charges nesting more heavily than branching: a condition inside a closure inside a function costs several times what the same condition costs at the top level. Going over the threshold is not a verdict on your code — it means one function has grown to ask too much of whoever reads it next. The fix is nearly always to lift a nested closure out to module scope, where its branches are charged once instead of three times over. Raising `COMPLEXITY_MAX` is not the fix, even though the script suggests it. - Keep runtime dependencies at zero beyond `reflect-metadata`. - A new option or method on a public interface has to change that interface too. An implementation that grows a parameter without `src/app/types.ts` growing it as well is unreachable for anyone consuming the package. -- New public API needs a doc note in `README.md`, **and the page that documents it in [green-tea-docs](https://github.com/Expressive-Tea/green-tea-docs) updated in the same pull request.** The documentation site used to be built by this repository's CI, so a stale page broke the build; it is now a separate repository that imports nothing from here, and nothing fails when the two disagree. Issue #18 happened when the two still lived together, which is the reason this line exists rather than a hope. +- New public API needs a doc note in `README.md`, **and a companion pull request to [green-tea-docs](https://github.com/Expressive-Tea/green-tea-docs) updating the page that documents it.** It is a second pull request because a pull request cannot span two repositories — link the two to each other so a reviewer can see both. The documentation site used to be built by this repository's CI, so a stale page broke the build; it is now a separate repository that imports nothing from here, and nothing fails when the two disagree. Issue #18 happened when the two still lived together, which is the reason this line exists rather than a hope. If you would rather not write the docs change, say so in your pull request and a maintainer will — an unmentioned API change is the failure this line exists to prevent, not an unwritten page. - If your change only works on one runtime, say so in the pull request. green-tea runs on Node, Deno, Bun and the edge, and behavior that quietly differs between them is treated as a bug — an explicit "not available here" is fine, silence is not. On GitHub, workflows do not run on pull requests from forks until a maintainer approves them, so your first push may sit without any checks for a while. That is not a rejection. From bb75cabeeabeaffc292eff9e0c49d3983ded2fe7 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Mon, 17 Aug 2026 12:50:37 -0500 Subject: [PATCH 43/46] docs(changelog): record the release's largest feature, which was missing entirely MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unreleased carried two entries for the 81 commits since v26.8.0-beta.0, and the observability contract was not one of them — the feature four independent reviews named as the project's biggest gap, and the reason issue #10 existed, had no changelog presence in any version. Someone deciding whether to upgrade would have read the release as a shutdown fix. Also added, in the order a reader needs them rather than the order they landed: Changed: `.` and `..` in a request path now resolve instead of 404ing. This is a behaviour change and belongs under Changed rather than buried in Fixed — it is Node-only, it ends a divergence where the same bytes reached different routes per runtime, and it is worth telling anyone whose proxy matches on the literal path that the proxy and the application no longer agree. Fixed: the BodyInit narrowing on the app.fetch path, which is the path Deno, Bun and the edge all use, and the shutdown timer ordering that left a ReferenceError waiting for whoever touched it next. Found by diffing the public surface at the tag against HEAD rather than rereading the file. `createApp` gained five options and the package eleven exports since the beta; the entries above are what had no home. Signed-off-by: Diego Resendez --- CHANGELOG.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cddd15..9c99d86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,26 @@ npm treats versions as semver and semver forbids leading zeros. ### Added +- **Observability: a correlated lifecycle event stream and an injectable logger.** Every request is + given an id — an incoming `x-request-id` is adopted rather than replaced — and every event of that + request carries it, alongside the matched route *pattern* (never the concrete URL, which would give + a metrics backend one label per distinct path). Each step reports its own duration. `createApp({ + logger })` accepts any object with `debug`/`info`/`warn`/`error`; the default writes structured JSON, + or a readable line on a TTY, decided once at boot. Nothing in core writes to `console`, enforced by a + lint rule rather than by intention. `createApp({ logRequests: true })` logs one line per request, off + by default. New exports: `Logger`, `LogLevel`, `LogFields`, `createDefaultLogger`, + `withConsoleFallback`, `logRequests`, `LifecycleEvent`, `EventPayload`, `Correlation`. + + No metrics registry and no OpenTelemetry exporter in core — those live outside it, because core + keeps one runtime dependency. A `traceparent` header is carried through untouched for an exporter to + interpret; core implements no propagation spec. Closes [#10](https://github.com/Expressive-Tea/green-tea/issues/10). + +- **A bounded `close()` on the Deno and Bun adapters**, and `createApp({ shutdownTimeoutMs })` for the + Node one. `app.close()` returns at its no-server guard on Deno and Bun, so the deadline lives on the + server `serveDeno()`/`serveBun()` returns. One difference the deadline cannot hide: Node and Bun + force the remainder shut, while Deno cannot — aborting a server that is already draining throws from + Deno's own listener, so there the deadline bounds how long `close()` waits, not when connections die. + - Shutdown is now an extension point. A `@Provider` may declare `dispose()`, a plugin may call `api.onShutdown(fn)`, and an application may pass `createApp({ hooks: [{ onShutdown }] })` — three doors into one registry, so an app closing a connection no longer writes `process.on('SIGTERM')` @@ -33,6 +53,28 @@ npm treats versions as semver and semver forbids leading zeros. default cap of `1000`; values `<= 0` leave Node unlimited. Deno and Bun have no equivalent runtime setting and require a platform or reverse-proxy connection cap. +### Changed + +- **`.` and `..` in a request path are now resolved rather than 404'd.** `GET /public/../admin` reaches + a route declared as `/admin`, and `%2e` counts as a dot, so the encoded spelling cannot reach a route + the plain one resolves away from. This is a **behaviour change on Node only**, and it exists to end a + divergence: Deno, Bun and Workers resolve dot segments inside the `Request` constructor before the + framework sees anything, so the same bytes on the wire already reached different routes depending on + where you deployed. Rejecting them — the stricter option, and what this module does for `//` — is not + implementable on three of the four runtimes. If a proxy or WAF in front of you matches on the literal + path, note that it sees `/public/...` where the application now routes `/admin`. + +### Fixed + +- **Buffered response bodies are narrowed to what the host runtime's `Response` accepts.** A Node + `Buffer` is a `Uint8Array` at runtime but its declared backing store admits `SharedArrayBuffer`, which + `BodyInit` does not — so Deno's types rejected it. This was a real typing hole on the `app.fetch` + path, which is the path Deno, Bun and the edge all use, rather than a JSR formality. + +- **`close()`'s shutdown timer is armed before `finish()` is referenced.** The previous ordering relied + on `server.close(cb)` deferring, which is Node's behaviour rather than a guarantee to us, and left a + `ReferenceError` waiting in the shutdown path for whoever changed it. + ## [26.8.0-beta.0] - 2026-08-02 ### Added From 41c1f4308b2083c586412b9460ac2d01cdb152c5 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Mon, 17 Aug 2026 13:05:27 -0500 Subject: [PATCH 44/46] chore(release): cut 26.8.0-beta.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit package.json and deno.json both still said 26.8.0-beta.0, which npm already has. Publishing would have been rejected there and — the expensive half — JSR versions are immutable, so a wrong one can never be replaced. The changelog section is closed at today rather than left under Unreleased, because what it now contains is the whole of this release: the observability contract, shutdown teardown, the dot-segment behaviour change, and the two fixes on the fetch and shutdown paths. The documentation repository is tagged 26.8.0-beta.1 alongside, and that number means the same thing there: not a version of the site, but the core release its pages describe. Cutting the two together is what makes the version a claim that the release is documented rather than only shipped. Signed-off-by: Diego Resendez --- CHANGELOG.md | 2 ++ deno.json | 2 +- package.json | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c99d86..b310537 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ npm treats versions as semver and semver forbids leading zeros. ## [Unreleased] +## [26.8.0-beta.1] - 2026-08-17 + ### Added - **Observability: a correlated lifecycle event stream and an injectable logger.** Every request is diff --git a/deno.json b/deno.json index 5af1930..2d71e9f 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,6 @@ { "name": "@green-tea/core", - "version": "26.8.0-beta.0", + "version": "26.8.0-beta.1", "license": "MIT", // JSR serves TypeScript source, not the tsup build, so these point at `src/` where npm's // `exports` point at `dist/`. Same four entry points on purpose: a docs example that imports diff --git a/package.json b/package.json index 40b08a6..e1a816d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@green-tea/core", - "version": "26.8.0-beta.0", + "version": "26.8.0-beta.1", "description": "A zen, opinionated, type-safe framework \u2014 your API is a graph, not a middleware chain.", "license": "MIT", "author": "green-tea contributors ", From 0218508a967f8fb6c021b5f77a515d187a1b88f9 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Mon, 17 Aug 2026 13:21:44 -0500 Subject: [PATCH 45/46] docs(readme): lead with what the framework owns, not with what it is not MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follows the website copy strategy, translated from marketing register into the one this file is read in. The strategy's own summary of the change applies here too: stop selling simplicity because the framework is small, start selling simplicity because the framework carries the infrastructure. The hero led with "not a mutable bag threaded through positional middleware". Middleware ordering was the origin problem, not the whole of what this does, and a reader who has never hit that pain learns only what green-tea is against. It now says what it is for: declare what a step needs and produces, and the framework derives the order, validates the wiring before traffic, and runs only the slice a route requires. Added "Who does the work?", the section the strategy ranks first and the file never had. It is a table of which side of the import each infrastructure decision lives on, ending with business rules on yours — and it is where the single runtime dependency now sits, as evidence rather than as a headline. The number was never the point: fewer moving parts to understand, upgrade, coordinate and debug is. A framework owning less does not delete that work, it moves it into your application. "Batteries included — still one dependency" did both of the things the strategy says to demote in one heading. It is now "What the foundation already carries", which is the same list making the ownership argument instead of a bloat-adjacent one. Accuracy guardrails re-checked after editing rather than assumed: compile-time guarantees stay scoped to the typed flow core with decorator wiring boot-validated, mesh stays alpha, no zero-dependency claim, no benchmark leadership, no anti-Web-Standards framing. Signed-off-by: Diego Resendez --- README.md | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9232a26..2f8d9fb 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,13 @@

A zen, opinionated, type-safe framework.

- Your API is an explicit dependency graph you can see, slice, and trust —
- not a mutable bag threaded through positional middleware. That's the tea. 🍵 + Declare intent. Derive execution.
+ You declare what each step needs and produces; green-tea derives the order,
+ validates the wiring before it serves traffic, and runs only the slice each route requires. +

+ +

+ Less infrastructure in your application. Less infrastructure in your head. 🍵

--- @@ -55,6 +60,32 @@ npm install busboy # multipart/form-data file uploads - **A remote dependency looks like a local one.** `@needs('billing')` resolves the same whether `billing` lives in this process or on another node (mesh, experimental). *Why it matters:* no gRPC layer or message-pattern DSL to learn — there's the graph, and some nodes happen to live elsewhere. - **Plugins can't sabotage you.** A plugin gets `bus.on(...)` (observe), `scope.add(...)` (extend its own scope) and `onShutdown(...)` (release what it opened). There is no API to reorder or delete another scope's steps. *Why it matters:* installing a plugin can't break your body parser. +## Who does the work? + +Every backend has the same set of infrastructure decisions. The question is which side of the +`import` they live on. + +| Decision | Owned by | +|---|---| +| Execution order | green-tea — derived from `needs`/`provides`, never maintained by hand | +| Dependency validation | green-tea — boot fails when nothing provides a key | +| Which steps a route runs | green-tea — the graph slice its handler actually depends on | +| Streaming mechanics — framing, backpressure, cleanup, disconnects | green-tea | +| OpenAPI projection | green-tea — from the same metadata that runs the app | +| Secure transport defaults | green-tea — headers, CORS, TLS | +| Runtime serving boundary | green-tea — `listen`, `fetch`, `upgrade` per runtime | +| Shutdown sequencing | green-tea — drain, then teardown, inside one deadline | +| **Business rules** | **you** | + +That division is the whole design, and it is why `reflect-metadata` is the only runtime dependency: +the goal is not a small number for its own sake, it is **fewer moving parts your team has to +understand, upgrade, coordinate and debug**. A framework that owns less pushes the difference into +your application, where it becomes your maintenance instead of disappearing. + +Automated does not mean invisible. `app.explain()` prints the ordered chain, `app.graph()` renders +the live graph, and `app.openapi()` projects the same metadata — the graph is not documentation drawn +after the fact, it is the structure green-tea validates and executes. + ## Real-time is a primitive, not a second framework Most stacks treat "push data over time" as a bolt-on: Express reaches for a `ws` or SSE library, Fastify for a plugin, NestJS for a separate **WebSocket Gateway** with its own adapter and decorators. That's a second mental model, a second error surface, glued to your HTTP app. @@ -98,9 +129,10 @@ class Live { Same `@Route`, same handler shape, same `AsyncIterable` — real-time is not a separate framework you also have to learn. -## Batteries included — still one dependency +## What the foundation already carries -Beta shipped the parts a real API needs, without growing the runtime dependency tree past `reflect-metadata`: +The parts a real API needs, owned by the framework rather than assembled in your application — and +without growing the runtime dependency tree past `reflect-metadata`: - **TLS → https/wss** natively, plus proxy-aware `trustProxy` (`X-Forwarded-*` → `ctx.protocol`/`ctx.ip`). - **Secure by default.** `nosniff`, `X-Frame-Options`, `Referrer-Policy`, HSTS-when-secure — on every response, opt-out with one flag. From 9b5347aa7523093b974adaee0c2b8a9ab5fb1af6 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Mon, 17 Aug 2026 18:11:50 -0500 Subject: [PATCH 46/46] fix(observability): correlate requests on Node 18, where there is no global crypto MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `engines` promises `>=18`. The global `crypto` arrived unflagged in Node 19. Between those two facts, `correlateRequest` compiled cleanly against an ambient `declare const crypto` and then threw `ReferenceError: crypto is not defined` on the first request of every Node 18 process — which is to say the observability work made the framework unusable on its own stated floor. Nothing local could see it. Every developer machine here runs 20 or 22, and Deno, Bun and workerd all expose the global. CI's Node 18 job caught it on the promotion pull request, which is the entire reason that job is pinned to the floor rather than to the current release. The global stays the primary path, because it is why this file does not simply import node:crypto: it is the runtime-neutral core, and node:crypto is not available to all four runtimes. The fallback is reached only where the global is absent, so workerd never evaluates the require, and the ESM build has a real one from the createRequire banner already in tsup.config.ts. Verified in both built formats rather than assumed — esbuild rewrites it to require("crypto"), which is the same module. test/node-floor.test.ts stubs the global away to reproduce the floor's condition on any Node, and was confirmed to fail against the previous code. The bug was invisible where it was written; this makes it visible there. Signed-off-by: Diego Resendez --- src/http/core.ts | 31 ++++++++++++++++++++++++------- test/node-floor.test.ts | 27 +++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 7 deletions(-) create mode 100644 test/node-floor.test.ts diff --git a/src/http/core.ts b/src/http/core.ts index d48ad02..357511e 100644 --- a/src/http/core.ts +++ b/src/http/core.ts @@ -10,12 +10,29 @@ import type { RouteDef, HttpOptions } from './types'; import type { StreamEncoder } from '../encoders'; import type { Bus } from '../bus'; -// The project tsconfig's `lib` is `es2020` with no `DOM`, so the Web Crypto global is undeclared -// even though all four supported runtimes provide it. Ambient-declare only what is called — the -// same approach `src/deno.ts` takes for the Deno globals. Deliberately *not* `node:crypto`: this -// file is the runtime-neutral core, and the web-standard global is what Deno, Bun and workerd all -// have without a compatibility flag. -declare const crypto: { randomUUID(): string }; +/** + * `randomUUID`, from wherever this runtime keeps it. Resolved once, at import. + * + * The web-standard global stays the primary path, and that is deliberate rather than stylistic: + * this file is the runtime-neutral core, and Deno, Bun and workerd all expose `crypto` without a + * compatibility flag, while `node:crypto` is unavailable to at least one of them. + * + * Node is the exception. The global arrived **unflagged in 19**, and `engines` promises `>=18`, + * where it does not exist at all — so the previous `declare const crypto` compiled cleanly and then + * threw `ReferenceError: crypto is not defined` on the first request of every Node 18 process. Only + * CI's Node 18 job caught it; every newer Node and every other runtime hides it, which is exactly + * why that job is pinned to the floor rather than to the current release. + * + * The fallback is reached only by a runtime that lacks the global, so workerd never evaluates the + * `require` — and the ESM build has a real one, from the `createRequire` banner in `tsup.config.ts`. + */ +const randomUUID: () => string = (() => { + const webCrypto = (globalThis as { crypto?: { randomUUID?: () => string } }).crypto; + if (typeof webCrypto?.randomUUID === 'function') return () => webCrypto.randomUUID!(); + + // eslint-disable-next-line @typescript-eslint/no-require-imports + return (require('node:crypto') as { randomUUID: () => string }).randomUUID; +})(); /** * A runtime-neutral inbound request. @@ -78,7 +95,7 @@ export function correlateRequest(headers: Record=18`, and the global `crypto` only arrived unflagged in Node 19. That gap +// shipped once: `correlateRequest` compiled cleanly against an ambient declaration and then threw +// `ReferenceError: crypto is not defined` on the first request of every Node 18 process. +// +// CI's Node 18 job is what caught it, and this test is what makes it catchable without one — every +// developer machine and every other runtime has the global, so the bug is invisible where it is +// written. Stubbing the global away reproduces the floor's condition on any Node. +// +// If the floor ever moves above 18, this test and the fallback it guards can both go. +describe('correlateRequest without a global crypto (Node 18)', () => { + it('falls back to node:crypto instead of throwing ReferenceError', async () => { + vi.stubGlobal('crypto', undefined); + vi.resetModules(); + + const { correlateRequest } = await import('../src/http/core'); + const a = correlateRequest({}); + const b = correlateRequest({}); + + expect(a.requestId).toMatch(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/); + expect(a.requestId).not.toBe(b.requestId); + expect(correlateRequest({ 'x-request-id': 'from-gateway' }).requestId).toBe('from-gateway'); + + vi.unstubAllGlobals(); + }); +});