From fe2c95cc25fada5cddd732360886cf5ba84625ce Mon Sep 17 00:00:00 2001
From: Marvin Hagemeister
Date: Tue, 10 Oct 2023 18:08:44 +0200
Subject: [PATCH] chore: release 1.5.0 (#1899)
---
docs/canary/concepts/app-wrapper.md | 106 ---------------
docs/canary/concepts/updating.md | 128 ------------------
docs/canary/examples/modifying-the-head.md | 79 -----------
docs/{canary => latest}/concepts/partials.md | 0
docs/latest/concepts/updating.md | 2 +-
.../examples/active-links.md | 0
docs/latest/examples/modifying-the-head.md | 41 ++++++
docs/toc.ts | 12 +-
versions.json | 1 +
9 files changed, 50 insertions(+), 319 deletions(-)
delete mode 100644 docs/canary/concepts/app-wrapper.md
delete mode 100644 docs/canary/concepts/updating.md
delete mode 100644 docs/canary/examples/modifying-the-head.md
rename docs/{canary => latest}/concepts/partials.md (100%)
rename docs/{canary => latest}/examples/active-links.md (100%)
diff --git a/docs/canary/concepts/app-wrapper.md b/docs/canary/concepts/app-wrapper.md
deleted file mode 100644
index 13b51ff3..00000000
--- a/docs/canary/concepts/app-wrapper.md
+++ /dev/null
@@ -1,106 +0,0 @@
----
-description: |
- Add a global app wrapper to provide common meta tags or context for application routes.
----
-
-An app wrapper is defined in an `_app.tsx` file in `routes/` folder and is
-typically used to create the outer structure of an HTML document. It must
-contain a default export that is a regular Preact component. Only one such
-wrapper is allowed per application.
-
-The component to be wrapped is received via props, in addition to a few other
-things. This allows for the introduction of a global container functioning as a
-template which can be conditioned based on state and params. Note that any state
-set by middleware is available via `props.state`.
-
-```tsx routes/_app.tsx
-import { AppProps } from "$fresh/server.ts";
-
-export default function App({ Component, state }: AppProps) {
- // do something with state here
- return (
-
-
-
-
- My Fresh app
-
-
-
-
-
- );
-}
-```
-
-## Async app wrapper
-
-Similar to routes and layouts, the app wrapper can be made asynchronous. This
-changes the function signature so that the first argument is the `Request`
-instance and the second one is the `AppContext`.
-
-```tsx routes/_app.tsx
-import { AppContext } from "$fresh/server.ts";
-
-export default async function App(req: Request, ctx: AppContext) {
- const data = await loadData();
-
- return (
-
-
-
-
- My Fresh app
-
-
-
Hello {data.name}
-
-
-
- );
-}
-```
-
-### Define helper
-
-To make it quicker to type the async app wrapper, Fresh includes a `defineApp`
-helper which already infers the correct types for you.
-
-```tsx routes/_app.tsx
-import { defineApp } from "$fresh/server.ts";
-
-export default defineApp(async (req, ctx) => {
- const data = await loadData();
-
- return (
-
-
-
-
- My Fresh app
-
-
-
Hello {data.name}
-
-
-
- );
-});
-```
-
-## Disabling the app wrapper
-
-Rendering the app wrapper can be skipped on a route or layout basis. To do that,
-set `skipAppWrapper: true` to the layout or route config.
-
-```tsx routes/my-special-route.tsx
-import { RouteConfig } from "$fresh/server.ts";
-
-export const config: RouteConfig = {
- skipAppWrapper: true, // Skip the app wrapper during rendering
-};
-
-export default function Page() {
- // ...
-}
-```
diff --git a/docs/canary/concepts/updating.md b/docs/canary/concepts/updating.md
deleted file mode 100644
index b3ae1daa..00000000
--- a/docs/canary/concepts/updating.md
+++ /dev/null
@@ -1,128 +0,0 @@
----
-description: |
- New versions of Fresh are regularly released. This page explains how to update your project.
----
-
-Fresh consists of multiple pieces which are independently versioned and
-released.
-
-- Fresh (https://deno.land/x/fresh)
-- Preact (https://esm.sh/preact)
-- preact-render-to-string (https://esm.sh/preact-render-to-string)
-
-Some plugins also have their own dependencies that can be updated independently.
-
-- Twind (https://esm.sh/twind) (for the twind plugin)
-
-For the most part these pieces can be updated independently. Certain versions of
-Fresh may require a minimum version of a given dependency. This is documented
-below.
-
-| Fresh version | Preact | preact-render-to-string | Deno |
-| ------------- | ----------------- | ----------------------- | --------- |
-| 1.0.0-1.0.2 | >=10.8.1 <11.0.0 | >=5.2.0 <6.0.0 | >= 1.23.0 |
-| 1.1.0-1.1.5 | >=10.8.1 <11.0.0 | >=5.2.0 <6.0.0 | >= 1.25.0 |
-| 1.2.0 | >=10.15.0 <11.0.0 | >=6.1.0 | >= 1.25.0 |
-
-## Updating dependencies
-
-To update your dependencies, you have two options:
-
-- Run the Fresh updater to update your project dependencies.
-- Manually update the dependency versions in your `deno.json` file.
-
-### Auto updater
-
-The auto updater is a command line tool that will update your project's
-`deno.json` file to the latest versions of Fresh and its dependencies. It may
-also contain code mods for your project that will update your code to the latest
-recommended patterns for Fresh projects.
-
-To run the auto updater, run the following command from the root of your
-project:
-
-```sh Terminal
-$ deno run -A -r https://fresh.deno.dev/update
-```
-
-You will be prompted to confirm the changes that will be made to your project.
-
-### Manual update
-
-To manually update your project's dependencies, you can edit the `deno.json`
-file in the root of your projects directory. Dependency versions are encoded
-into the URLs in this file. For example, here is how to update a project from
-Fresh 1.0.2 to 1.1.3, and update Preact to the latest version:
-
-```diff deno.json
- {
- "imports": {
-- "$fresh/": "https://deno.land/x/fresh@1.0.2/",
-+ "$fresh/": "https://deno.land/x/fresh@1.1.5/",
-
-- "preact": "https://esm.sh/preact@10.8.1",
-- "preact/": "https://esm.sh/preact@10.8.1/",
-+ "preact": "https://esm.sh/preact@10.11.0",
-+ "preact/": "https://esm.sh/preact@10.11.0/",
-
-- "preact-render-to-string": "https://esm.sh/*preact-render-to-string@5.2.0",
-+ "preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.1.0",
-
- "twind": "https://esm.sh/twind@0.16.17",
- "twind/": "https://esm.sh/twind@0.16.17/"
- }
- }
-```
-
-## Automatic update checks
-
-Fresh will periodically check if a new Fresh version is available if it's
-running outside of CI. This happens once per day and can be disabled by setting
-the `FRESH_NO_UPDATE_CHECK=true` environment variable.
-
-## Code mods
-
-Code mods are small scripts that can be run to update your project's code to
-match the latest recommended patterns for Fresh projects. Code mods can be run
-through the auto updater. Sometimes the code mod can not cover all cases, so you
-may need to manually update some code. This section explains the code mods
-currently available.
-
-### Classical JSX -> Automatic JSX
-
-> This code mod is only available in Fresh 1.1.0 and above.
-
-The classical JSX transform that relies on a `/** @jsx h */` pragma is no longer
-the recommended way to use JSX in Fresh projects. Instead, starting with version
-1.1.0, Fresh projects should use the automatic JSX transform that requires no
-JSX pragma or preact import.
-
-```diff
-- /** @jsx h */
-- import { h } from "preact";
-
- export default function Page() {
- return
Hello world!
;
- }
-```
-
-This code mod will update your deno.json file to include the relevant compiler
-options to enable the automatic JSX transform. It will then go through your
-project and remove any `/** @jsx h */` pragmas and `import { h } from "preact"`
-statements.
-
-### Classic twind -> Twind plugin
-
-> This code mod is only available in Fresh 1.1.0 and above.
-
-Fresh version 1.1.0 introduced a new plugin for using twind with Fresh. This
-plugin is much nicer to use than the raw twind integration that was previously
-available.
-
-This code mod will update your project to use the new twind plugin. It will
-update your `main.ts` file to import the twind plugin and add it to the plugins
-array. It will also update your files to remove many unnecessary uses of the
-`tw` function, and remove unnecessary twind imports. While the code mod can
-handle most cases, you may need to manually update some code. Additionally you
-will need to manually update your `twind.config.ts` if you use a custom
-configuration.
diff --git a/docs/canary/examples/modifying-the-head.md b/docs/canary/examples/modifying-the-head.md
deleted file mode 100644
index ba1d2d04..00000000
--- a/docs/canary/examples/modifying-the-head.md
+++ /dev/null
@@ -1,79 +0,0 @@
----
-description: |
- Add components like or to a tag using Fresh's component.
----
-
-We can use the `` component in `$fresh/runtime.ts` to add elements as
-children of the `` element. By adding elements as children of Fresh's
-`` tag, these automatically get injected into the `
` element of
-the web page. Some uses include:
-
-- Setting the document title using ``
-- Specifying page metadata using ``
-- Linking to resources like stylesheets using ``
-- Including third-party JavaScript code using `
-
-
-
Hello World
-
- >
- );
-}
-```
-
-## Avoiding duplicate tags
-
-You might end up with duplicate tags, when multiple `` components are
-rendered on the same page. This can happen when you render `
` in a route
-and another `
` in another component for example.
-
-```tsx
-// routes/page-a.tsx
-
-
-
-
-// components/MyTitle.tsx
-
-
-
-```
-
-To ensure that the tag is not duplicated, Fresh supports setting the `key` prop.
-By giving matching elements the same `key` prop, only the last one will be
-rendered.
-
-```diff
- // routes/page-a.tsx
-
--
-+
-
-
- // components/MyTitle.tsx
-
--
-+
-
-```
-
-The rendered page will only include the ``-tag with `"Other title"`.
-
-> [info]: The `
`-tag is automatically deduplicated, even without a `key`
-> prop.
diff --git a/docs/canary/concepts/partials.md b/docs/latest/concepts/partials.md
similarity index 100%
rename from docs/canary/concepts/partials.md
rename to docs/latest/concepts/partials.md
diff --git a/docs/latest/concepts/updating.md b/docs/latest/concepts/updating.md
index 165956f3..b3ae1daa 100644
--- a/docs/latest/concepts/updating.md
+++ b/docs/latest/concepts/updating.md
@@ -42,7 +42,7 @@ To run the auto updater, run the following command from the root of your
project:
```sh Terminal
-$ deno run -A -r https://fresh.deno.dev/update .
+$ deno run -A -r https://fresh.deno.dev/update
```
You will be prompted to confirm the changes that will be made to your project.
diff --git a/docs/canary/examples/active-links.md b/docs/latest/examples/active-links.md
similarity index 100%
rename from docs/canary/examples/active-links.md
rename to docs/latest/examples/active-links.md
diff --git a/docs/latest/examples/modifying-the-head.md b/docs/latest/examples/modifying-the-head.md
index e8b91c45..ba1d2d04 100644
--- a/docs/latest/examples/modifying-the-head.md
+++ b/docs/latest/examples/modifying-the-head.md
@@ -36,3 +36,44 @@ export default function Home() {
);
}
```
+
+## Avoiding duplicate tags
+
+You might end up with duplicate tags, when multiple `
` components are
+rendered on the same page. This can happen when you render `
` in a route
+and another `
` in another component for example.
+
+```tsx
+// routes/page-a.tsx
+
+
+
+
+// components/MyTitle.tsx
+
+
+
+```
+
+To ensure that the tag is not duplicated, Fresh supports setting the `key` prop.
+By giving matching elements the same `key` prop, only the last one will be
+rendered.
+
+```diff
+ // routes/page-a.tsx
+
+-
++
+
+
+ // components/MyTitle.tsx
+
+-
++
+
+```
+
+The rendered page will only include the ``-tag with `"Other title"`.
+
+> [info]: The `