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
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
Marvin Hagemeister and Bartek Iwańczuk
882b7829fd
feat: expose HttpError for clients ( #3080 )
...
This PR exposes the `HttpError` class for clients.
To do that I needed to make the error message optional to avoid bloating
up the bundle with lots of status strings.
Fixes https://github.com/denoland/fresh/issues/2995
---------
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com >
2026-03-26 09:10:21 +01:00
0fff2b04da
chore: minor code cleanups ( #3103 )
...
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com >
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-03-26 09:01:34 +01:00
Marvin Hagemeister
4cc76aefed
chore: release 2.2.1 ( #3678 )
2026-02-11 14:38:24 +01:00
Marvin Hagemeister
3d8091602c
fix: .well-known static folder not working ( #3676 )
...
This folder is typically used for site metadata like `security.txt` and
other stuff.
2026-02-11 14:19:33 +01:00
Marvin Hagemeister
9f68496aa9
chore: update lockfile ( #3677 )
2026-02-11 14:13:35 +01:00
Marvin Hagemeister
89ddbc4f4b
chore: update preact version ( #3664 )
2026-01-07 14:17:59 +01:00
Marvin Hagemeister
2c36becff0
chore: release 2.2.0 ( #3627 )
...
- `@fresh/core@2.2.0`
- `@fresh/update@2.2.0`
- `@fresh/init@2.3.0`
- `@fresh/plugin-vite@1.0.8`
2025-11-18 14:09:19 +01:00
Marvin Hagemeister
5c2b04bc2b
chore: try vendor + parallel ( #3628 )
2025-11-18 13:58:36 +01:00
Marvin Hagemeister
45538532e8
chore: revert vendor: true ( #3626 )
...
This change was accidentally included in:
https://github.com/denoland/fresh/pull/3624
2025-11-18 12:49:53 +01:00
Marvin Hagemeister
f5c0f16878
fix(vite): source mapping locations ( #3624 )
...
Mappings were wrong for a few reasons:
- Missing source map generation in one babel transform
- setting `compact: false` causes vite to generate incorrect mappings in
`vite:import-analysis`
- stack traces need to be mapped by vite
Fixes https://github.com/denoland/fresh/issues/3609
2025-11-18 11:40:52 +01:00
Marvin Hagemeister
8de5b15799
feat: add .json()/.text()/.html()/.stream() context helpers ( #3613 )
...
Played around with Hono in the past days and the
`.text()/.json()/.html()` helpers are kinda neat, even if you can always
construct that yourself manually. Also added a `.stream()` helper to
create streams without having to deal with `ReadableStream` and
encodings yourself.
2025-11-11 17:25:02 +01:00
Marvin Hagemeister
42d7d9f23b
chore: release 2.1.4 ( #3586 )
...
- @fresh/core@2.1.4
- @fresh/update@2.1.4
- @fresh/init@2.2.2
- @fresh/plugin-vite@1.0.7
2025-10-30 15:57:14 +01:00
Marvin Hagemeister
68e70858aa
chore: improve init tests ( #3590 )
2025-10-30 15:49:02 +01:00
Marvin Hagemeister
5a220c6eea
chore: tests add more logs for easier debugging ( #3589 )
2025-10-30 15:14:15 +01:00
Marvin Hagemeister
7fcae1d895
fix: HEAD when only GET is registered in .route() ( #3587 )
2025-10-30 14:59:12 +01:00
Marvin Hagemeister
5e94dfe9fd
fix: switch to nodeModulesDir: "manual" ( #3588 )
...
The `"auto"` value causes all kinds of race conditions between various
processes trying to auto install their view of dependencies.
2025-10-30 14:50:49 +01:00
Marvin Hagemeister
7db37d7ba1
fix(partial): buttons outside forms should not trigger navigation ( #3584 )
...
`<button>` elements that are not inside a form and have a `f-partial`
attribute should not trigger a history change.
2025-10-29 17:49:19 +01:00
Marvin Hagemeister
76dfc65e63
chore: update @astral/astral ( #3583 )
2025-10-29 17:41:46 +01:00
Marvin Hagemeister
7b6d6315d1
fix(vite): mark transformed cjs with __esModule ( #3575 )
...
Fixes https://github.com/denoland/fresh/issues/3565
2025-10-24 19:54:37 +02:00
Marvin Hagemeister
5a228625ea
chore: release 2.1.3 ( #3572 )
...
- @fresh/core@2.1.3
- @fresh/update@2.1.2
- @fresh/plugin-vite@1.0.6
- @fresh/init@2.2.1
2025-10-23 13:15:07 +02:00
Marvin Hagemeister
3681fb1c84
fix: .fsRoutes() pattern argument not working ( #3571 )
...
Fixes https://github.com/denoland/fresh/issues/3566
2025-10-23 13:05:11 +02:00
Marvin Hagemeister
41b9422dd1
fix: HEAD method not handled properly ( #3563 )
...
- It should never contain a response body
- It should be equivalent to `GET`
2025-10-21 15:43:17 +02:00
Marvin Hagemeister
8b7caba444
chore: release 2.1.2 ( #3542 )
...
- @fresh/core@2.1.2
- @fresh/update@2.1.2
- @fresh/plugin-vite@1.0.5
2025-10-08 12:56:08 +02:00
Marvin Hagemeister
efef51714b
fix(vite): unable to load transpiled commonjs with node builtins ( #3541 )
2025-10-08 12:47:04 +02:00
Marvin Hagemeister
4b069ee0d0
fix(vite): empty commonjs files with only __esModule ( #3540 )
...
When modules only contain the `__esModule` flag, we still need to add
the `exports` and `module.exports` initializers.
2025-10-08 11:50:34 +02:00
Marvin Hagemeister
6c03a9bc26
fix(vite): support jsx namespaces ( #3539 )
...
Babel throws when encountering jsx namespaces by default. It needs a
setting to not throw.
2025-10-08 11:30:07 +02:00
Marvin Hagemeister
026889dbc2
chore: release @fresh/init@2.1.1 ( #3531 )
2025-10-06 17:58:32 +02:00
Marvin Hagemeister
41fba500de
fix(init): revert init template to make init work again ( #3530 )
...
https://github.com/denoland/fresh/pull/3524 unfortunately introduced a
regression in the init script which breaks it. This was caused by two
independent problems:
1. Only files reachable in the module graph are published, meaning the
templates itself weren't published to JSR
2. When publishing to JSR all specifiers become `https://` internally
which breaks doing path operations like `path.resolve()`,
`path.relative()` and all others. This is something that cannot be
tested locally in advance
Addressing these is going to require a bit of work. The quickest way to
get init working again is to revert it.
2025-10-06 17:48:25 +02:00
Marvin Hagemeister
909c2b3280
chore: remove old tests ( #3528 )
...
Not needed anymore
2025-10-06 09:31:36 +02:00
Marvin Hagemeister
cc9946d105
chore: remove old tests ( #3527 )
2025-10-06 09:29:28 +02:00
Marvin Hagemeister
c93e19dfbd
docs: add Deno upgrade section ( #3526 )
2025-10-06 08:08:30 +02:00
Marvin Hagemeister
63dd77a319
fix(vite): dev server not recovering on syntax error ( #3507 )
...
Fixes https://github.com/denoland/fresh/issues/3506
2025-09-29 19:03:02 +02:00
Marvin Hagemeister
5c05d6533f
chore: release 2.1.1 ( #3466 )
...
- @fresh/core@2.1.1
- @fresh/update@2.1.1
- @fresh/plugin-vite@1.0.4
2025-09-19 20:27:35 +02:00
Marvin Hagemeister
9b83a1e1b3
fix(vite): cover more commonjs cases ( #3465 )
...
Fixes https://github.com/denoland/fresh/issues/3463
Fixes https://github.com/denoland/fresh/issues/3449
2025-09-19 18:36:51 +02:00
Marvin Hagemeister
a6016fc045
showcase: remove paquet ( #3462 )
...
Fixes https://github.com/denoland/fresh/issues/3460
2025-09-19 10:15:10 +02:00
Marvin Hagemeister
69ad9bc3c1
fix(vite): improve cjs esm detection + builtins resolution ( #3457 )
2025-09-16 19:41:22 +02:00
Marvin Hagemeister
9a2098ecba
fix(vite): ensure plugins are only instantiated once ( #3450 )
...
This makes debugging a lot easier as by default vite instantiates
plugins multiple times for each environment.
2025-09-16 11:35:00 +02:00
Marvin Hagemeister
b9d550fef8
docs: fix slugs shared across all pages ( #3448 )
...
The slugger was shared across all pages and it assumes each passed value
should be unqiue. Due to that it would append additional numbers to the
id value.
2025-09-16 09:50:23 +02:00
Marvin Hagemeister
cc95155047
fix: returned handler headers only working with plain objects ( #3447 )
...
We only dealt with returned headers as objects instead of all potential
shapes of `Headersinit`.
Fixes https://github.com/denoland/fresh/issues/3445
2025-09-16 09:45:11 +02:00
Marvin Hagemeister
de9b8a7c40
chore: release 2.1.0 ( #3443 )
...
- @fresh/core@2.1.0
- @fresh/plugin-vite@1.0.3
- @fresh/update@2.1.0
- @fresh/init@2.0.9
2025-09-15 19:29:04 +02:00
Marvin Hagemeister
78b886d397
chore: fix non-prerelease version in release script ( #3442 )
2025-09-15 19:19:44 +02:00
Marvin Hagemeister
3867e60664
fix: improve missing build cache error message ( #3441 )
...
Hoping that this helps folks who ignore the migration guide and keep the
entry pointed to `main.ts`.
2025-09-15 19:19:10 +02:00
Marvin Hagemeister
399cbc3aa2
fix(vite): nested islands not working ( #3440 )
...
This PR makes nested islands work. Problem was that only entry files
have the `src` property in the vite manifest. For that we need to ensure
that every island is an entry point.
Fixes https://github.com/denoland/fresh/issues/3439
2025-09-15 17:55:44 +02:00
Marvin Hagemeister
3fb3cd9443
fix(vite): route css import ( #3438 )
...
Fixes https://github.com/denoland/fresh/issues/3426
2025-09-15 13:20:07 +02:00
Marvin Hagemeister
f9ba5417c4
fix: bring back support for middleware Array ( #3434 )
...
Our validation didn't account for `_middleware` files exporting an Array
of middlewares.
Fixes https://github.com/denoland/fresh/issues/3400
2025-09-15 10:44:21 +02:00
Marvin Hagemeister
b31f36265c
fix(vite): keep require calls in ESM file ( #3433 )
...
Detect if a file is ESM based on file extension or finding ESM-only
statements. When we know that it's an ESM file we should keep
`require()` calls as is, because some libraries use it as a conditional
check like `npm:motion`.
Fixes https://github.com/denoland/fresh/issues/3429
2025-09-15 10:40:09 +02:00
Marvin Hagemeister
4cc0722465
chore: release 2.0.2 ( #3418 )
...
- @fresh/core@2.0.2
- @fresh/plugin-vite@1.0.2
- @fresh/update@2.0.2
- @fresh/init@2.0.8
2025-09-12 19:16:12 +02:00
Marvin Hagemeister
3ff4ec2ccb
chore: make less test less flaky ( #3417 )
2025-09-12 18:22:21 +02:00
Marvin Hagemeister
ae3db58a99
fix(vite): .env files not being loaded ( #3416 )
...
Fixes https://github.com/denoland/fresh/issues/3364
2025-09-12 18:21:51 +02:00
Marvin Hagemeister
169f156f78
fix(init): incorrect target dir argument ( #3415 )
...
Fixes https://github.com/denoland/fresh/issues/3413
2025-09-12 15:37:06 +02:00
Marvin Hagemeister
8a996a428a
fix(vite): missing build id in Deno Deploy EA ( #3414 )
...
Fixes https://github.com/denoland/fresh/issues/3282
2025-09-12 15:24:26 +02:00
Marvin Hagemeister
e06f03ac67
fix: add missing compile entry ( #3410 )
...
Fixes https://github.com/denoland/fresh/issues/3409
2025-09-12 13:08:49 +02:00
Marvin Hagemeister
7ce6aeff8b
fix(vite): workaround for FOUC with tailwind ( #3407 )
...
Fixes https://github.com/denoland/fresh/issues/3379
2025-09-12 12:34:23 +02:00
Marvin Hagemeister
e5bc9194e9
fix(vite): drop trailing or leading whitespace in build id ( #3408 )
...
Fixes https://github.com/denoland/fresh/issues/3406
2025-09-12 12:33:13 +02:00
Marvin Hagemeister
0e6bddd06e
chore: release 2.0.1 ( #3404 )
...
- @fresh/core@2.0.1
- @fresh/plugin-vite@1.0.1
- @fresh/update@2.0.1
- @fresh/init@2.0.7
2025-09-12 11:05:03 +02:00
Marvin Hagemeister
fc3cdc9588
docs: update cloudflare workers docs ( #3405 )
2025-09-12 11:04:47 +02:00
Marvin Hagemeister
e30cb375d1
docs: mention entry in cloudflare worker docs ( #3403 )
...
Related https://github.com/denoland/fresh/issues/3402
2025-09-12 10:37:38 +02:00
Marvin Hagemeister
9581d7e6d4
fix(vite): remove Deno global check ( #3401 )
...
Ultimately, it causes more problems than it solves.
2025-09-12 10:01:37 +02:00
Marvin Hagemeister
554644b240
docs: add copy buttons ( #3393 )
2025-09-11 15:19:34 +02:00
Marvin Hagemeister
fb341e4ab7
chore: release 2.0.0 ( #3371 )
2025-09-09 18:52:36 +02:00
Marvin Hagemeister
f773d0d359
feat(vite): add update checker ( #3372 )
2025-09-09 18:52:19 +02:00
Marvin Hagemeister
79d8cfc3ed
docs: make 2.x the default version ( #3369 )
2025-09-09 14:36:51 +02:00
Marvin Hagemeister
2c315a9972
docs: remove outdated crud docs ( #3368 )
...
Fixes https://github.com/denoland/fresh/issues/3367
2025-09-09 11:59:34 +02:00
Marvin Hagemeister
cb14abad21
chore: release @fresh/plugin-vite@0.10.2 ( #3366 )
2025-09-08 22:12:54 +02:00
Marvin Hagemeister
6e9f586c54
chore: release 2.0.0-beta.5 and @fresh/plugin-vite@0.10.2 ( #3365 )
...
Fixes https://github.com/denoland/fresh/issues/3363
2025-09-08 22:07:49 +02:00
Marvin Hagemeister
69283c81b4
chore: release @fresh/plugin-vite@0.10.1 ( #3361 )
2025-09-08 18:00:06 +02:00
Marvin Hagemeister
be2fde6a85
fix(vite): silence optional export warnings ( #3360 )
...
Seems like vite is overly strict when accessing optional namespaced
module properties. The code is perfectly fine, so silence these
warnings.
2025-09-08 17:59:54 +02:00
Marvin Hagemeister
2c2257843e
chore: release @fresh/plugin-vite@0.10.0 ( #3359 )
2025-09-08 17:43:07 +02:00
Marvin Hagemeister
8743322968
feat(vite): serve static index.html files ( #3358 )
...
Fixes https://github.com/denoland/fresh/issues/3356
2025-09-08 17:36:30 +02:00
Marvin Hagemeister
2e015cd2b9
fix(vite): improve commonjs handling ( #3357 )
2025-09-08 17:06:11 +02:00
Marvin Hagemeister
2c32ffe8f3
fix(vite): support ssr css modules ( #3355 )
...
Fixes https://github.com/denoland/fresh/issues/3325
2025-09-08 16:23:13 +02:00
Marvin Hagemeister
4c3ff9b74d
chore: fix demo tasks ( #3354 )
2025-09-08 15:43:07 +02:00
Marvin Hagemeister
4ff8e677aa
fix(vite): nested island css module styles not working ( #3353 )
...
Related https://github.com/denoland/fresh/issues/3325
2025-09-08 10:00:14 +02:00
Marvin Hagemeister
a72472095d
chore: releasd @fresh/plugin-vite@0.9.13 ( #3345 )
2025-09-05 16:58:27 +02:00
Marvin Hagemeister
185ab95751
fix(vite): get radix-ui working ( #3344 )
2025-09-05 16:51:22 +02:00
Marvin Hagemeister
b06ef5a855
chore: release 2.0.0-beta.4 and @fresh/plugin-vite@0.9.12 ( #3343 )
2025-09-05 12:23:47 +02:00
Marvin Hagemeister
a892da2b0e
fix(vite): incorrect JSX detection ( #3342 )
2025-09-05 12:17:12 +02:00
Marvin Hagemeister
971163ff66
fix: account for JS syntax when generating island names ( #3341 )
...
Fixes https://github.com/denoland/fresh/issues/3339
2025-09-05 11:33:50 +02:00
Marvin Hagemeister
892aefbf94
chore: release @fresh/plugin-vite@0.9.11 ( #3337 )
2025-09-04 13:06:50 +02:00
Marvin Hagemeister
4138b8ca66
fix(vite): improve commonjs handling ( #3336 )
...
Fixes https://github.com/denoland/fresh/issues/3323
2025-09-04 12:59:13 +02:00
Marvin Hagemeister
b94aab2a1a
chore: update to vite's hook filter ( #3333 )
...
Fixes https://github.com/denoland/fresh/issues/3331
2025-09-04 11:16:06 +02:00
Marvin Hagemeister
baf774517b
chore: get builds passing in Deno canary ( #3335 )
2025-09-04 10:18:17 +02:00
Marvin Hagemeister
e21d6742d2
chore: add demo tasks ( #3332 )
2025-09-03 18:52:19 +02:00
Marvin Hagemeister
70017d2480
docs: fix form data page ( #3329 )
...
Fixes https://github.com/denoland/fresh/issues/3320
2025-09-03 12:12:53 +02:00
Marvin Hagemeister
cc004a5efa
chore: release @fresh/init@2.0.5 ( #3328 )
2025-09-03 12:06:12 +02:00
Marvin Hagemeister
fd2ebc63c5
fix(init): setup vite/client types on init ( #3327 )
...
Note that this also requires
https://github.com/denoland/deno/issues/30560 to work. That will be
released in either Deno `2.4.6` or `2.5.0` depending on which one comes
first.
Fixes https://github.com/denoland/fresh/issues/3319
2025-09-03 12:02:52 +02:00
Marvin Hagemeister
08ef05fc1d
fix(vite): pathname treated as static file ( #3326 )
...
Fixes https://github.com/denoland/fresh/issues/3322
2025-09-03 11:34:19 +02:00
Marvin Hagemeister
717aa32111
www: point hello bar to new blog post ( #3318 )
2025-09-02 17:58:05 +02:00
Marvin Hagemeister
bc9eb5dcba
chore: release @fresh/plugin-vite@0.9.10 ( #3317 )
2025-09-02 17:42:00 +02:00
Marvin Hagemeister
a2ea7c9f73
fix(vite): update readme ( #3316 )
2025-09-02 17:41:17 +02:00
Marvin Hagemeister
fbc8ade0dd
chore: release @fresh/plugin-vite@0.9.9 and @fresh/init@2.0.4 ( #3315 )
2025-09-02 16:16:24 +02:00
Marvin Hagemeister
fbfdcd719d
docs: migration guide ctx.render() ( #3314 )
...
Fixes https://github.com/denoland/fresh/issues/2969
2025-09-02 16:04:30 +02:00
Marvin Hagemeister
9685488451
docs: add troubleshooting page ( #3313 )
2025-09-02 15:35:02 +02:00
Marvin Hagemeister
35f5cc4b7a
fix(init): don't show counter value in document title ( #3311 )
...
It falsely gives the impression that the value in the document title
would be live.
2025-09-02 15:19:26 +02:00
Marvin Hagemeister
4d463a8e2c
chore: update vite 7.1.4 ( #3298 )
2025-09-02 14:37:36 +02:00
Marvin Hagemeister
cb4482dbe5
feat(init): init with vite by default and move builder to flag ( #3309 )
2025-09-02 14:14:28 +02:00
Marvin Hagemeister
9e58af7a5c
docs: update for vite ( #3308 )
...
Update docs for vite
2025-09-02 10:45:27 +02:00
Marvin Hagemeister
6ddc0fbbcb
fix(init): add hint in client.ts for HMR ( #3307 )
2025-09-02 09:55:33 +02:00