Skip to content

Commit

Permalink
Merge branch 'next' into feat/customize-image-endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Princesseuh authored Sep 10, 2024
2 parents 1039f03 + 40760a8 commit e147e27
Show file tree
Hide file tree
Showing 170 changed files with 1,934 additions and 1,195 deletions.
20 changes: 20 additions & 0 deletions .changeset/afraid-apricots-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
'astro': minor
---

Adapters can now specify the build output type they're intended for using the `adapterFeatures.buildOutput` property. This property can be used to always generate a server output, even if the project doesn't have any server-rendered pages.

```ts
{
'astro:config:done': ({ setAdapter, config }) => {
setAdapter({
name: 'my-adapter',
adapterFeatures: {
buildOutput: 'server',
},
});
},
}
```

If your adapter specifies `buildOutput: 'static'`, and the user's project contains server-rendered pages, Astro will warn in development and error at build time. Note that a hybrid output, containing both static and server-rendered pages, is considered to be a `server` output, as a server is required to serve the server-rendered pages.
15 changes: 15 additions & 0 deletions .changeset/chilly-terms-know.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
'astro': major
---

Updates how the `build.client` and `build.server` option values get resolved to match existing documentation. With this fix, the option values will now correctly resolve relative to the `outDir` option. So if `outDir` is set to `./dist/nested/`, then by default:

- `build.client` will resolve to `<root>/dist/nested/client/`
- `build.server` will resolve to `<root>/dist/nested/server/`

Previously the values were incorrectly resolved:

- `build.client` was resolved to `<root>/dist/nested/dist/client/`
- `build.server` was resolved to `<root>/dist/nested/dist/server/`

If you were relying on the previous build paths, make sure that your project code is updated to the new build paths.
5 changes: 5 additions & 0 deletions .changeset/cuddly-shoes-press.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fixes an issue where the refresh context data was not passed correctly to content layer loaders
5 changes: 0 additions & 5 deletions .changeset/empty-spoons-kiss.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/forty-spies-train.md

This file was deleted.

21 changes: 21 additions & 0 deletions .changeset/giant-rocks-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
'astro': major
---

Merges the `output: 'hybrid'` and `output: 'static'` configurations into one single configuration (now called `'static'`) that works the same way as the previous `hybrid` option.

It is no longer necessary to specify `output: 'hybrid'` in your Astro config to use server-rendered pages. The new `output: 'static'` has this capability included. Astro will now automatically provide the ability to opt out of prerendering in your static site with no change to your `output` configuration required. Any page route or endpoint can include `export const prerender = false` to be server-rendered, while the rest of your site is statically-generated.

If your project used hybrid rendering, you must now remove the `output: 'hybrid'` option from your Astro config as it no longer exists. However, no other changes to your project are required, and you should have no breaking changes. The previous `'hybrid'` behavior is now the default, under a new name `'static'`.

If you were using the `output: 'static'` (default) option, you can continue to use it as before. By default, all of your pages will continue to be prerendered and you will have a completely static site. You should have no breaking changes to your project.

```diff
import { defineConfig } from "astro/config";

export default defineConfig({
- output: 'hybrid',
});
```

An adapter is still required to deploy an Astro project with any server-rendered pages. Failure to include an adapter will result in a warning in development and an error at build time.
23 changes: 23 additions & 0 deletions .changeset/honest-dingos-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
'astro': patch
---

Adds support for array patterns in the built-in `glob()` content collections loader

The glob loader can now accept an array of multiple patterns as well as string patterns. This allows you to more easily combine multiple patterns into a single collection, and also means you can use negative matches to exclude files from the collection.

```ts
const probes = defineCollection({
// Load all markdown files in the space-probes directory, except for those that start with "voyager-"
loader: glob({ pattern: ['*.md', '!voyager-*'], base: 'src/data/space-probes' }),
schema: z.object({
name: z.string(),
type: z.enum(['Space Probe', 'Mars Rover', 'Comet Lander']),
launch_date: z.date(),
status: z.enum(['Active', 'Inactive', 'Decommissioned']),
destination: z.string(),
operator: z.string(),
notable_discoveries: z.array(z.string()),
}),
});
```
2 changes: 1 addition & 1 deletion .changeset/long-lions-do.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const prerender = true
// src/middleware.js

