## 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>
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>
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>
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.