## 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.
## 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>
## Summary
- Remove the Showcase page route, data, component, and all 175 showcase
images
- Remove "Showcase" from the navigation bar
- Keep the fresh-badge SVGs (still linked from external READMEs)
Also closed 12 open showcase PRs: #2691, #2861, #2846, #2720, #2282,
#2667, #2585, #1842, #2784, #1697, #2260, #2841.
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
## Summary
- Update init command in `README.md` from `deno run -A -r
https://fresh.deno.dev` to `deno run -Ar jsr:@fresh/init` to match Fresh
2.x
- Fix `www/README.md` to use `deno task dev` (Vite dev server) instead
of `deno task start` (production server) for development workflow
---------
Co-authored-by: Marvin Hagemeister <marvinhagemeister50@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
The example island and partials are using the old import styles, this PR
updates those examples.
---------
Signed-off-by: Jason McCallister <jason@mccallister.dev>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
## Summary
- Refresh `deno.lock` to pick up latest dependency resolutions (notably
preact 10.28.2 → 10.29.0, new `@deno/graph` and `@std/json` entries)
- Fix stale integrity hashes for `raw.githubusercontent.com` remote
specifiers (`check_docs.ts`, `utils.ts`) that point to branch HEAD
- Run `deno fmt` on `www/static/docsearch.css` and
`www/static/markdown.css`
- Remove `deploy.yml` workflow — Deno Deploy now uses its built-in
GitHub integration
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Hello there,
Thought I would add my hobby project to the showcase, since it was built
with Fresh 1.0 and now ported to 2.0 (beta). Here's the link: [Retro
Ranker](https://retroranker.site) and the
[github](https://github.com/Nergy101/retro-ranker)
- [x] Ran `deno task ok` and passed.
If I missed anything, let me know.
Cheers!
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.
The `buildVite` function returns a disposable object which was not being
properly disposed of, leading to a resource leak warning in the test
suite.
This change wraps the tests in `www/main_test.ts` in an async function
and uses `await using` to ensure that the temporary directory created by
`buildVite` is cleaned up after the tests complete.
---------
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
Co-authored-by: Emil Krebs <68400102+emilkrebs@users.noreply.github.com>
Co-authored-by: Marvin Hagemeister <hello@marvinh.dev>
I noticed that in denoland/fresh#3393 it looks like it's possible that
the "Copied"/Check icon will be shown even if copying to clipboard
fails.
This PR changes it so that the Check icon only shows if copy succeeds.
Replaced placeholder TODOs with actual screenshots in the getting
started documentation and added three new image files to illustrate the
initialization, about page, and countdown examples.
---------
Co-authored-by: Marvin Hagemeister <marvin@deno.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.
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`.
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).
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`.
Addresses the issue mentioned in
https://github.com/denoland/fresh/pull/3163#discussion_r2246708003.
The issue was that the `raw` markdown was being used for e.g. `## My
title`, thus the slug became `-my-title` instead of `my-title`. Slugs
were working correctly for `codespan` in headers, e.g. ``## `someCode`
``.
I decided to hard error if unexpected heading syntax is used over
sluggifying unexpected content (can become super weird otherwise, e.g.
`## <button ...>My heading</button>`). I can revert to fallbacking to
`raw` if preferred, but perhaps with at least trimming leading `-` just
in case.
Follow-up from #3162.
This PR does various tweaks, mostly related to code blocks.
- Adds missing titles to code blocks, and updates titles to be more
consistent
- Adds filenames to most ` ```tsx` blocks with e.g. `main.ts`, `dev.ts`
or a suitable example (e.g. `routes/greeting.tsx`) based on the code
- Adds filenames to ` ```diff` blocks if there's a relevant file, to
make the icon e.g. TS over Diff icon
- Code blocks with Fresh code (e.g. interfaces) uses ` ```tsx fresh 🍋`
- Changes most ` ```sh` blocks with example terminal commands to ` ```sh
Terminal`
- Updates ` ```txt Project Structure` or ` ```diff Project Structure`
blocks to be more consistent
- Changes `sh` or `txt` to `txt-files` which improves highlighting and
makes icon consistent
- Renames `<project dir>` to `<project root>` to match builder `root`
option terminology
- Adds `<project root>` root folder to most/all overview folder
overviews
- Makes the structure blocks more consistently displayed
- Tried to make some "bare" examples more complete
## Comparison
Here's a small curated set of before/after changes.
### Deployment
- `deno` highlighted in terminal commands
- `.gitignore` syntax highlighting works without using `sh` as language
<img width="1641" height="1009" alt="image"
src="https://github.com/user-attachments/assets/170cf833-1f6a-4b0d-8d2d-a081bc28a967"
/>
### File routing
Updated icon, comments same as before, but root and hierarchy have new
colors (`operator`/`function`).
<img width="1647" height="588" alt="image"
src="https://github.com/user-attachments/assets/f28db51b-4bee-45e4-be1c-e137a6d3ae3d"
/>
We can improve cold start times by only loading route modules when the particular pattern matches. This PR introduces the concept of lazy middlewares, routes and handlers to do that.
This fixes a bunch of long standing issues in our tracker where a build
wouldn't finish because of importing user code. It's common for backend
apps to spawn some open ended tasks like subscribing to Deno KV or other
things. This addresses another problem of having to set up ENV vars just
for the build, even though they are technically not required to build
islands.
This also gives a roughly ~30% performance boost on cold starts (at
least on `deno.com`). Unfortunately, this does require some breaking
changes. But I believe the performance improvements + removing the
footgun of loading user code during build is well worth it. This work is
also a precursor in case we want to exploring moving to vite at some
point in the future.
## Breaking changes
1. Build options have moved to the builder.
```diff
// main.ts
- const app = new App({ build: { outDir: "dist/" } })
+ const app = new App()
// dev.ts
- const builder = new Builder();
+ const builder = new Builder({ outDir: "dist/" });
```
2. Another breaking change is how file based routes are loaded. Since
they're prepared and loaded by the builder the API changed.
```diff
// main.ts
const app = new App()
.use(staticFiles())
- await fsRoutes(app, {
- loadIsland: (path) => import(`./islands/${path}`),
- loadRoute: (path) => import(`./routes/${path}`),
- });
+ app.fsRoutes()
```
You can optionally change the `islandDir` or `routeDir` by passing that
to the `Builder`:
```ts
// dev.ts
const builder = new Builder({
islandDir: "/path/to/islands",
routeDir: "/path/to/routes"
});
```
3. Import `app` lazily in `dev.ts`. Passing `app` to `builder.build()`
is not necessary anymore.
```diff
- import { app } from "./main.ts";
const builder = new Builder({ target: "safari12" });
if (Deno.args.includes("build")) {
- await builder.build(app);
+ await builder.build();
} else {
- await builder.listen(app);
+ await builder.listen(() => import("./main.ts"));
}
```
4. The production run command has changed. It's now using `deno serve`
```diff
// deno.json
{
"tasks": {
"dev": "deno run -A --watch=static/,routes/ dev.ts",
"dev": "deno run -A dev.ts build",
- "start": "deno run -A main.ts",
+ "start": "deno serve -A _fresh/server.js",
}
}
```
Remove this bit in `main.ts`:
```diff
// main.ts
- if (import.meta.main) {
- await app.listen()
- }
```
Fixes https://github.com/denoland/fresh/issues/2240
Fixes https://github.com/denoland/fresh/issues/2640
Fixes https://github.com/denoland/fresh/issues/2592
Fixes https://github.com/denoland/fresh/issues/1843
update /www and tailwind-plugin to support tailwind v4.
Thanks to the merge of #3034, the work of integrating and advancing
#2903 is promoted.
related #3034
related #2903close#3056close#2819
--patch-1
based on review,
1. del compiler and make it more clean and simple,
2. fix init tailwind part,
3. fix test tailwind part
--patch-2
1. fix the docs
2. fix the docs of plugin and version
--patch-3
1. Addressed various maintenance tasks (chores)
2. Updated the Tailwind CSS plugin to align with this release. Generated
a fresh project using the updated init configuration and
3. deployed it via Deno Deploy EA. Deployment is functioning correctly.
--patch-4
Move postcss imports to Tailwind section in init script
--patch-5
Refactored Tailwind plugin type definitions by copying PluginOptions
properties from @tailwindcss/postcss and adding Fresh-specific exclude
option, while exporting types from package entrypoint for better
accessibility.
Test Project: https://fresh.fresh-press.deno.net/
Test Project Repository:
https://github.com/SisyphusZheng/fresh-tailwindv4
Test Plugin: https://jsr.io/@freshpress/fresh-plugin-tailwind@1.0.0
---------
Co-authored-by: 李嘉图·M·路 <146103794+Ricardo-M-Zheng@users.noreply.github.com>
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
Co-authored-by: Marvin Hagemeister <marvin@deno.com>