Skip to content

Commit

Permalink
Merge branch 'main' into feat/check-skip-sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Princesseuh authored Jul 18, 2024
2 parents 192a5f7 + e7bfbf8 commit e624fe0
Show file tree
Hide file tree
Showing 113 changed files with 4,141 additions and 182 deletions.
5 changes: 5 additions & 0 deletions .changeset/chilly-jokes-fold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fixes a case where invalid `astro:env` variables at runtime would not throw correctly
42 changes: 42 additions & 0 deletions .changeset/five-rocks-vanish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
'astro': minor
---

Experimental Server Islands

Server Islands allow you to specify components that should run on the server, allowing the rest of the page to be more aggressively cached, or even generated statically. Turn any `.astro` component into a server island by adding the `server:defer` directive and optionally, fallback placeholder content:

```astro
---
import Avatar from '../components/Avatar.astro';
import GenericUser from '../components/GenericUser.astro';
---
<header>
<h1>Page Title</h1>
<div class="header-right">
<Avatar server:defer>
<GenericUser slot="fallback" />
</Avatar>
</div>
</header>
```

The `server:defer` directive can be used on any Astro component in a project using `hybrid` or `server` mode with an adapter. There are no special APIs needed inside of the island.

Enable server islands by adding the experimental flag to your Astro config with an appropriate `output` mode and adatper:

```js
import { defineConfig } from 'astro/config';
import netlify from '@astrojs/netlify';

export default defineConfig({
output: 'hybrid',
adapter: netlify(),
experimental {
serverIslands: true,
},
});
```

For more information, see the [server islands documentation](https://docs.astro.build/en/reference/configuration-reference/#experimentalserverislands).
5 changes: 5 additions & 0 deletions .changeset/thin-dodos-serve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': minor
---

Adds Shiki's [`defaultColor`](https://shiki.style/guide/dual-themes#without-default-color) option to the `<Code />` component, giving you more control in applying multiple themes
5 changes: 5 additions & 0 deletions .changeset/warm-lizards-mate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fixes Astro not working on low versions of Node 18 and 20
18 changes: 18 additions & 0 deletions examples/server-islands/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { defineConfig } from 'astro/config';
import nodejs from '@astrojs/node';
import react from '@astrojs/react';
import tailwind from '@astrojs/tailwind';

// https://astro.build/config
export default defineConfig({
output: 'server',
adapter: nodejs({ mode: 'standalone' }),
integrations: [
react(),
tailwind({ applyBaseStyles: false })
],
devToolbar: { enabled: false },
experimental: {
serverIslands: true,
}
});
26 changes: 26 additions & 0 deletions examples/server-islands/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "@example/server-islands",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro"
},
"devDependencies": {
"@astrojs/node": "^8.2.6",
"@astrojs/react": "^3.6.0",
"@astrojs/tailwind": "^5.1.0",
"@fortawesome/fontawesome-free": "^6.5.2",
"@tailwindcss/forms": "^0.5.7",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"astro": "workspace:*",
"postcss": "^8.4.38",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"tailwindcss": "^3.4.3"
}
}
Loading

0 comments on commit e624fe0

Please sign in to comment.