Commit Graph
91 Commits
Author SHA1 Message Date
Marvin Hagemeister c08710f7dd chore: release 2.0.0-alpha.50 (#3160) 2025-07-31 09:31:35 +02:00
Marvin Hagemeister f87d2180fb chore: release 2.0.0-alpha.49 (#3156) 2025-07-30 15:20:36 +02:00
Marvin Hagemeister d8d19c4113 chore: release 2.0.0-alpha.48 (#3154) 2025-07-30 12:33:00 +02:00
Marvin Hagemeister d44dcdd60e chore: release 2.0.0-alpha.47 (#3152) 2025-07-30 09:10:08 +02:00
Zhiand李嘉图·M·路 29d1e0a484 fix(init): set minimum gradient height to screen height (#3145)
---------

Co-authored-by: 李嘉图·M·路 <146103794+Ricardo-M-Zheng@users.noreply.github.com>
2025-07-26 17:48:16 +02:00
Marvin Hagemeister 3ad3e6ecf3 feat: support lazily loading routes/handlers (#3131)
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.
2025-07-25 14:33:28 +02:00
Marvin Hagemeister 76002fef0e chore: release 2.0.0-alpha.46 (#3134) 2025-07-25 08:40:06 +02:00
Marvin Hagemeister 85c17fac72 fix: nested index route not working in prod builds (#3132)
This was due to a mismatch in the disk snapshot compared to in memory.
2025-07-24 21:27:16 +02:00
Marvin Hagemeister ba1a1bc9c2 chore: release 2.0.0-alpha.45 (#3128)
This is done to pick up the latest tailwind version in `@fresh/init`
2025-07-24 16:21:30 +02:00
Marvin Hagemeister 0841940b74 chore: release tailwind plugin 0.0.1-alpha.9 (#3127) 2025-07-24 16:12:00 +02:00
Marvin Hagemeister 5903684d02 chore: release 2.0.0-alpha.44 (#3124) 2025-07-24 15:35:15 +02:00
Marvin Hagemeister 118242eaa6 major: build islands + scan routeDir without importing user code (#3122)
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
2025-07-24 15:04:05 +02:00
Marvin Hagemeister 69af00ef65 fix(init): remove deprecated tailwind config file creation (#3121) 2025-07-21 23:14:57 +02:00
bb23643779 feat: support tailwindcss v4 (#3054)
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 #2903 

close #3056
close #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>
2025-07-21 16:13:34 +02:00
Marvin Hagemeister be253a3a70 chore: release 2.0.0-alpha.43 (#3117) 2025-07-19 12:32:27 +02:00
Marvin Hagemeister 41cf4ac64a chore: release 2.0.0-alpha.42 (#3114) 2025-07-18 22:41:56 +02:00
Marvin Hagemeister a66e0df08d chore: release 2.0.0-alpha.41 (#3107) 2025-07-17 15:37:02 +02:00
Marvin Hagemeister 9efaf0463e chore: release 2.0.0-alpha.40 (#3101) 2025-07-16 14:46:17 +02:00
Marvin Hagemeister be03e4a548 fix(init): add back static files (#3100) 2025-07-16 14:41:12 +02:00
Marvin Hagemeister 713c85c12d chore: release 2.0.0-alpha.39 (#3097) 2025-07-16 13:43:31 +02:00
Marvin Hagemeister c11cf7b41a feat: expose layouts and pages on App (#3086)
This PR extracts the functionality from the `fs_routes` plugin and
exposes it onto `App`. These are the new APIs:

- `app.layout(pattern, route)`
- `app.onError(pattern, route)`
- `app.notFound(pattern, route)`
- `app.route(pattern, route)`

This also removes the need for `.use(staticFiles())`. This line can be
safely removed.

Fixes https://github.com/denoland/fresh/issues/3040
Fixes https://github.com/denoland/fresh/issues/3033
Fixes https://github.com/denoland/fresh/issues/2591
Fixes https://github.com/denoland/fresh/issues/950
Fixes https://github.com/denoland/fresh/issues/1918
2025-07-14 19:27:48 +02:00
Marvin Hagemeister ccb621d2a3 chore: release 2.0.0-alpha.38 (#3095) 2025-07-14 18:19:03 +02:00
Marvin Hagemeister ec2bb17589 chore: release 2.0.0-alpha.37 (#3074) 2025-07-02 12:48:11 +02:00
Marvin Hagemeister b00175fafd fix(core): don't rely on strict esbuild version (#3073) 2025-07-02 12:38:42 +02:00
Marvin Hagemeister 67fd8ccd36 chore: release 2.0.0-alpha.36 (#3072) 2025-06-30 16:39:34 +02:00
Marvin Hagemeister 0b6e62a693 chore: release 2.0.0-alpha.35 (#3062) 2025-06-26 15:53:15 +02:00
Josh Dales b338845c7f fix(init): only add tailwind to imports when selected (#3051)
If you don't install tailwind you shouldn't need the plugin, resolves
https://github.com/denoland/fresh/issues/3050
2025-06-19 19:55:05 +02:00
Asher Gomez 71bec59820 chore: change patch Deno config file option to links (#3030)
Ref: https://github.com/denoland/deno/pull/29677
2025-06-14 09:55:06 +02:00
Mahesh Bansod 1e6f0d69b1 init: update instructions to run project from a fresh scaffold (#2996)
After scaffolding the project with 
```
deno run -Ar jsr:@fresh/init@2.0.0-alpha.34
```
Instruction show up to run the project:
```
Enter your project directory using cd fresh-project.
Run deno task start to start the project. CTRL-C to stop.

Stuck? Join our Discord https://discord.gg/deno
```
these instructions seem to be outdated since running `deno task start`
on this project throws an error.

While this error also hints that you might want to run the dev server, I
think it gives a bad impression that a newly scaffolded project is
throwing an error after running the command that it has specified. Also,
not many people, especially beginners, read the error messages
completely.
2025-05-26 14:12:47 +02:00
Marvin Hagemeister dbb76623a4 Revert "feat: update the tailwind plugin to suuport tailwindv4 #2819 (#2903)" (#2988)
Reverts tailwind v4 update. Something is wrong with the CSS files on
fresh.deno.dev 😢
2025-05-21 16:07:51 +02:00
40e7747228 feat: update the tailwind plugin to suuport tailwindv4 #2819 (#2903)
Inspired by #2819, #2829, and
https://github.com/pakornv/fresh-plugin-tailwindcss, I made minimal
modifications to the plugin-tailwind, I originally intended to update
based on #2829, but I was informed by the system that I couldn't push.

Due to the breaking changes in Tailwind v4, some PostCSS plugins are no
longer required. Additionally, I updated the syntax in the /www
directory. The /www directory now uses the updated plugin supported by
Tailwind v4.I think this has made initial progress.

# What This PR Solves
The Tailwind plugin has been updated to support Tailwind v4, and it is
currently functioning well both in the repository's www directory and in
the initialized project which for test.

## --patch-1

### 1. Dependency Optimization
- Removed `cssnano` dependency, using Tailwind v4's built-in
optimization(Based on @csvn 's suggestion)
- Removed `autoprefixer` dependency
- Updated `tailwind-plugin` version number
### 2. Build Configuration Adjustments
- Added `--node-modules-dir` parameter to `/www` task for Tailwind v4
support (Based on @marvinhagemeister 's suggestion)
- Added `--allow-scripts` parameter to enable `@tailwindcss/oxide`
execution
### 3. Code Adaptation
- Modified Tailwind-related code in `/www` to support Tailwind v4
- Updated dependency configuration in `deno.json`
### 4. Feature Restoration
- Added `imagescript` and `astral` dependencies to restore screenshot
functionality lost in previous PR updates
- Fixed the issue where the `tailwind-plugin` dependency was incorrectly
pointing to the JSR package instead of the local repository source code
in previous PR.

## --patch-2
- Upgraded Tailwind CSS to the latest version.
- Removed unnecessary dependencies.
- Enabled CSS minification by default when Fresh is in production mode.
- Updated docs/canary/examples/migration-guide.md to support the new
Tailwind plugin format.
- Updated init/src/init.ts to support the new Tailwind version and
plugin version, use new `@import "tailwindcss"`, and generate the new
plugin format.
- Updated init/src/init_test.ts: tests now expect `css` to match
`/tailwindcss/` instead of `/@tailwind/`.
- Removed plugin-tailwindcss/src/types.ts as it is no longer needed, and
updated plugin-tailwindcss/src/mod.ts and www/dev.ts to support the new
format.

Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>

## --patch-3
Addressing @marvinhagemeister feedback, this patch reverts the
unintended loss of PR #2960's changes caused by merge conflicts.

## --patch-4

I initialized a project according to the migration documentation and
used @fresh/update to test whether the plugin works properly with
v2-alpha-34. The results show that it works fine.

- The plugin is published at
jsr:@freshpress/fresh-plugin-tailwind@0.0.1-alpha.8.

- The test project is published at
https://github.com/SisyphusZheng/fresh-project-test/tree/main/fresh-project.

# How Testing Was Conducted

## Local Environment Testing
1. Environment Cleanup
```bash
rm -rf ./.cache/deno deno.lock node_modules
```

2. Test Execution
```bash
deno task www
```

3. Result Verification
- Checked functionality in local `/www` environment
- Confirmed all features working properly

## Code Inspection
- Passed `deno task ok` check

## This forked /www website is hosted and running on GitHub Codespaces,
with support for the latest code changes. You can check it out at:
https://silver-trout-pjr4jw7xx5x9299x6-8000.app.github.dev/

---------

Co-authored-by: 李嘉图·M·路 <146103794+Ricardo-M-Zheng@users.noreply.github.com>
Co-authored-by: deno-deploy[bot] <75045203+deno-deploy[bot]@users.noreply.github.com>
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
2025-05-21 16:01:57 +02:00
Christian Svensson 17257dd1c2 test: use disposable tmp dirs (#2983)
Replaces the patterns below with consistent `AsyncDisposable` and `await
using` resource management for automatic cleanup.

- `await withTmpDir(async (dir) => { ... })` with `finally`
  - Makes code a bit flatter, and reduces callback-hell a bit
- `await Deno.makeTempDir()` + `Deno.remove()`
- `await Deno.makeTempDir()`

Helps be more consistent in removing temporary folders. Among others,
ensures temp folders are removed in the tests below:

- `src/build_cache_test.ts`
- `src/dev/builder_test.ts`
- `src/dev/dev_build_cache_test.ts`

## TODO's

The `Deno.makeTempDir()` method is still used by `buildProd` as well,
but this method is used in the top module scope, where it does not work
correctly with `Deno.test` (it runs before the test methods). I removed
this part from the PR and leave this for later to avoid making the PR
too big.

-
https://github.com/csvn/fresh/blob/test%2Fdisposable-tmp-dirs/tests/test_utils.tsx/#L64
-
https://github.com/csvn/fresh/blob/test%2Fdisposable-tmp-dirs/www/main_test.ts/#L7
2025-05-21 11:13:02 +02:00
Asher Gomez 8953650420 refactor(init): tidy up check task (#2976) 2025-05-19 11:04:52 +02:00
Asher Gomez cc93a1f469 tests(init): remove MockTTY (#2974)
These changes simplify implementation logic of the init workflow and
mock `prompt()` and `console()` functionality in a more direct manner.
This makes things easier to reason about by jumping through fewer mental
hoops.
2025-05-19 10:56:16 +02:00
Marvin Hagemeister 3900aa70d4 chore: release alpha 34 (#2967) 2025-05-16 21:36:12 +02:00
Marvin Hagemeister fa5aac5233 chore: fix formatting error in Deno 2.3.3 (#2965)
Upstream bug: https://github.com/denoland/deno/issues/29337
2025-05-16 21:09:34 +02:00
Matt NieldandMarvin Hagemeister 107c25b79a chore: Update links (#2956)
This commit updates several links which are outdated and now redirect to
different URLs on the updated Deno website and documentation.

There are a few dozen instances of URLs starting with
`https:://deno.land/x` and `https:://deno.land/std`. I left these alone
since they are dependencies. Would it make sense to update these from
the versions hosted at `deno.land` to their JSR equivalents, since that
is the new and preferred location of the Deno Standard Library packages
as well as other JavaScript/TypeScript packages used by Deno projects?

For example, the latest version of the Deno Standard Library is now
hosted at `https://jsr.io/@std` instead of `https://deno.land/std`.


![image](https://github.com/user-attachments/assets/7416da3b-3867-4d8f-9a1a-79e6a11ddb46)

---------

Co-authored-by: Marvin Hagemeister <hello@marvinh.dev>
2025-05-15 19:24:27 +02:00
Marvin Hagemeister f8d390e2c3 chore: release alpha 33 (#2949) 2025-05-14 23:25:08 +02:00
Marvin Hagemeister ffd7cdd0bd fix(init): fetch favicon from network like before (#2948)
Reverts back to fetching the favicon from the network. Copying assets
from JSR turns out to be difficult.

Fixes https://github.com/denoland/fresh/issues/2941
2025-05-14 23:20:42 +02:00
Marvin Hagemeister 638a98b106 chore: release alpha 32 (#2947) 2025-05-14 23:05:22 +02:00
Marvin Hagemeister 1957fd0ff6 fix(init): must use urls for asset copying (#2946)
Second attempt to fix https://github.com/denoland/fresh/pull/2943 .
Turns out that `import.meta.dirname` is `undefined` when served from
JSR. I'm not able to reproduce that error locally though.

Fixes https://github.com/denoland/fresh/pull/2943
2025-05-14 22:59:02 +02:00
Marvin Hagemeister 74d5c0f98f chore: release alpha.31 (#2945) 2025-05-14 22:50:25 +02:00
Marvin Hagemeister 4fc1a2b92e fix(init): include favicon.ico in init package (#2943)
Fixes a regression introduced by
https://github.com/denoland/fresh/pull/2867

Fixes https://github.com/denoland/fresh/issues/2941
2025-05-14 22:38:10 +02:00
Marvin Hagemeister c3095f38c4 chore: release 2.0.0-alpha.30 (#2939) 2025-05-14 10:55:47 +02:00
Asher Gomez 84a03ee66c chore(init): cleanup twind options (#2868)
These values are no longer used.
2025-05-12 23:29:17 +02:00
Marvin Hagemeister a49fc3796f chore: ignore check fmt on canary (#2925)
Ignore checking formatting on canary as the formatting might be
different from stable releases of Deno.
2025-05-12 20:30:17 +02:00
Christian Svensson d10ea5a89a fix: remove unnecessary config property in init script (#2915)
From what I can see, `fsRoutes` uses the `FreshConfig.root` option by
default, so this property does not need to be specified. I also added
some JSDoc for the `dir` option in `fsRoutes()` as I understood it's
purpose.
2025-05-12 09:42:16 +02:00
Asher Gomez 54d18d8bca tests: fix leaks, macOS hangs and utility cleanups (#2897)
1. Upgrades `@astral/astral`
2. Fixes test leaks
3. Fixes `@fresh/init` test hangs
4. Simplifies and cleans up test utilities
2025-05-07 10:53:42 +02:00
Asher Gomez 45ce7e3ac0 chore: add doc checker (#2877)
First steps towards #2876
Depends on https://github.com/denoland/std/pull/6632
2025-05-02 10:55:55 +02:00
Asher Gomez d077130b05 refactor(init): avoid network request for downloading of favicon (#2867) 2025-04-28 15:10:03 +02:00