-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into remove-static-slots
- Loading branch information
Showing
180 changed files
with
2,943 additions
and
985 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Fix image services not being usable on Edge runtimes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Fix middleware for API endpoints that use `Response`, and log a warning for endpoints that don't use `Response`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
'astro': minor | ||
'@astrojs/cloudflare': patch | ||
'@astrojs/netlify': patch | ||
'@astrojs/vercel': patch | ||
'@astrojs/image': patch | ||
'@astrojs/deno': patch | ||
'@astrojs/node': patch | ||
--- | ||
|
||
Enable experimental support for hybrid SSR with pre-rendering enabled by default | ||
|
||
__astro.config.mjs__ | ||
```js | ||
import { defineConfig } from 'astro/config'; | ||
export defaultdefineConfig({ | ||
output: 'hybrid', | ||
experimental: { | ||
hybridOutput: true, | ||
}, | ||
}) | ||
``` | ||
Then add `export const prerender = false` to any page or endpoint you want to opt-out of pre-rendering. | ||
|
||
__src/pages/contact.astro__ | ||
```astro | ||
--- | ||
export const prerender = false | ||
if (Astro.request.method === 'POST') { | ||
// handle form submission | ||
} | ||
--- | ||
<form method="POST"> | ||
<input type="text" name="name" /> | ||
<input type="email" name="email" /> | ||
<button type="submit">Submit</button> | ||
</form> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@astrojs/vercel': minor | ||
--- | ||
|
||
Add `edge-light` and `worker` import condition for worker bundling |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@astrojs/markdoc': minor | ||
'astro': patch | ||
--- | ||
|
||
Generate heading `id`s and populate the `headings` property for all Markdoc files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@astrojs/vercel': patch | ||
--- | ||
|
||
Add missing esbuild dependency |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@astrojs/cloudflare': minor | ||
--- | ||
|
||
Add `worked` and `worker` import condition for worker bundling |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@astrojs/cloudflare': patch | ||
'@astrojs/vercel': patch | ||
'@astrojs/solid-js': patch | ||
--- | ||
|
||
Always build edge/worker runtime with Vite `webworker` SSR target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--- | ||
'astro': minor | ||
--- | ||
|
||
Integrations can add new `client:` directives through the `astro:config:setup` hook's `addClientDirective()` API. To enable this API, the user needs to set `experimental.customClientDirectives` to `true` in their config. | ||
|
||
```js | ||
import { defineConfig } from 'astro/config'; | ||
import onClickDirective from 'astro-click-directive'; | ||
|
||
export default defineConfig({ | ||
integrations: [onClickDirective()], | ||
experimental: { | ||
customClientDirectives: true | ||
} | ||
}); | ||
``` | ||
|
||
```js | ||
export default function onClickDirective() { | ||
return { | ||
hooks: { | ||
'astro:config:setup': ({ addClientDirective }) => { | ||
addClientDirective({ | ||
name: 'click', | ||
entrypoint: 'astro-click-directive/click.js' | ||
}); | ||
}, | ||
} | ||
} | ||
} | ||
``` | ||
|
||
```astro | ||
<Counter client:click /> | ||
``` | ||
|
||
The client directive file (e.g. `astro-click-directive/click.js`) should export a function of type `ClientDirective`: | ||
|
||
```ts | ||
import type { ClientDirective } from 'astro' | ||
|
||
const clickDirective: ClientDirective = (load, opts, el) => { | ||
window.addEventListener('click', async () => { | ||
const hydrate = await load() | ||
await hydrate() | ||
}, { once: true }) | ||
} | ||
|
||
export default clickDirective | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
'astro': minor | ||
--- | ||
|
||
Adds an opt-in way to minify the HTML output. | ||
|
||
Using the `compressHTML` option Astro will remove whitespace from Astro components. This only applies to components written in `.astro` format and happens in the compiler to maximize performance. You can enable with: | ||
|
||
```js | ||
import { defineConfig } from 'astro/config'; | ||
|
||
export default defineConfig({ | ||
compressHTML: true | ||
}); | ||
``` | ||
|
||
Compression occurs both in development mode and in the final build. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
'@astrojs/cloudflare': patch | ||
'@astrojs/turbolinks': patch | ||
'@astrojs/partytown': patch | ||
'@astrojs/alpinejs': patch | ||
'@astrojs/prefetch': patch | ||
'@astrojs/tailwind': patch | ||
'@astrojs/markdoc': patch | ||
'@astrojs/netlify': patch | ||
'@astrojs/preact': patch | ||
'@astrojs/svelte': patch | ||
'@astrojs/vercel': patch | ||
'@astrojs/react': patch | ||
'@astrojs/solid-js': patch | ||
'@astrojs/markdown-component': patch | ||
'@astrojs/deno': patch | ||
'@astrojs/node': patch | ||
'@astrojs/lit': patch | ||
'@astrojs/mdx': patch | ||
'@astrojs/vue': patch | ||
'@astrojs/markdown-remark': patch | ||
'@astrojs/prism': patch | ||
'@astrojs/rss': patch | ||
--- | ||
|
||
Specify `"files"` field to only publish necessary files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import { expect } from '@playwright/test'; | ||
import { testFactory, waitForHydrate } from './test-utils.js'; | ||
import testAdapter from '../test/test-adapter.js'; | ||
|
||
const test = testFactory({ | ||
root: './fixtures/custom-client-directives/', | ||
}); | ||
|
||
test.describe('Custom Client Directives - dev', () => { | ||
let devServer; | ||
|
||
test.beforeAll(async ({ astro }) => { | ||
devServer = await astro.startDevServer(); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
await devServer.stop(); | ||
}); | ||
|
||
testClientDirectivesShared(); | ||
}); | ||
|
||
test.describe('Custom Client Directives - build static', () => { | ||
let previewServer; | ||
|
||
test.beforeAll(async ({ astro }) => { | ||
await astro.build(); | ||
previewServer = await astro.preview(); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
await previewServer.stop(); | ||
}); | ||
|
||
testClientDirectivesShared(); | ||
}); | ||
|
||
test.describe('Custom Client Directives - build server', () => { | ||
let previewServer; | ||
|
||
test.beforeAll(async ({ astro }) => { | ||
await astro.build({ | ||
adapter: testAdapter(), | ||
}); | ||
previewServer = await astro.preview(); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
await previewServer.stop(); | ||
}); | ||
|
||
testClientDirectivesShared(); | ||
}); | ||
|
||
function testClientDirectivesShared() { | ||
test('client:click should work', async ({ astro, page }) => { | ||
await page.goto(astro.resolveUrl('/')); | ||
|
||
const incrementBtn = page.locator('#client-click .increment'); | ||
const counterValue = page.locator('#client-click pre'); | ||
|
||
await expect(counterValue).toHaveText('0'); | ||
|
||
// Component only hydrates on first click | ||
await Promise.all([waitForHydrate(page, counterValue), incrementBtn.click()]); | ||
|
||
// Since first click only triggers hydration, this should stay 0 | ||
await expect(counterValue).toHaveText('0'); | ||
await incrementBtn.click(); | ||
// Hydrated, this should be 1 | ||
await expect(counterValue).toHaveText('1'); | ||
}); | ||
|
||
test('client:password should work', async ({ astro, page }) => { | ||
await page.goto(astro.resolveUrl('/')); | ||
|
||
const incrementBtn = page.locator('#client-password .increment'); | ||
const counterValue = page.locator('#client-password pre'); | ||
|
||
await expect(counterValue).toHaveText('0'); | ||
await incrementBtn.click(); | ||
// Not hydrated, so this should stay 0 | ||
await expect(counterValue).toHaveText('0'); | ||
|
||
// Type super cool password to activate password! | ||
await Promise.all([waitForHydrate(page, counterValue), page.keyboard.type('hunter2')]); | ||
|
||
await incrementBtn.click(); | ||
// Hydrated, this should be 1 | ||
await expect(counterValue).toHaveText('1'); | ||
}); | ||
} |
Oops, something went wrong.