export const onRequest = (ctx, next) => {
console.log(ctx.prerender) // it will log true
console.log(ctx.isPrerendered) // it will log true
return next()
}
```
63 changes: 63 additions & 0 deletions .changeset/mighty-stingrays-press.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
'astro': patch
---

Adds support for Zod discriminated unions on Action form inputs. This allows forms with different inputs to be submitted to the same action, using a given input to decide which object should be used for validation.

This example accepts either a `create` or `update` form submission, and uses the `type` field to determine which object to validate against.

```ts
import { defineAction } from 'astro:actions';
import { z } from 'astro:schema';

export const server = {
changeUser: defineAction({
accept: 'form',
input: z.discriminatedUnion('type', [
z.object({
type: z.literal('create'),
name: z.string(),
email: z.string().email(),
}),
z.object({
type: z.literal('update'),
id: z.number(),
name: z.string(),
email: z.string().email(),
}),
]),
async handler(input) {
if (input.type === 'create') {
// input is { type: 'create', name: string, email: string }
} else {
// input is { type: 'update', id: number, name: string, email: string }
}
},
}),
}
```

The corresponding `create` and `update` forms may look like this:

```astro
---
import { actions } from 'astro:actions';
---
<!--Create-->
<form action={actions.changeUser} method="POST">
<input type="hidden" name="type" value="create" />
<input type="text" name="name" required />
<input type="email" name="email" required />
<button type="submit">Create User</button>
</form>
<!--Update-->
<form action={actions.changeUser} method="POST">
<input type="hidden" name="type" value="update" />
<input type="hidden" name="id" value="user-123" />
<input type="text" name="name" required />
<input type="email" name="email" required />
<button type="submit">Update User</button>
</form>
```
7 changes: 7 additions & 0 deletions .changeset/poor-dots-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'astro': minor
---

Adds a new `buildOutput` property to the `astro:config:done` hook returning the build output type.

This can be used to know if the user's project will be built as a static site (HTML files), or a server-rendered site (whose exact output depends on the adapter).
9 changes: 9 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,26 @@
"@astrojs/upgrade": "0.3.1"
},
"changesets": [
"afraid-apricots-buy",
"blue-boats-relax",
"breezy-colts-promise",
"chatty-teachers-sit",
"chilly-terms-know",
"clean-donuts-walk",
"cuddly-shoes-press",
"curvy-walls-kneel",
"eighty-boxes-applaud",
"empty-spoons-kiss",
"five-jars-hear",
"forty-spies-train",
"giant-rocks-thank",
"healthy-ads-scream",
"heavy-seahorses-poke",
"honest-dingos-add",
"hungry-jokes-try",
"itchy-toys-march",
"large-zebras-sniff",
"long-lions-do",
"long-months-rule",
"many-garlics-lick",
"mean-donkeys-switch",
Expand All @@ -55,10 +61,13 @@
"neat-dots-hear",
"old-zebras-teach",
"perfect-fans-fly",
"pink-yaks-exercise",
"poor-dots-add",
"poor-frogs-dream",
"quick-ads-exercise",
"selfish-cats-crash",
"selfish-impalas-grin",
"sharp-worms-sniff",
"small-ties-sort",
"spotty-garlics-cheat",
"ten-students-repair",
Expand Down
5 changes: 5 additions & 0 deletions .changeset/sharp-worms-sniff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Updates error messages that assume content collections are located in `src/content/` with more generic language
2 changes: 1 addition & 1 deletion examples/basics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^5.0.0-alpha.4"
"astro": "^5.0.0-alpha.6"
}
}
2 changes: 1 addition & 1 deletion examples/blog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"@astrojs/mdx": "^4.0.0-alpha.2",
"@astrojs/rss": "^4.0.7",
"@astrojs/sitemap": "^3.1.6",
"astro": "^5.0.0-alpha.4"
"astro": "^5.0.0-alpha.6"
}
}
2 changes: 1 addition & 1 deletion examples/component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"scripts": {},
"devDependencies": {
"astro": "^5.0.0-alpha.4"
"astro": "^5.0.0-alpha.6"
},
"peerDependencies": {
"astro": "^4.0.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/container-with-vitest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"test": "vitest run"
},
"dependencies": {
"astro": "^5.0.0-alpha.4",
"astro": "^5.0.0-alpha.6",
"@astrojs/react": "^3.6.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-alpine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"@astrojs/alpinejs": "^0.4.0",
"@types/alpinejs": "^3.13.10",
"alpinejs": "^3.14.1",
"astro": "^5.0.0-alpha.4"
"astro": "^5.0.0-alpha.6"
}
}
6 changes: 3 additions & 3 deletions examples/framework-multiple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/preact": "^3.5.2",
"@astrojs/preact": "^3.5.3",
"@astrojs/react": "^3.6.2",
"@astrojs/solid-js": "^4.4.1",
"@astrojs/svelte": "^6.0.0-alpha.0",
"@astrojs/vue": "^5.0.0-alpha.0",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"astro": "^5.0.0-alpha.4",
"astro": "^5.0.0-alpha.6",
"preact": "^10.23.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"solid-js": "^1.8.22",
"svelte": "^4.2.19",
"vue": "^3.4.38"
"vue": "^3.5.3"
}
}
4 changes: 2 additions & 2 deletions examples/framework-preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/preact": "^3.5.2",
"@astrojs/preact": "^3.5.3",
"@preact/signals": "^1.3.0",
"astro": "^5.0.0-alpha.4",
"astro": "^5.0.0-alpha.6",
"preact": "^10.23.2"
}
}
2 changes: 1 addition & 1 deletion examples/framework-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@astrojs/react": "^3.6.2",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"astro": "^5.0.0-alpha.4",
"astro": "^5.0.0-alpha.6",
"react": "^18.3.1",
"react-dom": "^18.3.1"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-solid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/solid-js": "^4.4.1",
"astro": "^5.0.0-alpha.4",
"astro": "^5.0.0-alpha.6",
"solid-js": "^1.8.22"
}
}
2 changes: 1 addition & 1 deletion examples/framework-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/svelte": "^6.0.0-alpha.0",
"astro": "^5.0.0-alpha.4",
"astro": "^5.0.0-alpha.6",
"svelte": "^4.2.19"
}
}
2 changes: 1 addition & 1 deletion examples/framework-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/vue": "^5.0.0-alpha.0",
"astro": "^5.0.0-alpha.4",
"astro": "^5.0.0-alpha.6",
"vue": "^3.4.38"
}
}
2 changes: 1 addition & 1 deletion examples/hackernews/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
},
"dependencies": {
"@astrojs/node": "^9.0.0-alpha.1",
"astro": "^5.0.0-alpha.4"
"astro": "^5.0.0-alpha.6"
}
}
2 changes: 1 addition & 1 deletion examples/integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"scripts": {},
"devDependencies": {
"astro": "^5.0.0-alpha.4"
"astro": "^5.0.0-alpha.6"
},
"peerDependencies": {
"astro": "^4.0.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/middleware/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"dependencies": {
"@astrojs/node": "^9.0.0-alpha.1",
"astro": "^5.0.0-alpha.4",
"astro": "^5.0.0-alpha.6",
"html-minifier": "^4.0.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/minimal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^5.0.0-alpha.4"
"astro": "^5.0.0-alpha.6"
}
}
2 changes: 1 addition & 1 deletion examples/non-html-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^5.0.0-alpha.4"
"astro": "^5.0.0-alpha.6"
}
}
2 changes: 1 addition & 1 deletion examples/portfolio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^5.0.0-alpha.4"
"astro": "^5.0.0-alpha.6"
}
}
Loading

0 comments on commit e147e27

Please sign in to comment.