diff --git a/docs/canary/concepts/app-wrapper.md b/docs/canary/concepts/app-wrapper.md deleted file mode 100644 index 7d83bafc..00000000 --- a/docs/canary/concepts/app-wrapper.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -description: | - Add a global application wrapper to provide common meta tags or context for application routes. ---- - -An application wrapper is defined in an `_app.tsx` file in `routes/` folder. 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 ( -
This text is rendered on the server
-This text is rendered on the server
-also rendered by server
-foo is: {props.data.foo}
; -} -``` - -When a route has both a component and a `GET` handler, they are typically very -closely coupled. With async route components you can merge the two together and -avoid having to create the `Data` interface boilerplate. - -```tsx -// Async route component -export default async function MyPage(req: Request, ctx: RouteContext) { - const value = await loadFooValue(); - returnfoo is: {value}
; -} -``` - -The code gets a little shorter with async route components. Conceptually, you -can think of async route components inlining the `GET` handler into the -component function. Note, that you can still add additional HTTP handlers in the -same file like before. - -```tsx -export const handler: Handlers = { - async POST(req) { - // ... do something here - }, -}; - -export default async function MyPage(req: Request, ctx: RouteContext) { - const value = await loadFooValue(); - returnfoo is: {value}
; -} -``` diff --git a/docs/canary/concepts/updating.md b/docs/canary/concepts/updating.md deleted file mode 100644 index 83c7aaeb..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 constists 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: - -```bash -$ 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 - { - "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() { - returnfoo is: {props.data.foo}
; +} +``` + +When a route has both a component and a `GET` handler, they are typically very +closely coupled. With async route components you can merge the two together and +avoid having to create the `Data` interface boilerplate. + +```tsx +// Async route component +export default async function MyPage(req: Request, ctx: RouteContext) { + const value = await loadFooValue(); + returnfoo is: {value}
; +} +``` + +The code gets a little shorter with async route components. Conceptually, you +can think of async route components inlining the `GET` handler into the +component function. Note, that you can still add additional HTTP handlers in the +same file like before. + +```tsx +export const handler: Handlers = { + async POST(req) { + // ... do something here + }, +}; + +export default async function MyPage(req: Request, ctx: RouteContext) { + const value = await loadFooValue(); + returnfoo is: {value}
; +} +``` diff --git a/docs/concepts/updating.md b/docs/concepts/updating.md index ed8265ab..83c7aaeb 100644 --- a/docs/concepts/updating.md +++ b/docs/concepts/updating.md @@ -1,6 +1,6 @@ --- description: | - Fresh regularly releases new versions of the framework. This page explains how to update your project. + New versions of Fresh are regularly released. This page explains how to update your project. --- Fresh constists of multiple pieces which are independently versioned and @@ -23,7 +23,6 @@ below. | 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 | -| 1.3.0 | >=10.15.0 <11.0.0 | >=6.1.0 | >= 1.35.0 | ## Updating dependencies @@ -75,6 +74,12 @@ Fresh 1.0.2 to 1.1.3, and update Preact to the latest version: } ``` +## 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 diff --git a/docs/toc.ts b/docs/toc.ts index 5b942a4c..b4bbe67c 100644 --- a/docs/toc.ts +++ b/docs/toc.ts @@ -46,11 +46,11 @@ const toc: RawTableOfContents = { pages: [ ["architecture", "Architecture", "link:latest"], ["server-components", "Server Components", "link:latest"], - ["routes", "Routes", "link:canary"], + ["routes", "Routes", "link:latest"], ["forms", "Forms", "link:latest"], - ["islands", "Interactive islands", "link:canary"], + ["islands", "Interactive islands", "link:latest"], ["static-files", "Static files", "link:latest"], - ["middleware", "Route middleware", "link:canary"], + ["middleware", "Route middleware", "link:latest"], ["error-pages", "Error pages", "link:latest"], ["routing", "Routing", "link:latest"], ["data-fetching", "Data fetching", "link:latest"], @@ -58,7 +58,7 @@ const toc: RawTableOfContents = { ["plugins", "Plugins", "link:latest"], ["updating", "Updating Fresh", "link:canary"], ["app-wrapper", "Application wrapper", "link:latest"], - ["server-configuration", "Server configuration", "link:canary"], + ["server-configuration", "Server configuration", "link:latest"], ], }, integrations: { diff --git a/versions.json b/versions.json index 4bb3310a..37817f55 100644 --- a/versions.json +++ b/versions.json @@ -1,4 +1,5 @@ [ + "1.3.0", "1.2.0", "1.1.6", "1.1.5", diff --git a/www/routes/index.tsx b/www/routes/index.tsx index a617dcfc..777f5293 100644 --- a/www/routes/index.tsx +++ b/www/routes/index.tsx @@ -77,10 +77,11 @@ function HelloBar() { return ( - Fresh v1.2 has been released with improved islands,{" "} - preview npm: support, and more!{" "} + Fresh v1.3 has been released with async route components, + {" "} + plugin enhancements, and more!{" "} → );