Skip to content

Commit

Permalink
Merge branch 'main' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
Princesseuh committed Sep 10, 2024
1 parent a1176a1 commit c6d0e3d
Show file tree
Hide file tree
Showing 92 changed files with 1,260 additions and 895 deletions.
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.

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>
```
4 changes: 2 additions & 2 deletions examples/framework-multiple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"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",
Expand All @@ -24,6 +24,6 @@
"react-dom": "^18.3.1",
"solid-js": "^1.8.22",
"svelte": "^4.2.19",
"vue": "^3.4.38"
"vue": "^3.5.3"
}
}
2 changes: 1 addition & 1 deletion examples/framework-preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/preact": "^3.5.2",
"@astrojs/preact": "^3.5.3",
"@preact/signals": "^1.3.0",
"astro": "^5.0.0-alpha.6",
"preact": "^10.23.2"
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"dependencies": {
"@astrojs/vue": "^5.0.0-alpha.0",
"astro": "^5.0.0-alpha.6",
"vue": "^3.4.38"
"vue": "^3.5.3"
}
}
4 changes: 2 additions & 2 deletions examples/server-islands/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
"@astrojs/react": "^3.6.2",
"@astrojs/tailwind": "^6.0.0-alpha.0",
"@fortawesome/fontawesome-free": "^6.6.0",
"@tailwindcss/forms": "^0.5.8",
"@tailwindcss/forms": "^0.5.9",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"astro": "^5.0.0-alpha.6",
"postcss": "^8.4.43",
"postcss": "^8.4.45",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"tailwindcss": "^3.4.10"
Expand Down
2 changes: 1 addition & 1 deletion examples/starlog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"astro": "^5.0.0-alpha.6",
"sass": "^1.77.8",
"sass": "^1.78.0",
"sharp": "^0.33.3"
}
}
2 changes: 1 addition & 1 deletion examples/with-mdx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/mdx": "^4.0.0-alpha.2",
"@astrojs/preact": "^3.5.2",
"@astrojs/preact": "^3.5.3",
"astro": "^5.0.0-alpha.6",
"preact": "^10.23.2"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/with-nanostores/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/preact": "^3.5.2",
"@astrojs/preact": "^3.5.3",
"@nanostores/preact": "^0.5.2",
"astro": "^5.0.0-alpha.6",
"nanostores": "^0.11.3",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-tailwindcss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"astro": "^5.0.0-alpha.6",
"autoprefixer": "^10.4.20",
"canvas-confetti": "^1.9.3",
"postcss": "^8.4.43",
"postcss": "^8.4.45",
"tailwindcss": "^3.4.10"
}
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@
"@astrojs/check": "^0.9.3",
"@biomejs/biome": "1.8.3",
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.7",
"@changesets/cli": "^2.27.8",
"@types/node": "^18.17.8",
"esbuild": "^0.21.5",
"eslint": "^9.9.1",
"eslint": "^9.10.0",
"eslint-plugin-no-only-tests": "^3.3.0",
"eslint-plugin-regexp": "^2.6.0",
"globby": "^14.0.2",
Expand All @@ -67,7 +67,7 @@
"prettier-plugin-astro": "^0.14.1",
"turbo": "^2.1.1",
"typescript": "~5.5.4",
"typescript-eslint": "^8.3.0"
"typescript-eslint": "^8.4.0"
},
"pnpm": {
"peerDependencyRules": {
Expand Down
2 changes: 1 addition & 1 deletion packages/astro-rss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"xml2js": "0.6.2"
},
"dependencies": {
"fast-xml-parser": "^4.4.1",
"fast-xml-parser": "^4.5.0",
"kleur": "^4.1.5"
}
}
36 changes: 36 additions & 0 deletions packages/astro/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,42 @@
});
```

## 4.15.4

### Patch Changes

