Commit Graph
1746 Commits
Author SHA1 Message Date
Bartek IwańczukandClaude Opus 4.6 af3f30dbaa fix: warn instead of crash on invalid HTML nesting around islands (#3762)
## Summary
- When a block-level element (e.g. `<div>`) is placed inside an inline
element (e.g. `<p>`) that wraps an island, the browser fixes the invalid
nesting by splitting the parent, moving Fresh's comment markers into
different DOM nodes
- Previously this caused a fatal `DOMException` during hydration,
crashing all client-side JS on the page
- Now Fresh detects that `start.parentNode !== end.parentNode` before
calling `createRootFragment`, logs a descriptive error message
explaining the invalid nesting, and skips the broken island instead of
crashing

Example of the error message:
```
Fresh hydration error: the island "BugIsland" has invalid HTML nesting.
Its start and end markers were reparented by the browser into different
DOM nodes. This is usually caused by placing a block-level element
(like <div>) inside an inline element (like <p> or <span>). Check the
HTML around this island for invalid nesting.
```

Closes #2121

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 12:20:31 +02:00
Bartek IwańczukandClaude Opus 4.6 07878fcce9 feat: add trustProxy option to respect X-Forwarded-* headers (#3757)
## Summary
- Adds `trustProxy` option to `FreshConfig` (default: `false`)
- When enabled, the handler reads `X-Forwarded-Proto` and
`X-Forwarded-Host` headers and rewrites `ctx.url` so it reflects the
actual client-facing URL
- Useful for apps running behind nginx, Caddy, or other reverse proxies
where `ctx.url` would otherwise return `http://` instead of `https://`

Closes #2660

## Usage
```ts
const app = new App({ trustProxy: true });
```

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 07:53:24 +00:00
Bartek IwańczukandClaude Opus 4.6 990aeb03f3 feat: support multiple staticDir entries (#3759)
## Summary
- `staticDir` now accepts `string | string[]` in both the **Vite
plugin** (`FreshViteConfig`) and the **Builder API** (`BuildOptions`)
- When multiple directories are specified, they are searched in order
and the first match wins
- **Vite plugin**: first dir maps to Vite's native `publicDir`; extra
dirs are served manually in the dev server and walked during production
builds
- **Builder API**: both `MemoryBuildCache` (dev) and `DiskBuildCache`
(prod) iterate over all directories
- Updated tailwind v3 plugin to use `config.root` instead of
`path.dirname(config.staticDir)`
- Docs updated: `static-files.md`, `vite.md`, `builder.md`

Closes #3105

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 07:49:32 +00:00
Bartek IwańczukandClaude Opus 4.6 c0a866d027 fix: improve update tool output for Fresh 2 projects (#3754)
## Summary
- Detects whether a project is already on Fresh 2 by checking
`deno.json` imports
- Shows "Updating Fresh to X.Y.Z..." instead of "Starting Fresh 1 to
Fresh 2 migration..." for existing Fresh 2 projects
- Only shows "Breaking changes may require additional manual updates"
warning for actual Fresh 1→2 migrations
- Summary/completion messages adapt accordingly ("Update" vs
"Migration")

Closes #3688

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 09:48:38 +02:00
Bartek IwańczukandClaude Opus 4.6 fc0ff66b80 fix: active links consider query params and respect existing aria-current (#3755)
## Summary
- `matchesUrl()` now considers query parameters — links with query
params that don't match the current URL get `Ancestor` instead of
`Current` status
- Links with a user-set `aria-current` attribute are left untouched
(both server and client side), fixing daisyUI tab components and similar
use cases
- Client-side `updateLinks()` passes search params and respects user-set
attributes

Closes #3474

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 09:42:02 +02:00
Bartek IwańczukandClaude Opus 4.6 895bcacdae fix: architecture diagram unreadable in dark mode (#3752)
## Summary
- The inline HTML/CSS flow diagram in `docs/concepts/architecture` was
broken — marked's smartypants text transforms corrupted the `<style>`
block, stripping all styling
- Replaced with a standalone SVG
(`www/static/docs/architecture-flow-v2.svg`) using theme-neutral
mid-gray colors that are readable on both light and dark backgrounds

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 11:08:11 +02:00
Bartek IwańczukandClaude Opus 4.6 d6b0a169a3 fix: improve CJS-to-ESM transform for better npm compatibility (#3697)
## Summary

Fixes several issues in the Fresh Vite plugin's CommonJS-to-ESM Babel
transform (`commonjs.ts`) that caused npm packages to break during
builds while working fine in dev mode.

- **Fix `.mts`/`.cts` extension detection** — `.cts` was incorrectly in
the ESM branch (should be `.mts`), causing TypeScript CJS files to skip
the transform
- **Handle `require.resolve()`** — injects
`createRequire(import.meta.url)` polyfill so `require.resolve()` calls
work in ESM output (#3619)
- **Polyfill `__dirname`/`__filename`** — injects
`fileURLToPath`/`dirname` based polyfill when these CJS globals are used
- **Use `var` instead of `let` for `_default`** — avoids TDZ errors when
Rollup reorders declarations in bundled output (#3653)
- **Track `module.exports.X` as named exports** — the MemberExpression
visitor now handles both `exports.X` and `module.exports.X` patterns

Addresses: #3619, #3653

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 16:29:48 +02:00
Bartek IwańczukandClaude Opus 4.6 9875146cc4 fix: improve Deno module resolution in Vite plugin (#3734)
## Summary

Three targeted fixes to Fresh's Vite plugin for better module
resolution, plus new test coverage.

### 1. Workspace import map resolution
Pass the importer's file URL to `loader.resolve()` so bare specifiers
from workspace member packages resolve through the correct import map —
not just the root `deno.json`.

Fixes #3654

### 2. Remote island resolution
Use `this.resolve(spec)` in the `fresh-island::` and
`fresh-client-island::` resolveId handlers (`server_snapshot.ts` /
`client_snapshot.ts`) so JSR remote islands get proper `\0deno::`
specifiers. Without this, remote islands resolved to bare specifiers
that Vite couldn't load.

Fixes #3437

### 3. Babel JSX operator precedence fix
`!ssr && id.endsWith(".tsx") || id.endsWith(".jsx")` → `!ssr &&
(id.endsWith(".tsx") || id.endsWith(".jsx"))`. The missing parentheses
caused `.jsx` files to incorrectly get Preact JSX transforms during SSR.

### Other changes
- Bump `@deno/loader` from ^0.3.10 to ^0.4.0 (needed for workspace
resolution fix)
- Bump `@astral/astral` from ^0.5.5 to ^0.5.6 (fixes `@std/async@1.2.0`
compat)
- Add dev server tests for CJS module import and maxmind CJS (#3653)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 15:40:46 +02:00
Bartek IwańczukandClaude Opus 4.6 3a51f82da6 fix: use deno run for init instead of deno create before 2.3.0 (#3746)
## Summary
- Reverts all references from `deno create @fresh/init` back to `deno
run -Ar jsr:@fresh/init` across docs, READMEs, homepage, and CLI help
text
- Removes the deprecation warning in `packages/init/src/mod.ts` that
told users to switch to `deno create`

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 09:19:14 +02:00
Bartek IwańczukandClaude Opus 4.6 a872a70e5f refactor: add integrationTest() helper to reduce test boilerplate (#3711)
## Summary
- Adds an `integrationTest()` wrapper in
`packages/fresh/src/test_utils.ts` that calls `Deno.test` with
`sanitizeOps: false` and `sanitizeResources: false`
- Converts ~88 integration tests across 5 files to use the new helper,
removing repetitive sanitizer boilerplate
- Net reduction of ~344 lines (-1678/+1334)

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 19:14:10 +02:00
Bartek Iwańczuk 196509274f chore: update deno.lock (#3741) 2026-03-30 17:31:23 +02:00
Bartek IwańczukandClaude Opus 4.6 d6fc1d08a8 fix: normalize Windows paths in generated snapshot and server entry (#3727)
## Summary
- When building on Windows, `path.relative()` produces backslash
separators (`\`) that get hardcoded into the generated `snapshot.js` and
`server.js` files
- If the bundle is then deployed to a Linux server (e.g. Windows CI →
Linux prod), those paths break at runtime
- Fix: add a `toPosix()` helper that normalizes all paths written into
generated files to use forward slashes, applied in three places:
  - `root` path passed to `generateServerEntry()`
  - `filePath` in `prepareStaticFile()` (from `path.relative()`)
- All path options inside `generateServerEntry()` (root, serverEntry,
snapshotSpecifier)

Closes #3513

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 15:12:47 +02:00
6dd2c97fb2 feat:Actually ship no JS by default (#3696)
In many places, Fresh marketing claims the framework ships no JS by
default, **this was false**.

This PR reworks core parts of the framework to check whether JS is
needed on the client with these criteria:
1. Use of islands
2. Use of Partials (`f-client-nav`)

If either of those those criteria are met, JavaScript will be loaded as
normal, but if both are false, then the `client-entry` script is omitted
from the page.

Fixes https://github.com/denoland/fresh/issues/3662

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 20:15:35 +00:00
8b0d42b82a fix: register files generated by Vite plugins in static file cache (#3534)
Fixes #3487 

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 20:04:46 +00:00
Bartek IwańczukandClaude Opus 4.6 400e217c5e feat: add View Transitions API support for client-side navigation (#3708)
## Summary

- Integrates the [View Transitions
API](https://developer.mozilla.org/en-US/docs/Web/API/View_Transition_API)
into Fresh's existing partials system
- Opt-in via `f-view-transition` attribute, progressive enhancement
(falls back gracefully)
- Wraps all navigation types (link clicks, popstate, form submissions)
in `document.startViewTransition()`

## Usage

```html
<body f-client-nav f-view-transition>
  <!-- your app -->
</body>
```

Customize animations with standard CSS:
```css
::view-transition-old(root) {
  animation: fade-out 0.2s ease-in;
}
::view-transition-new(root) {
  animation: fade-in 0.2s ease-out;
}
```

Per-element transitions work via `view-transition-name`:
```css
.sidebar { view-transition-name: sidebar; }
```

## Design decisions

- **Opt-in** — only activates when `f-view-transition` attribute is
present, can be disabled with `f-view-transition="false"`
- **Progressive** — falls back to regular partial updates when the
browser doesn't support the View Transitions API
- **Minimal** — 35 lines of implementation, integrates into existing
partials infrastructure rather than building a parallel navigation
system

Closes https://github.com/denoland/fresh/issues/3458

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 19:56:37 +00:00
Bartek IwańczukandClaude Opus 4.6 cf73d29c3a fix: CSP user directives now override defaults instead of duplicating (#3724)
Fixes #3552

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 19:53:14 +00:00
4edfe2f5a4 perf: pre-compile middleware chains at build time (#3104)
Pre-compiles middleware chains once at startup instead of constructing
them per-request.

## Changes

- Replace `runMiddlewares(middlewares, ctx, onError)` (per-request) with
`compileMiddlewares(middlewares, onError)` (once at startup) which
returns a single `Middleware<State>` function
- Router now stores a single compiled handler per method/route (`T |
null`) instead of arrays (`T[]`)
- The compiled chain passes `tail` (the original `ctx.next`) as a
parameter to each step, avoiding the infinite recursion bug where a
compiled tail reads an already-overwritten `ctx.next` — safe under
concurrent requests
- Lazy middleware resolution is preserved: a lazy middleware is resolved
on first request and the resolved function replaces the lazy wrapper in
the closure

## Benchmarks

Synthetic benchmarks (10 middlewares, `deno bench`) show the per-request
savings are small in isolation — middleware execution and async/await
overhead dominate. The main value is architectural: building the chain
once is correct and eliminates per-request allocations, which may
compound under high concurrency.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 21:50:22 +02:00
Bartek IwańczukandClaude Opus 4.6 dc2324807c feat: add nonce support for inline style and script tags in CSP (#3709)
## Summary
- Auto-inject `nonce` attribute onto inline `<script>` and `<style>`
tags during server rendering
- Add `useNonce` option to the CSP middleware that replaces
`'unsafe-inline'` with per-request `'nonce-{value}'` directives
- Expose render nonce via `X-Fresh-Nonce` response header (internal,
stripped by CSP middleware)

## Usage

```ts
app.use(csp({ useNonce: true }));
```

This locks down the CSP policy so only Fresh-rendered inline
scripts/styles are allowed. Each request gets a unique nonce.

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 21:45:13 +02:00
566a6ce5e4 feat: add IP filter middleware (#3035)
Closes #3011

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 21:43:52 +02:00
Bartek IwańczukandClaude Opus 4.6 e0ee53d458 fix: dev server intercepts Vite URLs when basePath is configured (#3730)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 19:42:36 +00:00
Bartek IwańczukandClaude Opus 4.6 14cff12fcc fix: fall back to full navigation when partial redirect has no partials (#3716)
Fixes #2560

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 19:42:08 +00:00
Bartek IwańczukandClaude Opus 4.6 29cfed5b14 fix: let node_modules asset requests pass through in dev mode (#3728)
Closes #3424

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 21:40:03 +02:00
Bartek IwańczukandClaude Opus 4.6 4f82c91ae4 fix: append data script tags to head during partial navigation (#3720)
Fixes #2805

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 19:29:39 +00:00
Hong Minhee (洪 民憙) 4a59ec260d fix: Remove readonly from FreshRequest.req (#2751) 2026-03-29 21:27:53 +02:00
669f62a32a fix: prevent 404 for routes consisting solely of an optional parameter (#2798)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 21:27:18 +02:00
Bartek Iwańczuk be813e0dfd ci: add perf prefix to PR title checker (#3739) 2026-03-29 21:25:40 +02:00
a79b155e79 fix: make <Head> work in client (#3252)
Closes #3310

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 21:21:39 +02:00
Sato Takayuki 19d3589b9b fix: apply basePath correctly in dev mode for root index (#3219)
## Summary
- Fixed an issue where basePath was not correctly applied in dev mode
for the root index route
- The dev server now uses root path "/" while preserving the configured
basePath for the main app
2026-03-29 21:17:17 +02:00
Bartek IwańczukandClaude Opus 4.6 ee9d1d04e7 fix: apply layout to index route with programmatic routing (#3725)
Closes #3553

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 21:14:34 +02:00
Bartek IwańczukandClaude Opus 4.6 9e7adc084b fix: middleware not matching routes with optional parameters in fs routing (#3726)
Closes #3545

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 21:11:55 +02:00
ad8ec0fa42 docs: fix markdown docs (#3459)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 19:10:48 +00:00
Bartek IwańczukandClaude Opus 4.6 dd1ecf3b16 fix: don't intercept forms without explicit f-partial inside f-client-nav (#3722)
Fixes #3473

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 19:07:54 +00:00
Bartek IwańczukandClaude Opus 4.6 caeebd88a5 fix: trailing slash mismatch causes 404 for static routes (#3721)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 21:06:18 +02:00
Bartek IwańczukandClaude Opus 4.6 e6b25a084c fix: add @types/babel__core to vite project template (#3723)
Closes #3605

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 19:04:07 +00:00
Bartek IwańczukandClaude Opus 4.6 075dfb73b2 feat: inject traceparent meta tag when OpenTelemetry is active (#3729)
Closes #2830

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 18:51:12 +00:00
Bartek IwańczukandClaude Opus 4.6 92e07f03b3 fix: resolve server entry filename from bundle chunks (#3719)
Closes #3655

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 20:45:32 +02:00
420a8cfb8e docs: fix misleading main.tsx filenames (#3477)
Closes #3476

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 18:38:14 +00:00
Bartek IwańczukandClaude Opus 4.6 be467d3cdb fix: warn when Partial with append/prepend mode is missing key prop (#3738)
## Summary
- Adds a `console.warn` during SSR when a `<Partial>` uses
`mode="append"` or `mode="prepend"` without a `key` prop
- Without a key, Preact cannot correctly reconcile prepended/appended
children, leading to subtle rendering bugs
- No warning for `mode="replace"` (default) since keys aren't required
there

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 20:33:14 +02:00
Bartek IwańczukandClaude Opus 4.6 103427f9da docs: comprehensive documentation audit, fixes, and website improvements (#3712)
## Summary

Full documentation audit and fixes for Fresh 2.x docs. Addresses every
issue identified in the [audit
report](https://gist.github.com/bartlomieju/91ddb08c23552f642d2073c0e9a36102).

### Critical fixes
- Remove 4 TODO placeholders (app.md, plugins/index.md)
- Fix 4 broken code examples (layouts syntax error, routing missing ctx,
csrf wrong import, getting-started unused prop)
- Fix 3 copy-pasted frontmatter descriptions (context, env-vars, app)
- Fix CSRF page describing CORS instead of CSRF

### New pages (8)
- **Architecture** — request lifecycle diagram, server-first rendering,
islands architecture
- **Data Fetching** — handlers, page(), type-safe data passing, async
components, PageProps reference
- **Signals** — useSignal, computed, props, shared state, serialization
- **Serialization** — supported types, what can't be serialized,
circular refs, pitfalls
- **API Routes** — handler-only routes, method-specific, catch-all,
programmatic
- **Common Patterns** — protected routes, redirects, cookies,
WebSockets, streaming, content negotiation, subdomain routing, proxying,
lazy-loading islands
- **API Reference** — all exports from fresh, fresh/runtime, fresh/dev
- **OpenTelemetry** — what's instrumented, enabling tracing, Deno Deploy

### Expanded pages (6)
- **Routing** — matching priority, HTTP methods, HEAD fallback,
file-based handlers
- **Vite plugin** — HMR, plugin composition, internals, debugging
- **Deno Deploy** — build config, env vars, custom domains,
troubleshooting
- **deno compile** — cross-compilation, limitations
- **Error handling** — expanded HttpError with message param, import
paths
- **Plugins index** — plugin authoring guidance, built-in plugin list

### Structural improvements
- Update all 3 index pages (concepts, advanced, examples) with links to
every sub-page
- Cross-link the two Layouts pages (file-based vs programmatic)
- Resolve contradictory build commands (remove legacy dev.ts references)
- Add "next steps" to Getting Started
- Explain `(_islands)` and `(_components)` directories in file routing
- Document `basePath`, `assetSrcSet()`, `IS_BROWSER`, route `css` option
- Add PR guidelines to Contributing page
- Add Deno version requirements to Introduction

### Docs fixes from issue triage
- **Docker deployment** — add missing `deno install --allow-scripts`
step, remove stale `deno cache`, fix CMD (#3500)
- **Deployment index** — add install step before build (#3500)
- **Static files** — add tip about root-relative URLs (#3482), add image
optimization section with vite-imagetools, CDN services, best practices
(#671)
- **main.ts vs main.tsx** — fix examples showing JSX in main.ts, add tip
about serverEntry config (#3476)
- **Head component** — clarify dedup precedence: last-rendered wins
(#2749)
- **Islands** — add custom elements / web components section (#2741)
- **Sharing state** — rewrite cart example to avoid shared module-level
signals (#2437, #1877)
- **Common patterns** — add subdomain routing (#603), proxying requests
(#361), lazy-loading islands (#565)

### Website fixes
- **Canary redirects** — catch-all `/docs/canary/...` → `/docs/...`
redirect (#3375)
- **Recipe partials** — redirect direct access to recipe routes to
homepage (#2559)
- **Homepage** — add progressive complexity code examples to Simple
section (#2755)

### Image reference fixes
- Rename `getting-started-3-cotuntdown.png` →
`getting-started-3-countdown.png`
- Fix 1.x partials image path

### Grammar/typos
- 11 corrections across 12 files

### CI
- Add `docs/check_images_test.ts` — verifies all markdown image
references resolve to existing files in `www/static/`

Closes #3514
Closes #3476
Closes #3591
Closes #2876
Closes #2075
Closes #1612
Closes #1535
Closes #527
Closes #3059
Closes #3695
Closes #3548
Closes #3500
Closes #3482
Closes #3375
Closes #2749
Closes #2741
Closes #2559
Closes #2437
Closes #671
Closes #361

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 18:22:33 +00:00
Bartek IwańczukandClaude Opus 4.6 059183b230 fix: improve error message for missing exports in file routes (#3718)
Closes #3652

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 20:18:07 +02:00
Bartek IwańczukandClaude Opus 4.6 4e0331b5c9 fix: preserve partial search param through redirects (#3715)
## Summary
- Fixes #2610 — "Partial + redirect breaks islands"
- When a partial request (`?fresh-partial=true`) hits a server-side
redirect via `ctx.redirect()`, the `fresh-partial` search param is now
preserved in the redirect `Location` header
- Previously the param was lost, so the redirect target rendered as a
full page instead of a partial response, breaking island hydration

The fix is in `ctx.redirect()` in `packages/fresh/src/context.ts` — when
`this.isPartial` is true, the partial param is appended to the redirect
location (handling existing query params and hash fragments correctly).

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 13:23:54 +02:00
0015710909 feat: allow passing Temporal objects to islands (#3701)
## Summary

- Add serialization/deserialization for all 8 Temporal types in the
jsonify module (used for island props): Instant, ZonedDateTime,
PlainDate, PlainTime, PlainDateTime, PlainYearMonth, PlainMonthDay,
Duration
- Stringify side guards with `typeof Temporal !== "undefined"` to avoid
ReferenceError when Temporal is unavailable
- Uses `.toString()` for serialization and `Type.from()` for
deserialization

Co-authored-by: Nano Miratus <nanomiratus@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 10:23:38 +02:00
Bartek IwańczukandClaude Opus 4.6 b790c804ee feat: support deno create for project initialization (#3706)
## Summary
- Add a `./create` export to `@fresh/init` so users can scaffold
projects with `deno create @fresh/init` (Deno 2.7+)
- The old `deno run -Ar jsr:@fresh/init` continues to work but now shows
a deprecation warning

**New way (Deno 2.7+):**
```sh
deno create @fresh/init
```

**Old way (still works, with warning):**
```sh
deno run -Ar jsr:@fresh/init
```

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 15:38:31 +00:00
Bartek Iwańczuk 214975d90d chore: inline ga4 module and remove raw GitHub import (#3733)
## Summary
- Inlined the `$ga4` module (from
`https://raw.githubusercontent.com/denoland/ga4/main/mod.ts`) into
`www/utils/ga4.ts`
- Replaced old `deno.land/std` URL imports with `@std/http`
(`getCookies`, `STATUS_TEXT`)
- Inlined the trivial `snakeCase` helper (was from `deno.land/x/case`)
- Removed `$ga4` import map entry from `deno.json`

The ga4 package was never published to jsr or npm, so inlining was the
cleanest way to eliminate the last raw URL-based dependency.
2026-03-28 12:05:13 +00:00
Bartek IwańczukandClaude Opus 4.6 220368aa15 chore: migrate docsearch and imagescript to npm/jsr imports (#3732)
## Summary
- **docsearch**: Replaced `esm.sh` URL with `npm:@docsearch/js@^3.5.2`.
Added a type cast workaround in `SearchButton.tsx` since Deno's type
checker treats this npm package as CJS (missing `"type": "module"`).
- **imagescript**: Replaced `deno.land/x` URL with
`jsr:@matmen/imagescript@^1.3.0`. Clean swap, no code changes needed.

These were legacy URL-based imports from before Deno had native `npm:`
and `jsr:` support.

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 11:44:37 +00:00
Bartek Iwańczuk 25e6357e1a chore: release 2.2.2 (#3717) 2026-03-28 10:01:28 +01:00
Bartek Iwańczuk 3b61ede394 ci: update PR title checker (#3713) 2026-03-28 08:55:24 +01:00
Bartek IwańczukandClaude Opus 4.6 2c94a1da2e ci: add link checker to CI (#3707)
## Summary
- Rewrite `tools/check_links.ts` to be more robust (inspired by
denoland/docs' `better_link_checker.ts`)
- Add `deno task check:links` to `deno.json`
- Wire it into CI as a new step (Ubuntu + v2.x only, after `build-www`)
- Add missing `docs/latest/examples/index.md` to fix broken
`/docs/examples` link
- Crawl up to 10 pages concurrently for faster link checking

## What the link checker does
1. Builds the www site with Vite
2. Launches a production server
3. Crawls all internal links starting from the root (10 pages
concurrently)
4. Reports broken links (4xx/5xx) with referrer info
5. Detects empty `href` attributes
6. Prints a summary at the end instead of throwing on first failure

Improvements over the old `check_links.ts`:
- Doesn't throw on first 404 — collects all failures and reports at the
end
- Detects empty hrefs
- Skips non-HTML content, fragment-only links, external links, and
common static file extensions
- Shows referrer for each broken link so you know where to fix it

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 13:49:17 +00:00
Bartek IwańczukandClaude Opus 4.6 7aea4942d7 chore: add pr title validation to ci (#3702)
## Summary
- Adds a `pr-title` CI job that validates PR titles start with `feat:`,
`fix:`, `test:`, `chore:`, or `showcase:` and are all lowercase
- Updates `.github/CONTRIBUTING.md` with the title format rules and a
link to the full contributing docs

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 09:11:51 +01:00
Bartek IwańczukandClaude Opus 4.6 bc13417448 ci: use canary Deno version for JSR publishing (#3710)
Mostly to quickly get updates and fixes like
https://github.com/denoland/deno/pull/32127

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 22:24:50 +01:00