Commit Graph
492 Commits
Author SHA1 Message Date
Marvin Hagemeister 72811da29b fix: etag caching HTTP headers (#2504) 2024-06-25 10:21:43 +02:00
Marvin Hagemeister 0f6b4f624f chore: remove debug trace logs (#2545) 2024-06-25 10:08:48 +02:00
Marvin Hagemeister 49839079a4 Fix: static file processed twice if outdir inside static dir (#2543)
Fixes https://github.com/denoland/fresh/issues/2541
2024-06-24 18:13:28 +02:00
Reed von Redwitz a560c17e7b feat: add default GET handler (#2542)
closes https://github.com/denoland/fresh/issues/2530
2024-06-24 15:04:21 +02:00
Reed von Redwitz deeccd7e25 feat: add example of define.middleware to init (#2534)
The documentation for `MiddlewareFn` is out of date, because it
references a nonexistent `defineMiddleware` function. It's been updated
to reference the correct `define.middleware` function.

Additionally, I included an example of using this in the init project. I
also complicated the usage of `app.get` so that the function actually
uses the context. To make it clear to users of fresh 1 that this can be
equivalent to a file-based-route, I've included such a route as well.

The two new examples in `maini.ts` should make it much more clear to
fresh 1 users how the new system can work.
2024-06-23 22:46:04 +02:00
Reed von Redwitz 0962a94a11 chore: cleanup unused exported interfaces (#2535) 2024-06-23 22:45:14 +02:00
Reed von Redwitz 27578bc038 chore: fix some typos (#2528) 2024-06-23 17:42:29 +02:00
Marvin Hagemeister 003f2bbb5f fix: incorrect partial url on backwards navigation (#2510) 2024-06-08 09:01:12 +02:00
Adam Gregory 8c5e2b00c9 fix: Include submitter data in partial form data (#2307)
Fixes #2306
2024-06-06 19:02:49 +02:00
Luca Casonato c3ec742a65 feat: import fresh from fresh (#2479)
Instead of importing as `@fresh/core`.
2024-06-05 14:51:35 +02:00
Marvin Hagemeister 19d3e452ac fix: bring back island module preloading (#2503) 2024-06-05 14:41:02 +02:00
Marvin Hagemeister 3fe988893d fix: don't show "fresh ready" log in prod (#2500) 2024-06-05 10:21:12 +02:00
Marvin Hagemeister 2b88f4bf56 fix: falsy f-* attributes not preserved inside island (#2498)
Fixes https://github.com/denoland/fresh/issues/2359
2024-06-05 10:06:53 +02:00
Marvin Hagemeister fba3f2b845 fix: partial form redirect not working (#2497)
Fixes https://github.com/denoland/fresh/issues/2404
2024-06-05 09:42:27 +02:00
Marvin Hagemeister d613c6a6ba fix: islands not working with basePath (#2496) 2024-06-05 09:02:27 +02:00
Marvin Hagemeister f8b60ddd15 fix: wrong url after partial form submission (#2495)
Fixes https://github.com/denoland/fresh/issues/2409
2024-06-05 08:30:28 +02:00
Marvin Hagemeister e007597ff3 feat: remove MODE global (#2483) 2024-06-03 16:54:37 +02:00
Luca Casonato aa19b393e7 feat: export compat types from /compat export (#2478) 2024-06-03 14:32:38 +00:00
Marvin Hagemeister 2fb8606e9e fix: path handling inconsistencies (#2482) 2024-06-03 15:03:48 +02:00
Marvin Hagemeister 9347b84cba feat: inject process.env.NODE_ENV for third party libs (#2481) 2024-05-31 15:18:23 +02:00
Marvin Hagemeister 88c3671a09 fix: error handling in fs routes (#2474)
Ran into an issue where we weren't responding with the correct status
code and passed response headers. This was a bit of a rabbit hole and it
was caused by us wrapping to more error handling middlewares than
necessary.
2024-05-31 14:27:36 +02:00
Luca Casonato 8d85945da6 fix: remove Data from FreshContext (#2473)
This is now only on `PageProps`.
2024-05-31 13:50:28 +02:00
Luca Casonato dc283a137b fix: remove @fresh/core/client export (#2477)
These files are now referenced with https URLs.
2024-05-29 12:20:57 +02:00
Luca Casonato 4fab47357f tests: wait for esbuild to shut down (#2476) 2024-05-27 20:03:48 +02:00
Luca CasonatoandMarvin Hagemeister d06dad5be6 tests: don't disable all the sanitizers (#2472)
The tests also pass with them enabled for me.

---------

Co-authored-by: Marvin Hagemeister <marvin@deno.com>
2024-05-27 15:00:40 +02:00
Marvin Hagemeister bd60444f7c fix: only generate stack on HttpError if status >= 500 (#2470) 2024-05-27 14:34:36 +02:00
Marvin Hagemeister f9545c3d63 fix: don't show error overlay on HttpError < 500 (#2462) 2024-05-24 23:46:21 +02:00
Marvin Hagemeister 9a7399a769 chore: disable sanitizers in esbuild tests (#2461) 2024-05-24 20:39:54 +02:00
Marvin Hagemeister 77dc77826e fix: only load error overlay in development (#2460) 2024-05-24 20:29:59 +02:00
Luca Casonato f2162d24bf feat: add render function (#2454) 2024-05-24 18:31:34 +02:00
Luca Casonato c9f0ccdce7 feat: rename helpers to define (#2453) 2024-05-24 11:48:32 +02:00
Marvin Hagemeister 287929e4d2 major: import Fresh 2.0 code (#2449)
🎉
2024-05-24 09:40:08 +02:00
Marvin Hagemeister e4981d30ad www: rework docs layout (#2429)
- Re-enable partials
- clean up layout a bit
2024-05-21 17:38:32 +02:00
Marcos Candeia 9404787c85 feat: Support startServer for unix domain sockets (#2392)
Signed-off-by: Marcos Candeia <marrcooos@gmail.com>
2024-05-02 20:45:10 +02:00
Marvin Hagemeister 40181142d2 fix: ServerhandlerInfo type for newer Deno versions (#2419)
Newer Deno versions have an additional `completed` property in there.
This PR allows Fresh to be used with both old and newer Deno versions
without getting type errors.
2024-05-02 20:41:33 +02:00
Asher Gomez 425032a6dc chore: minor cleanups (#2393)
These changes occur by just running `deno task ok` on `main`.
2024-04-08 13:08:41 +02:00
Bedis Nbiba 1d69f167ee chore: satisfy use-import-type lint (biomejs) (#2389)
https://biomejs.dev/linter/rules/use-import-type/

From that page the argument is 

>The rule ensures that all imports used only as a type use a type-only
import. It also groups inline type imports into a grouped import type.
2024-03-27 08:00:14 +01:00
Luca CasonatoandMarvin Hagemeister 29d582c987 chore: update ahead-of-time build docs for Deno Deploy (#2381)
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
2024-03-22 22:19:17 +01:00
Adam Gregory 9cf838684e fix: Add closing quote for nonce in inline partial script (#2377)
Fixes #2376
2024-03-21 19:32:53 +01:00
Marvin Hagemeister 240252fdb4 Revert "feat: add ctx.redirect() helper (#2358)" (#2372)
Mostly so that it's easier to cut the next patch release for Fresh.

This reverts commit e3508c3054.
2024-03-21 10:27:53 +01:00
Luca Casonato c797716a56 chore: update to esbuild-deno-loader@0.10.2 and esbuild@0.20.2 (#2366) 2024-03-21 08:13:01 +00:00
Marvin Hagemeister e3508c3054 feat: add ctx.redirect() helper (#2358)
This PR adds a `ctx.redirect(path, status)` helper that aims to reduce
the verbosity of having to manually create a `Response` obejct for a
mere redirect.

```ts
// Before
new Response(null, {
  status: 307,
  headers: {
    Location: "/foo/bar"
  },
})

// After
ctx.redirect("/foo/bar", 307)
```

If the second parameter is not passed, it will default to `302`.
2024-03-12 17:36:34 +01:00
Michael Gearhardt 671751d572 fix: $fresh ref in import sources (#2340)
There was an issue with the tailwind error page being pulled in by ref
to $fresh, fixed so now it just uses the file
2024-03-12 12:14:23 +01:00
Reed von Redwitz 5ec06350e2 fix: allow multiple set-cookie headers to be set before render (#2357)
closes #2346

The primary issue was the snippet `headers[key] = value`. This caused
only one `set-cookie` to make it through. Switching to a `Headers`
object allowed me to use `append` when appropriate, allowing for
multiple `set-cookie` entries.

I also cleaned up one of the tests to make use of steps, because I
originally broke it and couldn't immediately tell which part was
failing.
2024-03-12 12:04:42 +01:00
Marvin Hagemeister b7281792a0 chore: update deno_esbuild_loader to 0.9.0 (#2337)
Fixes https://github.com/denoland/fresh/issues/2332
2024-02-23 13:31:00 +01:00
Reed von Redwitz 8f3031317b fix: properly prefix all scripts with base path (#2334)
closes https://github.com/denoland/fresh/issues/2326

There was a big misunderstanding on my part -- in particular that a
different server might be listening at the root, so the redirect built
into `context.ts` will never happen. The existing test (as mentioned in
the issue) passes, but only because no one else is listening, and fresh
is able to perform the redirect.

I briefly considered writing a docker container to orchestrate this
properly, but then I didn't want to have docker running in order to run
these tests. (My laptop is old and bad.) So instead the two new tests
very thoroughly assert that scripts included in the html are properly
prefixed with the base path. And yes, they fail if the fix is reverted.

As for the fix itself: I just needed to prepend the asset URL with the
base path.
2024-02-23 13:30:42 +01:00
Marvin Hagemeister a2be1abc6b chore: update Preact to 10.19.6 (#2331) 2024-02-22 10:46:41 +01:00
Marvin Hagemeister f1c17bc67e fix: invalid quote around partial script data (#2323)
This is a little emberassing 👀
2024-02-20 01:07:51 +01:00
William Weiss 0fc83be54b startServer onListen logs https when key & cert specified (#2321)
Some team members of mine were confused by the default output 

```
 🍋 Fresh ready
    Local: http://localhost:8000/
```

when the server is actually running HTTPS. This should now print

```
 🍋 Fresh ready
    Local: https://localhost:8000/
```

when a key and cert are specified.
2024-02-19 15:14:20 +01:00
Reed von Redwitz 82c75f85e9 fix: update dependency recommendations (#2320)
closes https://github.com/denoland/fresh/issues/2319

The issue is because `imports.ts` wasn't changed before releasing. I
thought I would go through and bump some other versions as well. This
handles everything except the esbuild stuff and `tests/`.
2024-02-19 10:33:04 +01:00