Commit Graph
1461 Commits
Author SHA1 Message Date
Marvin Hagemeister 5c3fe27046 chore: refactor tests (#3243) 2025-08-22 12:14:19 +02:00
Marvin Hagemeister 873c54bd5f feat(vite): get rid of unnecessary polyfills (#3242) 2025-08-22 11:23:57 +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 6dd250c520 chore: release 2.0.0-alpha.60 (#3237) 2025-08-21 18:27:56 +02:00
Marvin Hagemeister 85143f3c56 chore: release @fresh/plugin-vite@0.9.1 (#3235) 2025-08-21 14:38:05 +02:00
Marvin Hagemeister 105ffe55ee fix(vite): only transform js-like files in deno loader (#3234) 2025-08-21 14:29:13 +02:00
fry69andMarvin Hagemeister 9f09786b06 feat(vite): read build id from env if present (#3233)
Fix #3232

Disclaimer: This code was mostly generated by GitHub Copilot agent using
Sonnet-4, but tested and verified by me.

---------

Co-authored-by: Marvin Hagemeister <marvin@deno.com>
2025-08-21 13:31:45 +02:00
Marvin Hagemeister 647d6f9adb chore: release 2.0.0-alpha.59 (#3231)
Fixes https://github.com/denoland/fresh/issues/3229
2025-08-20 09:48:41 +02:00
Marvin Hagemeister 14fe895ba1 chore: release @fresh/plugin-vite@0.9.0 (#3228)
Doing a bigger version jump because I think it's close to being ready.
2025-08-19 19:56:48 +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
crowlsyong 54110c6372 docs: fix typo in csrf.md (#3223)
safguard --> safeguard
2025-08-18 13:59:23 +00:00
Marvin Hagemeister 09b0c73d9f docs: mention new entrypoint in migration guide (#3222) 2025-08-18 12:58:39 +02:00
Marvin Hagemeister f80d049dca fix(vite): inline FRESH_PUBLIC_* env vars (#3221) 2025-08-16 23:14:03 +02:00
Marvin Hagemeister 59549c9532 fix(vite): npm resolution + cjs + duplicated preact signals (#3211) 2025-08-16 19:26:39 +02:00
Christian Svensson 71071171ed test: improve temp dir disposal for CI vs Local (#3218)
- Cleaning up TMP files in CI is unnecessary, as files are discarded
automatically between runs (except of using cache/artifacts)
- On Windows, `<user>\AppData\Local\Temp\*` files are _not_
automatically removed (see resources below)

This PR should make tests a tiny bit faster in CI by avoiding work, as
well as skipping error messages that might follow.

And running tests locally will now log warnings if temp files fails to
be removed instead of silently continuing.

## Resources

-
https://www.reddit.com/r/windows/comments/yfpbb1/why_arent_windows_temp_files_deleted/
-
https://www.reddit.com/r/WindowsHelp/comments/1f4lgui/why_does_windows_cleanup_miss_temp_folder/?utm_source=chatgpt.com

<img width="1066" height="1065" alt="image"
src="https://github.com/user-attachments/assets/55c98f86-e134-4a2d-86cc-cbab63048c47"
/>

Partially replaces #2990
2025-08-15 13:30:58 +02:00
Marvin Hagemeister e05fd10977 chore: release 2.0.0-alpha.58 (#3217) 2025-08-12 12:55:38 +02:00
Marvin Hagemeister fe4a59a88c feat: support custom server entry (#3216) 2025-08-12 12:50:10 +02:00
Marvin Hagemeister f27f10fbcb docs: fix duplicate line (#3215) 2025-08-12 12:34:15 +02:00
Marvin Hagemeister 477fcefed4 feat: support inlining FRESH_PUBLIC_ env vars (#3214)
Fixes https://github.com/denoland/fresh/issues/3213
2025-08-12 12:00:59 +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 1f3f0a48f5 chore: release @fresh/plugin-vite@0.0.3 (#3209) 2025-08-08 12:31:34 +02:00
Marvin Hagemeister 9a764ae116 fix: vite resolution + cjs fixes (#3208) 2025-08-08 12:27:21 +02:00
Marvin Hagemeister c97e8226af chore: release @fresh/plugin-vite@0.0.2 (#3207) 2025-08-08 09:36:23 +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 0664476e46 fix: workaround vite treating npm: as built-ins (#3205)
Upstream fix: https://github.com/vitejs/vite/pull/20558
2025-08-08 00:22:54 +02:00
Marvin Hagemeister a084a2c536 fix: unable to load CommonJS in vite plugin (#3204)
Vite has an internal check that limits CommonJS detection to only bare
specifier. This doesn't work well together with us resolving npm modules
to absolute file paths.


https://github.com/vitejs/vite/blob/main/packages/vite/src/node/ssr/fetchModule.ts#L46

I've tried re-using our own instance of `@rollup/plugin-commonjs` or
`esbuild` but couldn't get these to work in that setup. The easiest way
seems to be to just write our own CJS -> ESM translation layer.

With a little luck since the Deno ecosystem is heavy into ESM we might
get away with this. In either way this removes one of the two blockers
to using the vite plugin.
2025-08-08 00:04:16 +02:00
Marvin Hagemeister 3d1eb2c346 fix: basePath not working in dev server (#3202)
Fixes https://github.com/denoland/fresh/issues/3201
2025-08-07 12:38:37 +02:00
Marvin Hagemeister 073bacfbbb chore: release 2.0.0-alpha.57 (#3200) 2025-08-06 17:55:19 +02:00
Marvin Hagemeister d14d623482 fix: esbuild build-id plugin not loading published package (#3199) 2025-08-06 17:52:34 +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
Marvin Hagemeister 27e407a1e3 feat: add define.layout helper (#3198) 2025-08-06 15:23:18 +02:00
Marvin Hagemeister f35338b75f chore: release 2.0.0-alpha.56 (#3195) 2025-08-06 13:01:02 +02:00
Marvin Hagemeister 83036d87ee fix: extract build-id into seperate package to fix publishing (#3194)
Also makes it easier to replace during bundling.
2025-08-06 12:53:50 +02:00
Marvin Hagemeister ba2e01fec0 chore: release 2.0.0-alpha.55 (#3193) 2025-08-06 12:23:47 +02:00
Marvin Hagemeister 36aa9b5639 feat: add vite plugin (#3187)
Second attempt after we had to revert
https://github.com/denoland/fresh/pull/3185
2025-08-06 12:13:22 +02:00
Roscoe Rubin-Rottenberg a5205b2a8e docs: add correct ctx.state example to init and docs (#3147)
- Correct outdated, non-functional and confusing "Removal of <Head>
component" section of migration guide in the docs to be real functional
code that uses Fresh 2 and define helpers correctly
- Added example of ctx.state being used for a head component (title)
because it's something almost every single project will need to know how
to do.
- Small change to define docs use of define.page to be more in line with
its use commonly
- Removed mention of deno-puppeteer - a non-official repository that
hasn't been updated in three years - needing to be installed from
`CONTRIBUTING.md`
2025-08-06 00:17:24 +02:00
Christian Svensson b7f1abb0d0 test(docs): type check docs code examples (#3180)
This PR adds the initial seeds of type checking the code in all code
blocks for the Markdown Docs.

- Adds a unit test, disabled due to the many remaining errors, that can
help find incorrect code
- Fixes a bunch of syntax errors, type errors, and other code issues
found in the docs

## Future improvements

A lot of remaining issues is mostly related to missing imports, e.g.
`App`, `staticFiles`, `HttpError` etc. There's a couple of different
directions to solve this in future PR's.

- Add explicit imports to all docs examples (may become unnecessarily
verbose)
- Add code to docs code blocks, but with a hint to remove it when
rendering the markdown as HTML
   ```tsx
   import { App } from "fresh";
   // #docs-start

   // Everything above marker above is trimmed away
   const app = new App();
   ```
- Add a `types.d.ts` with "global" types used during type checking, so
globals, imports and so on can be handled globally

I do think that some examples probably should be more explicit with
imports, but it would be overkill for a lot of places such as `app.md`
and `context.md`.
2025-08-05 23:56:04 +02:00
Christian Svensson e014d80a0f docs: add canary docs for <head> modifications (#3173)
Adds v2 version of "Modyfing the <head>" example. This is the next to
last page that needs to be updated (though the other only requires minor
changes to types).
2025-08-05 23:50:58 +02:00
Christian Svensson 4818faad1d docs: move CoC to .github folder (#3178)
Helps reduce the amount of files in the root files on the root, as well
making it more consistent placing it next to CONTRIBUTING.md.

According to [GitHub
docs](https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/adding-a-code-of-conduct-to-your-project#adding-a-code-of-conduct-manually),
the `.github/` folder is one of the recommended places, and should be
picked up by GitHub for links and on the project homepage.

<img width="515" height="227" alt="image"
src="https://github.com/user-attachments/assets/cf4b727a-f8eb-4caf-a4ed-39d9456ccdee"
/>
2025-08-05 23:50:05 +02:00
Christian Svensson 349372ad82 style: fix horizontal scrollbar for some screen sizes (#3177)
On the Fresh docs, I get a vertical scrollbar for a small range of
viewport size of the browser. This is annoying me, since I get it when I
place two windows next to each other on a 21:9 screen.

The issue seems to stem from a button using `p-1 -m-1`. But the negative
margin is there to address the increased space due to making the button
easier to click (most likely for touch/mobile). But this makes the
button overflow when there is no right-margin (`2xl:mr-0`).

<img width="1637" height="661" alt="image"
src="https://github.com/user-attachments/assets/48773cf5-316d-41f3-99e0-54f49b1f2cc9"
/>

## Solution

The simplest and easiest fix here is just to increase the margin to
cover for this case. `2xl:mr-1` seems to do the trick. But it might be a
good idea to have a little more gap towards the edge of the screen, e.g.
`2xl-mr-2`.
2025-08-05 23:49:13 +02:00
Marvin Hagemeister d108b2c182 chore: release 2.0.0-alpha.54 (#3192) 2025-08-05 16:04:40 +02:00
Marvin Hagemeister a6a16dbd18 fix: unable to load json inside npm packages (#3191) 2025-08-05 16:00:58 +02:00
Marvin Hagemeister c2a5812644 chore: release 2.0.0-alpha.53 (#3190) 2025-08-05 15:00:35 +02:00
Marvin Hagemeister ad76097581 fix: windows static file path handling (#3188) 2025-08-05 14:56:35 +02:00
Marvin Hagemeister 71b7d922ea fix: add deno compile entry (#3189)
Fixes https://github.com/denoland/fresh/issues/3123
2025-08-05 14:53:08 +02:00
Marvin Hagemeister 2f76a0a2aa Revert "feat: Add experimental vite plugin (#3184)" (#3185)
This reverts commit a1571b76ed.

It broke fresh.deno.dev :S
2025-08-04 18:54:04 +02:00
Marvin Hagemeister a1571b76ed feat: Add experimental vite plugin (#3184)
This PR adds a vite plugin for Fresh. This enables:

- HMR (only for islands for now)
- self-contained output bundles for both server and client
- smarter chunking

It uses vite's new Environment API under the hood.
2025-08-04 18:30:05 +02:00
Christian SvenssonandMarvin Hagemeister 57596dc406 feat: support passing URL to islands (#3181)
Adds support for passing `URL` values to Islands.

```tsx
// routes/index.html
export default function Page() {
  return <MyIsland url={new URL("https://fresh.deno.dev")} />;
}
```

Also updates documentation with some missing serialization features
(`undefined`, `Map`, `Set`, and `-0`).

---------

Co-authored-by: Marvin Hagemeister <hello@marvinh.dev>
2025-08-03 20:42:50 +02:00
Marvin Hagemeister 03f6981860 fix: serialized compute signals re-created as normal signals (#3183)
Fixes https://github.com/denoland/fresh/issues/3182
2025-08-03 20:31:36 +02:00