Commit Graph
108 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
Marvin Hagemeister ff34ec8342 chore: lift dependency to deno.json + update esbuild (#3142) 2025-07-25 19:01:28 +02:00
Marvin Hagemeister d573622a40 feat: add separate tailwindcss v3 plugin (#3135)
Makes it easier to keep using tailwindcss v3 with newer Fresh versions.
2025-07-25 10:27:22 +02:00
Marvin Hagemeister 76002fef0e chore: release 2.0.0-alpha.46 (#3134) 2025-07-25 08:40:06 +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 211af4e3c8 fix(update): rewrite ctx.renderNotFound() (#3126)
Fixes https://github.com/denoland/fresh/issues/3026
2025-07-24 16:10:08 +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
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 713c85c12d chore: release 2.0.0-alpha.39 (#3097) 2025-07-16 13:43:31 +02:00
Marvin Hagemeister ccb621d2a3 chore: release 2.0.0-alpha.38 (#3095) 2025-07-14 18:19:03 +02:00
Marvin Hagemeister db412053df fix: wasm allocation issue (#3094)
Fix is included in upstream `@deno/loader` that's used in our esbuild
plugin, see https://github.com/denoland/deno-js-loader/pull/22
2025-07-14 18:15:39 +02:00
Asher Gomez 3e211dc7ec fix: import current version of fresh (#3020)
Previously, all packages except `@fresh/core` and even some tests
might've imported `jsr:@fresh/core@^2.0.0-alpha.29` rather than the
latest version of Fresh. This PR fixes that.
2025-07-09 11:03:47 +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
Marvin Hagemeister 85d22e0bb0 fix(core): move to new esbuild deno plugin (#3034)
Move to the new esbuild plugin that leverages `@deno/loader` under the
hood. This is based on the exact same rust crates that Deno itself uses
to do resolution, instead of doing it's own resolution.
2025-06-18 10:42:47 +02:00
Asher Gomez c2b0fe3568 test(www): use @std/expect instead of @std/assert (#3046)
Aligns screenshot tests to the rest of the codebase by using
`@std/expect` instead of `@std/assert`.
2025-06-17 13:50:54 +02:00
75897de196 chore: add tests for fresh/compat imports (#3036)
- `fresh/compat - defineFn mixed return types` - Tests all supported
return types (Response, VNode, null) with both sync and async handlers,
including FreshContext parameter usage

- `fresh/compat - multiple compat imports` - Tests importing multiple
compat functions simultaneously

close #3025 

--patch-1
try to use deno/std Api to replace

--patch-2
make it simple and clean

--patch-3
Convert update_test.ts to .tsx for JSX support
Use static imports instead of dynamic imports for better performance
Switch from @std/assert to @std/expect for consistency
Use ReturnType<> for automatic type inference instead of manual type
definitions

Sincerely grateful to @iuioiua for the guidance and patience.

---------

Co-authored-by: 李嘉图·M·路 <146103794+Ricardo-M-Zheng@users.noreply.github.com>
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
2025-06-17 13:06:21 +02:00
zhizhengand李嘉图·M·路 dd1721bce6 chore: refactor sreenshot and add test (#3032)
- Refactor screenshot functionality into testable utility functions
- Add comprehensive test suite to catch regressions early
- Ensure functionality doesn't break unexpectedly without notification

--patch-1
based on review, make throw error naturally

---------

Co-authored-by: 李嘉图·M·路 <146103794+Ricardo-M-Zheng@users.noreply.github.com>
2025-06-13 20:39:10 +02:00
zhizhengand李嘉图·M·路 e9cb6486c8 feat(update): use std lib to replace the custom processbar (#3027)
- The constructor of the process-bar in the currently used std/cli
differs from that of the latest version, so the relevant dependencies
have been updated.

- The custom processbar has been replaced with the std lib, and
customization has been carried out to meet the current scenario.

In test env, seem like: 

![bb2868ed3911071ce9915a9c8662786](https://github.com/user-attachments/assets/e4419965-40fc-4ad8-8647-74e30c75ea98)

close #3021

---------

Co-authored-by: 李嘉图·M·路 <146103794+Ricardo-M-Zheng@users.noreply.github.com>
2025-06-12 12:32:09 +02:00
zhizhengand李嘉图·M·路 cb402b9839 fix(utils): restore missing dependencies for screenshot utility (#3016)
The relevant dependencies were lost in previous cleanups. This situation
caused the screenshot function to fail.

This PR properly cleans up the functional function and restores its
operation.

---------

Co-authored-by: 李嘉图·M·路 <146103794+Ricardo-M-Zheng@users.noreply.github.com>
2025-06-11 17:47:57 +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
Asher GomezandMarvin Hagemeister da8879dede tests: use the same browser instance across tests and better use explicit resource management (#2901)
On my machine, reduces time taken to perform `deno task test` from
~1m20s to ~30s.

Inspired by and supersedes #2110.

---------

Co-authored-by: Marvin Hagemeister <marvin@deno.com>
2025-05-21 11:32:18 +02:00
Christian Svensson db142115ec feat: support automatic workspace detection in Dev (#2985)
Adds support for [Automatic Workspace
Detection](https://chromium.googlesource.com/devtools/devtools-frontend/+/main/docs/ecosystem/automatic_workspace_folders.md).

- Avoids 404's or middleware logging when this feature is active (e.g.
Chrome/Edge with DevTools open)
- Generates the same UUID based on root folder path (without writing
anything to disk)
- The middleware is lazy and does nothing until the path is opened for
`com.chrome.devtools.json`
2025-05-21 11:09:43 +02:00
Asher Gomez b8c75ec0e3 chore: update dependencies (#2975)
Updates relating to Tailwind CSS v4 can be handled in #2903 or #2829.
2025-05-19 13:17:53 +02:00
Asher Gomez 144ed2e75c refactor(core): minor fresh/compat cleanups (#2880) 2025-05-19 12:05:22 +02:00
Asher Gomez 3776ef3154 refactor: centralise imports and cleanup exports (#2900)
The benefits of these changes are:
1. Managing and updating dependencies is easier. One only needs to run
`deno outdated` at the root, instead of in each workspace.
2. The versions of dependencies across workspaces is kept consistent.

Closes #2788
2025-05-19 09:41:06 +02:00
Marvin Hagemeister 3900aa70d4 chore: release alpha 34 (#2967) 2025-05-16 21:36:12 +02:00
Marvin Hagemeister 6ff0becd0a fix: duplicate @preact/signals version (#2964)
We initialized new projects with `@preact/signals@2.x` but Fresh itself
was using `1.x`. There shall only ever be one version.

Kinda makes me wish Deno had some sort of `peerDependencies`.

Fixes https://github.com/denoland/fresh/issues/2962
2025-05-16 21:23:53 +02:00
Asher Gomez 20162f6896 chore: use lint tags (#2952) 2025-05-15 09:34:46 +02:00
Marvin Hagemeister f8d390e2c3 chore: release alpha 33 (#2949) 2025-05-14 23:25:08 +02:00
Marvin Hagemeister 638a98b106 chore: release alpha 32 (#2947) 2025-05-14 23:05:22 +02:00
Marvin Hagemeister 74d5c0f98f chore: release alpha.31 (#2945) 2025-05-14 22:50:25 +02:00
Asher Gomez 7728e1cb52 chore(core): simplify tasks (#2892) 2025-05-14 13:27:13 +02:00
Marvin Hagemeister c3095f38c4 chore: release 2.0.0-alpha.30 (#2939) 2025-05-14 10:55:47 +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 7aec5a268e refactor(core): standardize HttpError (#2858)
- Now extends `Error`, so that it satisfies `instanceof Error`
operations.
- Narrows the `status` property to be an actual HTTP status code.
- Outsources default evaluation of the `message` property to
`@std/http/status`, which already implements this functionality.
- Brings the `stack` property to the class, regardless of its status,
which seems like a needless constraint.
2025-04-27 20:01:31 +02:00
Marvin Hagemeister 65c05b2127 2.0.0-alpha.29 (#2812) 2025-01-16 22:43:40 +01:00
Marvin Hagemeister c7c341b695 2.0.0-alpha.28 (#2810) 2025-01-16 14:24:07 +01:00