Commit Graph
33 Commits
Author SHA1 Message Date
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 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
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
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
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
c863097779 fix: handle paths with whitespaces in staticFiles (#3659)
Fix #3657

Static files with special characters in their names (spaces, `#`,
unicode, etc.) fail to load due to path encoding issues.

## Root cause

`prepareStaticFile()` uses `new URL(pathname, base)` to normalize paths,
but `new URL` doesn't properly encode characters that are already
percent-encoded in the filesystem path. For example, a file literally
named `test %20encodeUri` becomes `test%20%20encodeUri` (the space and
literal `%20` are indistinguishable), instead of the correct
`test%20%2520encodeUri`.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 20:00:48 +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 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 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 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 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 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 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 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 185ab95751 fix(vite): get radix-ui working (#3344) 2025-09-05 16:51:22 +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 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 ff9db336f7 feat(vite): check valid imports per environment (#3299)
Fixes https://github.com/denoland/fresh/issues/3296
2025-09-01 17:30:30 +02:00
Marvin Hagemeister 541bc6c6ca feat(vite): support remote islands (#3294) 2025-09-01 12:11:08 +02:00
Marvin Hagemeister b41c151de3 fix(vite): serve css imported in islands (#3272)
Fixes https://github.com/denoland/fresh/issues/3271
2025-08-29 14:30:00 +02:00
Marvin Hagemeister adc5c2e4a8 chore: speed up vite tests (#3258) 2025-08-26 09:52:26 +02:00
Marvin Hagemeister d1f7d49466 fix(vite): importing node:* builtins (#3245) 2025-08-22 13:58:39 +02:00
Marvin Hagemeister 27c2910b1d fix(vite): babel transform being applied for non-js files (#3238) 2025-08-21 20:03:00 +02:00
Marvin Hagemeister ffa57be765 fix(vite): partial island loading (#3226) 2025-08-19 17:58:17 +02:00
Marvin Hagemeister afdf5eaf6c fix(vite): asset handling (#3225)
This PR reworks asset handling in our vite plugin. Importing assets in
js is now supported.
2025-08-19 16:45:33 +02:00
Marvin Hagemeister f80d049dca fix(vite): inline FRESH_PUBLIC_* env vars (#3221) 2025-08-16 23:14:03 +02:00
Marvin Hagemeister d026375c3e fix(vite): error when npm package requires json files (#3210) 2025-08-08 14:16:38 +02:00
Marvin Hagemeister 22ebb2dbfa fix: support optional static, routes and island dir in vite plugin (#3206) 2025-08-08 09:23:38 +02:00
Marvin Hagemeister 815b1940e3 chore: restructure repository into packages/ folder (#3197)
We're having a growing number of packages in this repository. This PR
moves them into a `packages/` directory like it's commonly done in other
projects.
2025-08-06 15:52:45 +02:00