Commit Graph
346 Commits
Author SHA1 Message Date
Igor Brasileiro e7bf6aca62 fix: Prevent update doc title from partial if not present (#2244)
fixes #2243
2024-01-12 18:47:40 +01:00
Reed von Redwitz ca8338e04d chore: bump std to 0.211.0 and loader to 0.8.3 (#2241) 2024-01-11 15:54:41 +01:00
Marvin Hagemeister d2e9ee99a2 fix: browser url not updated with form partials (#2236)
Fixes https://github.com/denoland/fresh/issues/2173
2024-01-10 15:36:30 +01:00
Marvin Hagemeister 912f3782a3 feat: improve tailwind deployment flow (#2227)
By moving folks from `twind` over to the `tailwind` plugin we have
traded support questions about "how to get twind autocompletion
working?" with "my styles are not showing up in automatic mode". The
tailwind plugin has a hard requirement on having a build step. We have
documented this at various places and have a guide on how to set
everything up, but it's much better if we float those steps from Fresh
itself when we detect this.

With this PR we will prepare a `.github/workflows/deploy.yml` file
already where the user only needs to swap out the project name.

When Fresh is started in production mode, the tailwind plugin is active
and no snapshot files were loaded, then we print a helpful hint to the
console:

```sh
No pre-compiled tailwind styles found.

Did you forget to run "deno task build" prior to starting the production server?
```

When we are running inside Deno Deploy this PR goes one step further.
Since it is the first time many users might use Deno Deploy we'll also
show a simple page that shows how to finish the tailwind setup. I've
intentionally tried to not present this as a warning but rather as a
"finishing" step to avoid scaring users off. It's not the prettiest
page, but it's good enough for now.

<img width="892" alt="Screenshot 2024-01-09 at 23 41 27"
src="https://github.com/denoland/fresh/assets/1062408/9bf2a61b-5551-4d8e-bdf8-b498072f8e98">


Fixes https://github.com/denoland/fresh/issues/2223
2024-01-10 10:35:26 +01:00
Marvin Hagemeister f63752062a chore: change assert to with for import attributes (#2231) 2024-01-10 10:25:07 +01:00
Marvin Hagemeister 598237d5dd fix: json import attribute error in island (#2228)
Fixes https://github.com/denoland/fresh/issues/2214
2024-01-10 00:33:38 +01:00
Marvin Hagemeister 8c4385043c Revert "refactor: use --env CLI arg" (#2212)
Reverts denoland/fresh#2204

The `--env` flag cannot be used by default because it fails when no
`.env` file is present. Therefore this PR accidentally introduced a
breaking change.
2024-01-04 11:53:15 +01:00
Asher Gomez 99eb5435bb refactor: use --env CLI arg (#2204)
This change replaces the use of the Standard Library's `dotenv.load()`
with the native `--env` CLI flag.

The benefits include:
* One less dependency
* More obvious consumption of the `.env` file in the CLI output
2023-12-29 10:47:15 +01:00
Marvin Hagemeister 498aa8c463 fix: don't fallthrough static files in dev (#2156) 2023-12-07 12:23:23 +01:00
Marvin Hagemeister c72f534369 fix: route param fallback not empty string (#2146) 2023-12-06 09:33:36 +01:00
Marvin Hagemeister c05a6b1496 fix: tailwind build not creating subfolders (#2145) 2023-12-06 08:57:31 +01:00
Reed von Redwitz 7465dbd978 feat(init): task to generate manifest file (#1422) 2023-12-05 15:03:37 +01:00
Reed von Redwitz 60b2198d13 fix: tailwind now respects basepath (#2138) 2023-12-05 13:13:33 +01:00
Reed von Redwitz c8844ad98c fix: PluginRoute supports AsyncRoute and AsyncLayout (#2139) 2023-12-04 16:56:00 +01:00
Christian SvenssonandMarvin Hagemeister 96644f5e22 fix: remove error frame HTML for non-dev mode (#2133)
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
2023-12-04 11:14:11 +00:00
Christian SvenssonandMarvin Hagemeister c4e09d1cef fix: use real 500 error page in dev mode (#2134)
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
2023-12-04 12:06:06 +01:00
迷渡andMarvin Hagemeister 87d1f2356a chore: Use satisfies instead of as (#2136)
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
2023-12-04 11:38:52 +01:00
Reed von Redwitz 35da45bff1 chore: update types in tests, init, update (#2122)
Of particular note is the change to
`tests/fixture_plugin/routes/test.tsx`. Note how I do this:
```diff
-  async GET(_req, ctx: HandlerContext<unknown, { test: string }>) {
+  async GET(_req, ctx: FreshContext<{ test: string }, unknown>) {
```

I find it strange and confusing that the order of the type parameters
has "changed". This makes it impossible to do a simple search and
replace, because people now have to change order as well.

Most of the types have been declared as `<T, S>`, i.e. data before
state:
* `PageProps<T = any, S = Record<string, unknown>>`
* `RouteContext<T = any, S = Record<string, unknown>>`
* `Handler<T = any, State = Record<string, unknown>>`
* `Handlers<T = any, State = Record<string, unknown>> `
* `AsyncRoute<T = any, S = Record<string, unknown>>`
* `PageComponent<T = any, S = Record<string, unknown>> `
* `AsyncLayout<T = any, S = Record<string, unknown>>`

And then `FreshContext` comes around like 
```
export interface FreshContext<
  State = Record<string, unknown>,
  // deno-lint-ignore no-explicit-any
  Data = any,
  NotFoundData = Data,
>
```
and switches it all up.

Not a huge issue, but just something to be aware of that others might
report.
2023-12-02 10:33:59 +01:00
Marvin Hagemeister 2acf72d512 fix: tailwind failing on non-existant files (#2118) 2023-12-01 23:38:22 +01:00
Marvin Hagemeister bd372b9535 fix: errors in plugin fixture + improve island docs (#2109) 2023-12-01 12:21:10 +01:00
Marvin Hagemeister 054ffbb44a fix: dots in island + route name not working (#2105) 2023-11-30 18:14:59 +01:00
Reed von Redwitz a0483bc357 chore: create manifest generation task (#2088) 2023-11-30 17:07:00 +01:00
Marvin Hagemeister 9e11c5c56b feat: expose config in context + simplify page props (#2102) 2023-11-30 16:11:31 +01:00
Marvin Hagemeister 8ddc21eb90 Router cleanup (#2099) 2023-11-30 14:08:05 +01:00
Marvin Hagemeister daf8ca19d2 chore: fix twind test (#2100) 2023-11-30 13:18:19 +01:00
Reed von RedwitzandMarvin Hagemeister 9ab8651018 feat(server): Add basePath config to host from a directory (#2092)
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
2023-11-29 16:44:25 +00:00
Marvin Hagemeister fe792455ab fix: add missing -h/--help to init (#2096) 2023-11-29 16:57:39 +01:00
Marvin Hagemeister a0ede4fe67 fix: incorrect path matching in tailwind plugin (#2094) 2023-11-29 16:37:54 +01:00
Reed von RedwitzandMarvin Hagemeister ad33501692 chore: remove $fresh from import statements (#2079)
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
2023-11-28 16:43:50 +00:00
Reed von RedwitzandMarvin Hagemeister b902205feb chore: bump std to 208 and deal with deprecations (#2081)
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
2023-11-28 16:35:26 +00:00
Marvin Hagemeister 325850719a feat: reduce number of island bundles (#2082) 2023-11-28 17:23:27 +01:00
Marvin Hagemeister 9ee6ab72e0 fix: show original error page in dev (#2074) 2023-11-28 11:58:50 +01:00
Marvin Hagemeister a56ea283c8 fix: Partials not working on error pages (#2072) 2023-11-27 16:56:46 +01:00
Marvin Hagemeister 1294d455bc fix: client script source map returning 404 (#2071) 2023-11-27 16:10:36 +01:00
Marvin Hagemeister 9d5e916e4c fix: invalid identifier in manifest (#2070) 2023-11-27 11:20:40 +01:00
Reed von Redwitz 72edafde46 feat(server): plugins can create islands (#1472) 2023-11-22 11:19:13 +01:00
Reed von Redwitz ad2341dada chore: switch init to use tailwind (#2061) 2023-11-22 11:17:42 +01:00
Marvin Hagemeister bb035ae8da docs: port over to TailwindCSS (#2058) 2023-11-22 11:12:21 +01:00
Marvin Hagemeister f105f19005 fix: tailwind don't magically add content regex (#2060) 2023-11-21 20:59:02 +01:00
Marvin Hagemeister 1f8f9b7ec7 feat: minify tailwind css in prod + other enhancements (#2059) 2023-11-21 18:57:24 +01:00
Marvin Hagemeister 93e4b7e9b7 feat: add native TailwindCSS plugin (#2056) 2023-11-21 17:22:18 +01:00
Marvin Hagemeister daf15aee6f feat: add plugin configResolved (#2055) 2023-11-21 15:39:17 +01:00
Marvin Hagemeister 27adeb7b14 fix: redirects with partials (#2053) 2023-11-21 11:35:08 +01:00
Marvin Hagemeister 7578e50ee3 docs: fix regression in navigation (#2047) 2023-11-16 10:38:13 +01:00
Craig Doremus b5816cd001 feat(tests): add fresh-testing-library tests (#1990) 2023-11-15 18:25:13 +01:00
Marvin Hagemeister 6618ac6b6b chore: update Preact (#2038) 2023-11-15 11:12:58 +01:00
Marvin Hagemeister 0961e775db feat: add support for jsx precompile (#2035) 2023-11-13 12:06:55 +01:00
Marvin HagemeisterandAdam Gregory 7ff2781fcd feat: allow plugins to modify HTML body (#2022)
Based on https://github.com/denoland/fresh/pull/1769 . Mostly added a
test.

---------

Co-authored-by: Adam Gregory <adam@aguilaengineering.com>
2023-11-10 13:59:41 +01:00
Adam Gregory 14cecc0a6f Allow plugin render hooks to add link tags to the page (#1963)
Adds an extra optional property to plugin render results to allow
plugins to add `<link>` tags to the page.
2023-11-08 23:51:14 +01:00
Reed von RedwitzandMarvin Hagemeister 536463775c feat(dev): reduce manifest merge conflict potential (#2020)
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
2023-11-08 09:59:27 +01:00