- [#11879](https://github.com/withastro/astro/pull/11879) [`bd1d4aa`](https://github.com/withastro/astro/commit/bd1d4aaf8262187b4f132d7fe0365902131ddf1a) Thanks [@matthewp](https://github.com/matthewp)! - Allow passing a cryptography key via ASTRO_KEY

For Server islands Astro creates a cryptography key in order to hash props for the islands, preventing accidental leakage of secrets.

If you deploy to an environment with rolling updates then there could be multiple instances of your app with different keys, causing potential key mismatches.

To fix this you can now pass the `ASTRO_KEY` environment variable to your build in order to reuse the same key.

To generate a key use:

```
astro create-key
```

This will print out an environment variable to set like:

```
ASTRO_KEY=PIAuyPNn2aKU/bviapEuc/nVzdzZPizKNo3OqF/5PmQ=
```

- [#11935](https://github.com/withastro/astro/pull/11935) [`c58193a`](https://github.com/withastro/astro/commit/c58193a691775af5c568e461c63040a42e2471f7) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Fixes `astro add` not using the proper export point when adding certain adapters

## 4.15.3

### Patch Changes

- [#11902](https://github.com/withastro/astro/pull/11902) [`d63bc50`](https://github.com/withastro/astro/commit/d63bc50d9940c1107e0fee7687e5c332549a0eff) Thanks [@ascorbic](https://github.com/ascorbic)! - Fixes case where content layer did not update during clean dev builds on Linux and Windows

- [#11886](https://github.com/withastro/astro/pull/11886) [`7ff7134`](https://github.com/withastro/astro/commit/7ff7134b8038a3b798293b2218bbf6dd02d2ac32) Thanks [@matthewp](https://github.com/matthewp)! - Fixes a missing error message when actions throws during `astro sync`

- [#11904](https://github.com/withastro/astro/pull/11904) [`ca54e3f`](https://github.com/withastro/astro/commit/ca54e3f819fad009ac3c3c8b57a26014a2652a73) Thanks [@wtchnm](https://github.com/wtchnm)! - perf(assets): avoid downloading original image when using cache

## 5.0.0-alpha.5

### Major Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/e2e/fixtures/astro-envs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"dependencies": {
"@astrojs/vue": "workspace:*",
"astro": "workspace:*",
"vue": "^3.4.38"
"vue": "^3.5.3"
}
}
2 changes: 1 addition & 1 deletion packages/astro/e2e/fixtures/client-only/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"react-dom": "^18.3.1",
"solid-js": "^1.8.22",
"svelte": "^4.2.19",
"vue": "^3.4.38"
"vue": "^3.5.3"
}
}
2 changes: 1 addition & 1 deletion packages/astro/e2e/fixtures/error-sass/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"astro": "workspace:*",
"sass": "^1.77.8"
"sass": "^1.78.0"
}
}
4 changes: 2 additions & 2 deletions packages/astro/e2e/fixtures/errors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"preact": "^10.23.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"sass": "^1.77.8",
"sass": "^1.78.0",
"solid-js": "^1.8.22",
"svelte": "^4.2.19",
"vue": "^3.4.38"
"vue": "^3.5.3"
}
}
2 changes: 1 addition & 1 deletion packages/astro/e2e/fixtures/hmr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"private": true,
"devDependencies": {
"astro": "workspace:*",
"sass": "^1.77.8"
"sass": "^1.78.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
"react-dom": "^18.3.1",
"solid-js": "^1.8.22",
"svelte": "^4.2.19",
"vue": "^3.4.38"
"vue": "^3.5.3"
}
}
2 changes: 1 addition & 1 deletion packages/astro/e2e/fixtures/nested-in-preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"react-dom": "^18.3.1",
"solid-js": "^1.8.22",
"svelte": "^4.2.19",
"vue": "^3.4.38"
"vue": "^3.5.3"
}
}
2 changes: 1 addition & 1 deletion packages/astro/e2e/fixtures/nested-in-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"react-dom": "^18.3.1",
"solid-js": "^1.8.22",
"svelte": "^4.2.19",
"vue": "^3.4.38"
"vue": "^3.5.3"
}
}
2 changes: 1 addition & 1 deletion packages/astro/e2e/fixtures/nested-in-solid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"react-dom": "^18.3.1",
"solid-js": "^1.8.22",
"svelte": "^4.2.19",
"vue": "^3.4.38"
"vue": "^3.5.3"
}
}
2 changes: 1 addition & 1 deletion packages/astro/e2e/fixtures/nested-in-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"react-dom": "^18.3.1",
"solid-js": "^1.8.22",
"svelte": "^4.2.19",
"vue": "^3.4.38"
"vue": "^3.5.3"
}
}
2 changes: 1 addition & 1 deletion packages/astro/e2e/fixtures/nested-in-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"react-dom": "^18.3.1",
"solid-js": "^1.8.22",
"svelte": "^4.2.19",
"vue": "^3.4.38"
"vue": "^3.5.3"
}
}
2 changes: 1 addition & 1 deletion packages/astro/e2e/fixtures/nested-recursive/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"react-dom": "^18.3.1",
"solid-js": "^1.8.22",
"svelte": "^4.2.19",
"vue": "^3.4.38"
"vue": "^3.5.3"
},
"scripts": {
"dev": "astro dev"
Expand Down
12 changes: 12 additions & 0 deletions packages/astro/e2e/fixtures/server-islands-key/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineConfig } from 'astro/config';
import node from '@astrojs/node';

// https://astro.build/config
export default defineConfig({
output: 'server',
adapter: node({ mode: 'standalone' }),
integrations: [],
experimental: {
serverIslands: true,
}
});
12 changes: 12 additions & 0 deletions packages/astro/e2e/fixtures/server-islands-key/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "@e2e/server-islands-key",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "astro dev"
},
"dependencies": {
"astro": "workspace:*",
"@astrojs/node": "^8.3.3"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
const { secret } = Astro.props;
---
<h2 id="island">I am an island</h2>
<slot />
<h3 id="secret">{secret}</h3>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
import Island from '../components/Island.astro';
---

<html>
<head>
<!-- Head Stuff -->
</head>
<body>
<Island server:defer secret="test">
<h3 id="children">children</h3>
</Island>
</body>
</html>
2 changes: 1 addition & 1 deletion packages/astro/e2e/fixtures/tailwindcss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"@astrojs/tailwind": "workspace:*",
"astro": "workspace:*",
"autoprefixer": "^10.4.20",
"postcss": "^8.4.43",
"postcss": "^8.4.45",
"tailwindcss": "^3.4.10"
}
}
2 changes: 1 addition & 1 deletion packages/astro/e2e/fixtures/view-transitions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"svelte": "^4.2.19",
"vue": "^3.4.38"
"vue": "^3.5.3"
}
}
Loading

0 comments on commit c6d0e3d

Please sign in to comment.