Merge branch 'main' into main

This commit is contained in:
Chris 2023-08-30 09:17:47 +02:00 committed by GitHub
commit 95987592b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
72 changed files with 343 additions and 160 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Add a type param to AstroGlobal to type params. This will eventually be used automatically by our tooling to provide typing and completions for `Astro.params`

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fix `image.service` requiring to be set manually when `image.domains` or `image.remotePatterns` was assigned a value

View file

@ -0,0 +1,9 @@
---
'@astrojs/react': patch
'@astrojs/preact': patch
'@astrojs/vue': patch
'@astrojs/solid-js': patch
'@astrojs/svelte': patch
---
Automatically unmount islands when `astro:unmount` is fired

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fire `astro:unmount` event when island is disconnected

View file

@ -34,6 +34,7 @@
"angry-dogs-shake",
"big-tips-whisper",
"brave-cheetahs-float",
"breezy-books-notice",
"chatty-ways-hunt",
"chilled-ducks-grin",
"clever-bats-breathe",
@ -55,6 +56,7 @@
"grumpy-pens-melt",
"grumpy-years-remember",
"happy-penguins-hug",
"heavy-countries-wonder",
"heavy-walls-arrive",
"honest-houses-deny",
"large-countries-share",
@ -62,15 +64,18 @@
"long-chefs-jump",
"loud-candles-admire",
"lovely-walls-call",
"many-impalas-sit",
"many-pears-explode",
"mighty-dancers-lay",
"nasty-garlics-listen",
"neat-mugs-end",
"neat-owls-run",
"neat-suns-search",
"ninety-boats-brake",
"odd-books-live",
"olive-moles-tan",
"perfect-horses-tell",
"perfect-socks-hammer",
"plenty-keys-add",
"popular-carrots-sneeze",
"proud-fans-type",
@ -89,8 +94,11 @@
"spicy-icons-live",
"spicy-stingrays-cheer",
"strange-peas-agree",
"strong-needles-accept",
"strong-papayas-chew",
"swift-taxis-sing",
"tame-files-glow",
"tame-knives-shake",
"tasty-camels-speak",
"tasty-dragons-smash",
"thin-ants-repeat",

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Prevent ViewTransition script from being added by mistake

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fix video persistence regression

View file

@ -5,6 +5,7 @@ on:
branches:
- main
- "1-legacy"
- "2-legacy"
- next
defaults:

View file

@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^3.0.0-rc.8"
"astro": "^3.0.0-rc.11"
}
}

View file

@ -14,6 +14,6 @@
"@astrojs/mdx": "^1.0.0-rc.2",
"@astrojs/rss": "^3.0.0-rc.2",
"@astrojs/sitemap": "^3.0.0-rc.1",
"astro": "^3.0.0-rc.8"
"astro": "^3.0.0-rc.11"
}
}

View file

@ -15,7 +15,7 @@
],
"scripts": {},
"devDependencies": {
"astro": "^3.0.0-rc.8"
"astro": "^3.0.0-rc.11"
},
"peerDependencies": {
"astro": "^2.0.0-beta.0"

View file

@ -10,7 +10,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^3.0.0-rc.8"
"astro": "^3.0.0-rc.11"
},
"devDependencies": {
"@astrojs/deno": "^5.0.0-rc.2"

View file

@ -14,6 +14,6 @@
"@astrojs/alpinejs": "^0.3.0-rc.1",
"@types/alpinejs": "^3.7.2",
"alpinejs": "^3.12.3",
"astro": "^3.0.0-rc.8"
"astro": "^3.0.0-rc.11"
}
}

View file

@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/lit": "^3.0.0-rc.1",
"@webcomponents/template-shadowroot": "^0.2.1",
"astro": "^3.0.0-rc.8",
"astro": "^3.0.0-rc.11",
"lit": "^2.8.0"
}
}

View file

@ -11,12 +11,12 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/preact": "^3.0.0-rc.2",
"@astrojs/react": "^3.0.0-rc.5",
"@astrojs/solid-js": "^3.0.0-rc.3",
"@astrojs/svelte": "^4.0.0-rc.2",
"@astrojs/vue": "^3.0.0-rc.1",
"astro": "^3.0.0-rc.8",
"@astrojs/preact": "^3.0.0-rc.3",
"@astrojs/react": "^3.0.0-rc.6",
"@astrojs/solid-js": "^3.0.0-rc.4",
"@astrojs/svelte": "^4.0.0-rc.3",
"@astrojs/vue": "^3.0.0-rc.2",
"astro": "^3.0.0-rc.11",
"preact": "^10.17.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",

View file

@ -11,9 +11,9 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/preact": "^3.0.0-rc.2",
"@astrojs/preact": "^3.0.0-rc.3",
"@preact/signals": "^1.2.1",
"astro": "^3.0.0-rc.8",
"astro": "^3.0.0-rc.11",
"preact": "^10.17.1"
}
}

View file

@ -11,10 +11,10 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/react": "^3.0.0-rc.5",
"@astrojs/react": "^3.0.0-rc.6",
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"astro": "^3.0.0-rc.8",
"astro": "^3.0.0-rc.11",
"react": "^18.2.0",
"react-dom": "^18.2.0"
}

View file

@ -11,8 +11,8 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/solid-js": "^3.0.0-rc.3",
"astro": "^3.0.0-rc.8",
"@astrojs/solid-js": "^3.0.0-rc.4",
"astro": "^3.0.0-rc.11",
"solid-js": "^1.7.11"
}
}

View file

@ -11,8 +11,8 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/svelte": "^4.0.0-rc.2",
"astro": "^3.0.0-rc.8",
"@astrojs/svelte": "^4.0.0-rc.3",
"astro": "^3.0.0-rc.11",
"svelte": "^4.2.0"
}
}

View file

@ -11,8 +11,8 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/vue": "^3.0.0-rc.1",
"astro": "^3.0.0-rc.8",
"@astrojs/vue": "^3.0.0-rc.2",
"astro": "^3.0.0-rc.11",
"vue": "^3.3.4"
}
}

View file

@ -12,6 +12,6 @@
},
"dependencies": {
"@astrojs/node": "^6.0.0-rc.1",
"astro": "^3.0.0-rc.8"
"astro": "^3.0.0-rc.11"
}
}

View file

@ -15,7 +15,7 @@
],
"scripts": {},
"devDependencies": {
"astro": "^3.0.0-rc.8"
"astro": "^3.0.0-rc.11"
},
"peerDependencies": {
"astro": "^2.0.0-beta.0"

View file

@ -13,7 +13,7 @@
},
"dependencies": {
"@astrojs/node": "^6.0.0-rc.1",
"astro": "^3.0.0-rc.8",
"astro": "^3.0.0-rc.11",
"html-minifier": "^4.0.0"
}
}

View file

@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^3.0.0-rc.8"
"astro": "^3.0.0-rc.11"
}
}

View file

@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^3.0.0-rc.8"
"astro": "^3.0.0-rc.11"
}
}

View file

@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^3.0.0-rc.8"
"astro": "^3.0.0-rc.11"
}
}

View file

@ -13,8 +13,8 @@
},
"dependencies": {
"@astrojs/node": "^6.0.0-rc.1",
"@astrojs/svelte": "^4.0.0-rc.2",
"astro": "^3.0.0-rc.8",
"@astrojs/svelte": "^4.0.0-rc.3",
"astro": "^3.0.0-rc.11",
"svelte": "^4.2.0"
}
}

View file

@ -12,6 +12,6 @@
},
"dependencies": {
"@astrojs/markdoc": "^0.5.0-rc.1",
"astro": "^3.0.0-rc.8"
"astro": "^3.0.0-rc.11"
}
}

View file

@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/markdown-remark": "^3.0.0-rc.1",
"astro": "^3.0.0-rc.8",
"astro": "^3.0.0-rc.11",
"hast-util-select": "^5.0.5",
"rehype-autolink-headings": "^6.1.1",
"rehype-slug": "^5.1.0",

View file

@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^3.0.0-rc.8"
"astro": "^3.0.0-rc.11"
}
}

View file

@ -12,8 +12,8 @@
},
"dependencies": {
"@astrojs/mdx": "^1.0.0-rc.2",
"@astrojs/preact": "^3.0.0-rc.2",
"astro": "^3.0.0-rc.8",
"@astrojs/preact": "^3.0.0-rc.3",
"astro": "^3.0.0-rc.11",
"preact": "^10.17.1"
}
}

View file

@ -11,9 +11,9 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/preact": "^3.0.0-rc.2",
"@astrojs/preact": "^3.0.0-rc.3",
"@nanostores/preact": "^0.5.0",
"astro": "^3.0.0-rc.8",
"astro": "^3.0.0-rc.11",
"nanostores": "^0.9.3",
"preact": "^10.17.1"
}

View file

@ -14,7 +14,7 @@
"@astrojs/mdx": "^1.0.0-rc.2",
"@astrojs/tailwind": "^5.0.0-rc.1",
"@types/canvas-confetti": "^1.6.0",
"astro": "^3.0.0-rc.8",
"astro": "^3.0.0-rc.11",
"autoprefixer": "^10.4.15",
"canvas-confetti": "^1.6.0",
"postcss": "^8.4.28",

View file

@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^3.0.0-rc.8",
"astro": "^3.0.0-rc.11",
"vite-plugin-pwa": "0.16.4",
"workbox-window": "^7.0.0"
}

View file

@ -12,7 +12,7 @@
"test": "vitest"
},
"dependencies": {
"astro": "^3.0.0-rc.8",
"astro": "^3.0.0-rc.11",
"vitest": "^0.34.2"
}
}

View file

@ -1,5 +1,34 @@
# astro
## 3.0.0-rc.11
### Patch Changes
- [#8271](https://github.com/withastro/astro/pull/8271) [`16f09dfff`](https://github.com/withastro/astro/commit/16f09dfff7722fda99dd0412e3006a7a39c80829) Thanks [@matthewp](https://github.com/matthewp)! - Fix video persistence regression
## 3.0.0-rc.10
### Patch Changes
- [#8266](https://github.com/withastro/astro/pull/8266) [`8450379db`](https://github.com/withastro/astro/commit/8450379db854fb1eaa9f38f21d65db240bc616cd) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Fix `image.service` requiring to be set manually when `image.domains` or `image.remotePatterns` was assigned a value
- [#8270](https://github.com/withastro/astro/pull/8270) [`e7f872e91`](https://github.com/withastro/astro/commit/e7f872e91e852b901cf221a5151077dec64305bf) Thanks [@matthewp](https://github.com/matthewp)! - Prevent ViewTransition script from being added by mistake
## 3.0.0-rc.9
### Patch Changes
- [#8234](https://github.com/withastro/astro/pull/8234) [`0c7b42dc6`](https://github.com/withastro/astro/commit/0c7b42dc6780e687e416137539f55a3a427d1d10) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Update telemetry notice
- [#8263](https://github.com/withastro/astro/pull/8263) [`9e021a91c`](https://github.com/withastro/astro/commit/9e021a91c57d10809f588dd47968fc0e7f8b4d5c) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Add a type param to AstroGlobal to type params. This will eventually be used automatically by our tooling to provide typing and completions for `Astro.params`
- [#8264](https://github.com/withastro/astro/pull/8264) [`1f58a7a1b`](https://github.com/withastro/astro/commit/1f58a7a1bea6888868b689dac94801d554319b02) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Fire `astro:unmount` event when island is disconnected
- [#8258](https://github.com/withastro/astro/pull/8258) [`1db4e92c1`](https://github.com/withastro/astro/commit/1db4e92c12ed73681217f5cefd39f2f47542f961) Thanks [@matthewp](https://github.com/matthewp)! - Allow fallback animations on html element
- Updated dependencies [[`0c7b42dc6`](https://github.com/withastro/astro/commit/0c7b42dc6780e687e416137539f55a3a427d1d10)]:
- @astrojs/telemetry@3.0.0-rc.4
## 3.0.0-rc.8
### Patch Changes

View file

@ -163,7 +163,7 @@ const { fallback = 'animate' } = Astro.props as Props;
// Everything left in the new head is new, append it all.
document.head.append(...doc.head.children);
// Move over persist stuff in the body
// Persist elements in the existing body
const oldBody = document.body;
document.body.replaceWith(doc.body);
for (const el of oldBody.querySelectorAll(`[${PERSIST_ATTR}]`)) {

View file

@ -1,3 +1,2 @@
export { default as Code } from './Code.astro';
export { default as Debug } from './Debug.astro';
export { default as ViewTransitions } from './ViewTransitions.astro';

View file

@ -4,6 +4,7 @@ import Layout from '../components/Layout.astro';
<Layout>
<article id="longpage">
<div><a id="click-one" href="/one">go to 1</a></div>
<div><a id="click-scroll-down" href="#click-one-again">go further down</a></div>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Dictum varius duis at consectetur lorem donec massa sapien faucibus. Amet mauris commodo quis imperdiet massa. Sed pulvinar proin gravida hendrerit lectus a. Magna ac placerat vestibulum lectus. Blandit cursus risus at ultrices mi tempus. Luctus venenatis lectus magna fringilla urna porttitor. Auctor eu augue ut lectus arcu bibendum at varius vel. Tristique senectus et netus et. In fermentum et sollicitudin ac orci phasellus egestas tellus rutrum. Eget lorem dolor sed viverra ipsum nunc aliquet. Amet consectetur adipiscing elit ut aliquam purus. Accumsan lacus vel facilisis volutpat est velit egestas. Felis imperdiet proin fermentum leo vel. Ut tellus elementum sagittis vitae et leo duis ut diam. Nisl pretium fusce id velit. Lorem donec massa sapien faucibus et. Nibh sed pulvinar proin gravida hendrerit lectus a. In est ante in nibh mauris cursus mattis molestie.
@ -30,7 +31,7 @@ import Layout from '../components/Layout.astro';
Viverra aliquet eget sit amet. Dui vivamus arcu felis bibendum. Pharetra convallis posuere morbi leo urna molestie at elementum eu. Parturient montes nascetur ridiculus mus mauris vitae. Mus mauris vitae ultricies leo integer malesuada nunc vel. Consequat semper viverra nam libero. Amet venenatis urna cursus eget nunc scelerisque. Amet risus nullam eget felis eget nunc lobortis. Venenatis urna cursus eget nunc. Sagittis id consectetur purus ut faucibus pulvinar. Posuere sollicitudin aliquam ultrices sagittis orci a scelerisque purus semper.
<div><a id="click-one-again" href="/one">go to 1</a></div>
<div><a id="click-scroll-up" href="#longpage">go back up</a></div>
Morbi tristique senectus et netus et. Neque aliquam vestibulum morbi blandit cursus risus. Pharetra pharetra massa massa ultricies mi quis. Sit amet aliquam id diam maecenas ultricies mi eget mauris. Ultrices mi tempus imperdiet nulla malesuada. At consectetur lorem donec massa sapien faucibus et molestie. Non sodales neque sodales ut etiam. Eget nunc lobortis mattis aliquam faucibus purus in massa tempor. Viverra suspendisse potenti nullam ac tortor vitae purus faucibus. Pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum. Diam vulputate ut pharetra sit. Felis donec et odio pellentesque diam. Mollis aliquam ut porttitor leo. Vitae nunc sed velit dignissim sodales. Facilisis mauris sit amet massa vitae tortor condimentum lacinia quis.
Aliquet enim tortor at auctor urna nunc id cursus. Bibendum at varius vel pharetra vel turpis nunc eget. Mattis molestie a iaculis at erat. Vel turpis nunc eget lorem dolor sed viverra ipsum nunc. Aliquam malesuada bibendum arcu vitae elementum curabitur vitae nunc sed. Nunc congue nisi vitae suscipit. Donec massa sapien faucibus et molestie ac. Nec feugiat nisl pretium fusce. At imperdiet dui accumsan sit amet nulla facilisi. Sed viverra tellus in hac.

View file

@ -264,6 +264,28 @@ test.describe('View Transitions', () => {
expect(oldScrollY).toEqual(newScrollY);
});
test('Fragment scroll position restored on back button', async ({ page, astro }) => {
// Go to the long page
await page.goto(astro.resolveUrl('/long-page'));
let locator = page.locator('#longpage');
await expect(locator).toBeInViewport();
// Scroll down to middle fragment
await page.click('#click-scroll-down');
locator = page.locator('#click-one-again');
await expect(locator).toBeInViewport();
// Scroll up to top fragment
await page.click('#click-scroll-up');
locator = page.locator('#longpage');
await expect(locator).toBeInViewport();
// Back to middle of the page
await page.goBack();
locator = page.locator('#click-one-again');
await expect(locator).toBeInViewport();
});
test('Scroll position restored on forward button', async ({ page, astro }) => {
// Go to page 1
await page.goto(astro.resolveUrl('/one'));
@ -290,6 +312,28 @@ test.describe('View Transitions', () => {
expect(oldScrollY).toEqual(newScrollY);
});
test('Fragment scroll position restored on forward button', async ({ page, astro }) => {
// Go to the long page
await page.goto(astro.resolveUrl('/long-page'));
let locator = page.locator('#longpage');
await expect(locator).toBeInViewport();
// Scroll down to middle fragment
await page.click('#click-scroll-down');
locator = page.locator('#click-one-again');
await expect(locator).toBeInViewport();
// Scroll back to top
await page.goBack();
locator = page.locator('#longpage');
await expect(locator).toBeInViewport();
// Forward to middle of page
await page.goForward();
locator = page.locator('#click-one-again');
await expect(locator).toBeInViewport();
});
test('<Image /> component forwards transitions to the <img>', async ({ page, astro }) => {
// Go to page 1
await page.goto(astro.resolveUrl('/image-one'));
@ -402,7 +446,6 @@ test.describe('View Transitions', () => {
});
test('Navigation also swaps the attributes of the document root', async ({ page, astro }) => {
page.on('console', (msg) => console.log(msg.text()));
await page.goto(astro.resolveUrl('/some-attributes'));
let p = page.locator('#heading');
await expect(p, 'should have content').toHaveText('Page with some attributes');

View file

@ -1,6 +1,6 @@
{
"name": "astro",
"version": "3.0.0-rc.8",
"version": "3.0.0-rc.11",
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
"type": "module",
"author": "withastro",

View file

@ -147,8 +147,9 @@ export interface CLIFlags {
export interface AstroGlobal<
Props extends Record<string, any> = Record<string, any>,
Self = AstroComponentFactory,
Params extends Record<string, string | undefined> = Record<string, string | undefined>,
> extends AstroGlobalPartial,
AstroSharedContext<Props> {
AstroSharedContext<Props, Params> {
/**
* A full URL object of the request URL.
* Equivalent to: `new URL(Astro.request.url)`
@ -174,7 +175,7 @@ export interface AstroGlobal<
*
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#astroparams)
*/
params: AstroSharedContext['params'];
params: AstroSharedContext<Props, Params>['params'];
/** List of props passed to this component
*
* A common way to get specific props is through [destructuring](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment), ex:
@ -184,7 +185,7 @@ export interface AstroGlobal<
*
* [Astro reference](https://docs.astro.build/en/core-concepts/astro-components/#component-props)
*/
props: AstroSharedContext<Props>['props'];
props: AstroSharedContext<Props, Params>['props'];
/** Information about the current request. This is a standard [Request](https://developer.mozilla.org/en-US/docs/Web/API/Request) object
*
* For example, to get a URL object of the current URL, you can use:
@ -622,7 +623,7 @@ export interface AstroUserConfig {
*
* Using `'class'` is helpful when you want to ensure that element selectors within an Astro component override global style defaults (e.g. from a global stylesheet).
* Using `'where'` gives you more control over specifity, but requires that you use higher-specifity selectors, layers, and other tools to control which selectors are applied.
* Using 'attribute' is useful when you are manipulating the `class` attribute of elements and need to avoid conflicts between your own styling logic and Astro's application of styles.
* Using `'attribute'` is useful when you are manipulating the `class` attribute of elements and need to avoid conflicts between your own styling logic and Astro's application of styles.
*/
scopedStyleStrategy?: 'where' | 'class' | 'attribute';
@ -1807,7 +1808,10 @@ type Body = string;
export type ValidRedirectStatus = 300 | 301 | 302 | 303 | 304 | 307 | 308;
// Shared types between `Astro` global and API context object
interface AstroSharedContext<Props extends Record<string, any> = Record<string, any>> {
interface AstroSharedContext<
Props extends Record<string, any> = Record<string, any>,
RouteParams extends Record<string, string | undefined> = Record<string, string | undefined>,
> {
/**
* The address (usually IP address) of the user. Used with SSR only.
*/
@ -1827,7 +1831,7 @@ interface AstroSharedContext<Props extends Record<string, any> = Record<string,
/**
* Route parameters for this request if this is a dynamic route.
*/
params: Params;
params: RouteParams;
/**
* List of props returned for this path by `getStaticPaths` (**Static Only**).
*/
@ -1843,8 +1847,10 @@ interface AstroSharedContext<Props extends Record<string, any> = Record<string,
locals: App.Locals;
}
export interface APIContext<Props extends Record<string, any> = Record<string, any>>
extends AstroSharedContext<Props> {
export interface APIContext<
Props extends Record<string, any> = Record<string, any>,
APIParams extends Record<string, string | undefined> = Record<string, string | undefined>,
> extends AstroSharedContext<Props, Params> {
site: URL | undefined;
generator: string;
/**
@ -1876,7 +1882,7 @@ export interface APIContext<Props extends Record<string, any> = Record<string, a
*
* [context reference](https://docs.astro.build/en/reference/api-reference/#contextparams)
*/
params: AstroSharedContext['params'];
params: AstroSharedContext<Props, APIParams>['params'];
/**
* List of props passed from `getStaticPaths`. Only available to static builds.
*
@ -1899,7 +1905,7 @@ export interface APIContext<Props extends Record<string, any> = Record<string, a
*
* [context reference](https://docs.astro.build/en/guides/api-reference/#contextprops)
*/
props: AstroSharedContext<Props>['props'];
props: AstroSharedContext<Props, APIParams>['props'];
/**
* Redirect to another page. Only available in SSR builds.
*

View file

@ -29,6 +29,9 @@ const ASTRO_CONFIG_DEFAULTS = {
split: false,
excludeMiddleware: false,
},
image: {
service: { entrypoint: 'astro/assets/services/sharp', config: {} },
},
compressHTML: true,
server: {
host: false,
@ -180,14 +183,18 @@ export const AstroConfigSchema = z.object({
.default(ASTRO_CONFIG_DEFAULTS.redirects),
image: z
.object({
service: z.object({
entrypoint: z.union([
z.literal('astro/assets/services/sharp'),
z.literal('astro/assets/services/squoosh'),
z.string(),
]),
config: z.record(z.any()).default({}),
}),
service: z
.object({
entrypoint: z
.union([
z.literal('astro/assets/services/sharp'),
z.literal('astro/assets/services/squoosh'),
z.string(),
])
.default(ASTRO_CONFIG_DEFAULTS.image.service.entrypoint),
config: z.record(z.any()).default({}),
})
.default(ASTRO_CONFIG_DEFAULTS.image.service),
domains: z.array(z.string()).default([]),
remotePatterns: z
.array(
@ -213,9 +220,7 @@ export const AstroConfigSchema = z.object({
)
.default([]),
})
.default({
service: { entrypoint: 'astro/assets/services/sharp', config: {} },
}),
.default(ASTRO_CONFIG_DEFAULTS.image),
markdown: z
.object({
drafts: z.boolean().default(false),

View file

@ -51,6 +51,10 @@ declare const Astro: {
public Component: any;
public hydrator: any;
static observedAttributes = ['props'];
disconnectedCallback() {
document.removeEventListener('astro:after-swap', this.unmount);
document.addEventListener('astro:after-swap', this.unmount, { once: true });
}
connectedCallback() {
if (!this.hasAttribute('await-children') || this.firstChild) {
this.childrenConnectedCallback();
@ -166,6 +170,10 @@ declare const Astro: {
attributeChangedCallback() {
this.hydrate();
}
unmount = () => {
// If element wasn't persisted, fire unmount event
if (!this.isConnected) this.dispatchEvent(new CustomEvent('astro:unmount'));
};
}
);
}

View file

@ -23,4 +23,11 @@ describe('Code component', () => {
let $ = cheerio.load(html);
expect($('pre').attr('is:raw')).to.equal(undefined);
});
// ViewTransitions bug
it('No script should be added to the page', async () => {
let html = await fixture.readFile('/index.html');
let $ = cheerio.load(html);
expect($('script')).to.have.a.lengthOf(0);
});
});

View file

@ -45,7 +45,7 @@
"tiny-glob": "^0.2.9"
},
"peerDependencies": {
"astro": "workspace:^3.0.0-rc.8"
"astro": "workspace:^3.0.0-rc.11"
},
"devDependencies": {
"astro": "workspace:*",

View file

@ -36,7 +36,7 @@
"esbuild": "^0.19.2"
},
"peerDependencies": {
"astro": "workspace:^3.0.0-rc.8"
"astro": "workspace:^3.0.0-rc.11"
},
"devDependencies": {
"astro": "workspace:*",

View file

@ -75,7 +75,7 @@
"zod": "3.21.1"
},
"peerDependencies": {
"astro": "workspace:^3.0.0-rc.8"
"astro": "workspace:^3.0.0-rc.11"
},
"devDependencies": {
"@astrojs/markdown-remark": "workspace:*",

View file

@ -54,7 +54,7 @@
"vfile": "^5.3.7"
},
"peerDependencies": {
"astro": "workspace:^3.0.0-rc.8"
"astro": "workspace:^3.0.0-rc.11"
},
"devDependencies": {
"@types/chai": "^4.3.5",

View file

@ -43,7 +43,7 @@
"esbuild": "^0.19.2"
},
"peerDependencies": {
"astro": "workspace:^3.0.0-rc.8"
"astro": "workspace:^3.0.0-rc.11"
},
"devDependencies": {
"@netlify/edge-functions": "^2.0.0",

View file

@ -37,7 +37,7 @@
"server-destroy": "^1.0.1"
},
"peerDependencies": {
"astro": "workspace:^3.0.0-rc.8"
"astro": "workspace:^3.0.0-rc.11"
},
"devDependencies": {
"@types/node": "^18.17.8",

View file

@ -1,5 +1,11 @@
# @astrojs/preact
## 3.0.0-rc.3
### Patch Changes
- [#8264](https://github.com/withastro/astro/pull/8264) [`1f58a7a1b`](https://github.com/withastro/astro/commit/1f58a7a1bea6888868b689dac94801d554319b02) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Automatically unmount islands when `astro:unmount` is fired
## 3.0.0-rc.2
### Major Changes

View file

@ -1,7 +1,7 @@
{
"name": "@astrojs/preact",
"description": "Use Preact components within Astro",
"version": "3.0.0-rc.2",
"version": "3.0.0-rc.3",
"type": "module",
"types": "./dist/index.d.ts",
"author": "withastro",

View file

@ -1,4 +1,4 @@
import { h, render, type JSX } from 'preact';
import { h, hydrate, render } from 'preact';
import StaticHtml from './static-html.js';
import type { SignalLike } from './types';
@ -8,7 +8,8 @@ export default (element: HTMLElement) =>
async (
Component: any,
props: Record<string, any>,
{ default: children, ...slotted }: Record<string, any>
{ default: children, ...slotted }: Record<string, any>,
{ client }: Record<string, string>
) => {
if (!element.hasAttribute('ssr')) return;
for (const [key, value] of Object.entries(slotted)) {
@ -27,23 +28,13 @@ export default (element: HTMLElement) =>
}
}
// eslint-disable-next-line @typescript-eslint/no-shadow
function Wrapper({ children }: { children: JSX.Element }) {
let attrs = Object.fromEntries(
Array.from(element.attributes).map((attr) => [attr.name, attr.value])
);
return h(element.localName, attrs, children);
}
const bootstrap = client !== 'only' ? hydrate : render;
let parent = element.parentNode as Element;
render(
h(
Wrapper,
null,
h(Component, props, children != null ? h(StaticHtml, { value: children }) : children)
),
parent,
bootstrap(
h(Component, props, children != null ? h(StaticHtml, { value: children }) : children),
element
);
// Preact has no "unmount" option, but you can use `render(null, element)`
element.addEventListener('astro:unmount', () => render(null, element), { once: true });
};

View file

@ -1,5 +1,11 @@
# @astrojs/react
## 3.0.0-rc.6
### Patch Changes
- [#8264](https://github.com/withastro/astro/pull/8264) [`1f58a7a1b`](https://github.com/withastro/astro/commit/1f58a7a1bea6888868b689dac94801d554319b02) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Automatically unmount islands when `astro:unmount` is fired
## 3.0.0-rc.5
### Patch Changes

View file

@ -1,5 +1,5 @@
import { createElement } from 'react';
import { render, hydrate } from 'react-dom';
import { render, hydrate, unmountComponentAtNode } from 'react-dom';
import StaticHtml from './static-html.js';
export default (element) =>
@ -12,8 +12,11 @@ export default (element) =>
props,
children != null ? createElement(StaticHtml, { value: children }) : children
);
if (client === 'only') {
return render(componentEl, element);
}
return hydrate(componentEl, element);
const isHydrate = client !== 'only';
const bootstrap = isHydrate ? hydrate : render;
bootstrap(componentEl, element);
element.addEventListener('astro:unmount', () => unmountComponentAtNode(element), {
once: true,
});
};

View file

@ -31,10 +31,14 @@ export default (element) =>
}
if (client === 'only') {
return startTransition(() => {
createRoot(element).render(componentEl);
const root = createRoot(element);
root.render(componentEl);
element.addEventListener('astro:unmount', () => root.unmount(), { once: true });
});
}
return startTransition(() => {
hydrateRoot(element, componentEl, renderOptions);
startTransition(() => {
const root = hydrateRoot(element, componentEl, renderOptions);
root.render(componentEl);
element.addEventListener('astro:unmount', () => root.unmount(), { once: true });
});
};

View file

@ -1,7 +1,7 @@
{
"name": "@astrojs/react",
"description": "Use React components within Astro",
"version": "3.0.0-rc.5",
"version": "3.0.0-rc.6",
"type": "module",
"types": "./dist/index.d.ts",
"author": "withastro",

View file

@ -1,5 +1,11 @@
# @astrojs/solid-js
## 3.0.0-rc.4
### Patch Changes
- [#8264](https://github.com/withastro/astro/pull/8264) [`1f58a7a1b`](https://github.com/withastro/astro/commit/1f58a7a1bea6888868b689dac94801d554319b02) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Automatically unmount islands when `astro:unmount` is fired
## 3.0.0-rc.3
### Major Changes

View file

@ -1,6 +1,6 @@
{
"name": "@astrojs/solid-js",
"version": "3.0.0-rc.3",
"version": "3.0.0-rc.4",
"description": "Use Solid components within Astro",
"type": "module",
"types": "./dist/index.d.ts",

View file

@ -9,7 +9,7 @@ export default (element: HTMLElement) =>
}
if (!element.hasAttribute('ssr')) return;
const fn = client === 'only' ? render : hydrate;
const boostrap = client === 'only' ? render : hydrate;
let _slots: Record<string, any> = {};
if (Object.keys(slotted).length > 0) {
@ -30,7 +30,7 @@ export default (element: HTMLElement) =>
const { default: children, ...slots } = _slots;
const renderId = element.dataset.solidRenderId;
fn(
const dispose = boostrap(
() =>
createComponent(Component, {
...props,
@ -42,4 +42,6 @@ export default (element: HTMLElement) =>
renderId,
}
);
element.addEventListener('astro:unmount', () => dispose(), { once: true });
};

View file

@ -1,5 +1,14 @@
# @astrojs/svelte
## 4.0.0-rc.3
### Patch Changes
- [#8264](https://github.com/withastro/astro/pull/8264) [`1f58a7a1b`](https://github.com/withastro/astro/commit/1f58a7a1bea6888868b689dac94801d554319b02) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Automatically unmount islands when `astro:unmount` is fired
- Updated dependencies [[`0c7b42dc6`](https://github.com/withastro/astro/commit/0c7b42dc6780e687e416137539f55a3a427d1d10), [`9e021a91c`](https://github.com/withastro/astro/commit/9e021a91c57d10809f588dd47968fc0e7f8b4d5c), [`1f58a7a1b`](https://github.com/withastro/astro/commit/1f58a7a1bea6888868b689dac94801d554319b02), [`1db4e92c1`](https://github.com/withastro/astro/commit/1db4e92c12ed73681217f5cefd39f2f47542f961)]:
- astro@3.0.0-rc.9
## 4.0.0-rc.2
### Major Changes

View file

@ -14,7 +14,7 @@ export default (target) => {
try {
if (import.meta.env.DEV) useConsoleFilter();
new Component({
const component = new Component({
target,
props: {
...props,
@ -24,6 +24,8 @@ export default (target) => {
hydrate: client !== 'only',
$$inline: true,
});
element.addEventListener('astro:unmount', () => component.$destroy(), { once: true });
} catch (e) {
} finally {
if (import.meta.env.DEV) finishUsingConsoleFilter();

View file

@ -1,6 +1,6 @@
{
"name": "@astrojs/svelte",
"version": "4.0.0-rc.2",
"version": "4.0.0-rc.3",
"description": "Use Svelte components within Astro",
"type": "module",
"types": "./dist/index.d.ts",
@ -48,7 +48,7 @@
"vite": "^4.4.9"
},
"peerDependencies": {
"astro": "workspace:^3.0.0-rc.8",
"astro": "workspace:^3.0.0-rc.11",
"svelte": "^3.55.0 || ^4.0.0"
},
"engines": {

View file

@ -43,7 +43,7 @@
"vite": "^4.4.9"
},
"peerDependencies": {
"astro": "workspace:^3.0.0-rc.8",
"astro": "workspace:^3.0.0-rc.11",
"tailwindcss": "^3.0.24"
}
}

View file

@ -60,7 +60,7 @@
"web-vitals": "^3.4.0"
},
"peerDependencies": {
"astro": "workspace:^3.0.0-rc.8"
"astro": "workspace:^3.0.0-rc.11"
},
"devDependencies": {
"@types/set-cookie-parser": "^2.4.3",

View file

@ -1,5 +1,14 @@
# @astrojs/vue
## 3.0.0-rc.2
### Patch Changes
- [#8264](https://github.com/withastro/astro/pull/8264) [`1f58a7a1b`](https://github.com/withastro/astro/commit/1f58a7a1bea6888868b689dac94801d554319b02) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Automatically unmount islands when `astro:unmount` is fired
- Updated dependencies [[`0c7b42dc6`](https://github.com/withastro/astro/commit/0c7b42dc6780e687e416137539f55a3a427d1d10), [`9e021a91c`](https://github.com/withastro/astro/commit/9e021a91c57d10809f588dd47968fc0e7f8b4d5c), [`1f58a7a1b`](https://github.com/withastro/astro/commit/1f58a7a1bea6888868b689dac94801d554319b02), [`1db4e92c1`](https://github.com/withastro/astro/commit/1db4e92c12ed73681217f5cefd39f2f47542f961)]:
- astro@3.0.0-rc.9
## 3.0.0-rc.1
### Major Changes

View file

@ -21,15 +21,13 @@ export default (element) =>
content = h(Suspense, null, content);
}
if (client === 'only') {
const app = createApp({ name, render: () => content });
await setup(app);
app.mount(element, false);
} else {
const app = createSSRApp({ name, render: () => content });
await setup(app);
app.mount(element, true);
}
const isHydrate = client !== 'only';
const boostrap = isHydrate ? createSSRApp : createApp;
const app = boostrap({ name, render: () => content });
await setup(app);
app.mount(element, isHydrate);
element.addEventListener('astro:unmount', () => app.unmount(), { once: true });
};
function isAsync(fn) {

View file

@ -1,6 +1,6 @@
{
"name": "@astrojs/vue",
"version": "3.0.0-rc.1",
"version": "3.0.0-rc.2",
"description": "Use Vue components within Astro",
"type": "module",
"types": "./dist/index.d.ts",
@ -56,7 +56,7 @@
"vue": "^3.3.4"
},
"peerDependencies": {
"astro": "workspace:^3.0.0-rc.8",
"astro": "workspace:^3.0.0-rc.11",
"vue": "^3.2.30"
},
"engines": {

View file

@ -1,5 +1,11 @@
# @astrojs/telemetry
## 3.0.0-rc.4
### Patch Changes
- [#8234](https://github.com/withastro/astro/pull/8234) [`0c7b42dc6`](https://github.com/withastro/astro/commit/0c7b42dc6780e687e416137539f55a3a427d1d10) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Update telemetry notice
## 3.0.0-rc.3
### Major Changes

View file

@ -1,6 +1,6 @@
{
"name": "@astrojs/telemetry",
"version": "3.0.0-rc.3",
"version": "3.0.0-rc.4",
"type": "module",
"types": "./dist/types/index.d.ts",
"author": "withastro",

View file

@ -125,7 +125,7 @@ importers:
examples/basics:
dependencies:
astro:
specifier: ^3.0.0-rc.8
specifier: ^3.0.0-rc.11
version: link:../../packages/astro
examples/blog:
@ -140,19 +140,19 @@ importers:
specifier: ^3.0.0-rc.1
version: link:../../packages/integrations/sitemap
astro:
specifier: ^3.0.0-rc.8
specifier: ^3.0.0-rc.11
version: link:../../packages/astro
examples/component:
devDependencies:
astro:
specifier: ^3.0.0-rc.8
specifier: ^3.0.0-rc.11
version: link:../../packages/astro
examples/deno:
dependencies:
astro:
specifier: ^3.0.0-rc.8
specifier: ^3.0.0-rc.11
version: link:../../packages/astro
devDependencies:
'@astrojs/deno':
@ -171,7 +171,7 @@ importers:
specifier: ^3.12.3
version: 3.12.3
astro:
specifier: ^3.0.0-rc.8
specifier: ^3.0.0-rc.11
version: link:../../packages/astro
examples/framework-lit:
@ -183,7 +183,7 @@ importers:
specifier: ^0.2.1
version: 0.2.1
astro:
specifier: ^3.0.0-rc.8
specifier: ^3.0.0-rc.11
version: link:../../packages/astro
lit:
specifier: ^2.8.0
@ -192,22 +192,22 @@ importers:
examples/framework-multiple:
dependencies:
'@astrojs/preact':
specifier: ^3.0.0-rc.2
specifier: ^3.0.0-rc.3
version: link:../../packages/integrations/preact
'@astrojs/react':
specifier: ^3.0.0-rc.5
specifier: ^3.0.0-rc.6
version: link:../../packages/integrations/react
'@astrojs/solid-js':
specifier: ^3.0.0-rc.3
specifier: ^3.0.0-rc.4
version: link:../../packages/integrations/solid
'@astrojs/svelte':
specifier: ^4.0.0-rc.2
specifier: ^4.0.0-rc.3
version: link:../../packages/integrations/svelte
'@astrojs/vue':
specifier: ^3.0.0-rc.1
specifier: ^3.0.0-rc.2
version: link:../../packages/integrations/vue
astro:
specifier: ^3.0.0-rc.8
specifier: ^3.0.0-rc.11
version: link:../../packages/astro
preact:
specifier: ^10.17.1
@ -231,13 +231,13 @@ importers:
examples/framework-preact:
dependencies:
'@astrojs/preact':
specifier: ^3.0.0-rc.2
specifier: ^3.0.0-rc.3
version: link:../../packages/integrations/preact
'@preact/signals':
specifier: ^1.2.1
version: 1.2.1(preact@10.17.1)
astro:
specifier: ^3.0.0-rc.8
specifier: ^3.0.0-rc.11
version: link:../../packages/astro
preact:
specifier: ^10.17.1
@ -246,7 +246,7 @@ importers:
examples/framework-react:
dependencies:
'@astrojs/react':
specifier: ^3.0.0-rc.5
specifier: ^3.0.0-rc.6
version: link:../../packages/integrations/react
'@types/react':
specifier: ^18.2.21
@ -255,7 +255,7 @@ importers:
specifier: ^18.2.7
version: 18.2.7
astro:
specifier: ^3.0.0-rc.8
specifier: ^3.0.0-rc.11
version: link:../../packages/astro
react:
specifier: ^18.2.0
@ -267,10 +267,10 @@ importers:
examples/framework-solid:
dependencies:
'@astrojs/solid-js':
specifier: ^3.0.0-rc.3
specifier: ^3.0.0-rc.4
version: link:../../packages/integrations/solid
astro:
specifier: ^3.0.0-rc.8
specifier: ^3.0.0-rc.11
version: link:../../packages/astro
solid-js:
specifier: ^1.7.11
@ -279,10 +279,10 @@ importers:
examples/framework-svelte:
dependencies:
'@astrojs/svelte':
specifier: ^4.0.0-rc.2
specifier: ^4.0.0-rc.3
version: link:../../packages/integrations/svelte
astro:
specifier: ^3.0.0-rc.8
specifier: ^3.0.0-rc.11
version: link:../../packages/astro
svelte:
specifier: ^4.2.0
@ -291,10 +291,10 @@ importers:
examples/framework-vue:
dependencies:
'@astrojs/vue':
specifier: ^3.0.0-rc.1
specifier: ^3.0.0-rc.2
version: link:../../packages/integrations/vue
astro:
specifier: ^3.0.0-rc.8
specifier: ^3.0.0-rc.11
version: link:../../packages/astro
vue:
specifier: ^3.3.4
@ -306,13 +306,13 @@ importers:
specifier: ^6.0.0-rc.1
version: link:../../packages/integrations/node
astro:
specifier: ^3.0.0-rc.8
specifier: ^3.0.0-rc.11
version: link:../../packages/astro
examples/integration:
devDependencies:
astro:
specifier: ^3.0.0-rc.8
specifier: ^3.0.0-rc.11
version: link:../../packages/astro
examples/middleware:
@ -321,7 +321,7 @@ importers:
specifier: ^6.0.0-rc.1
version: link:../../packages/integrations/node
astro:
specifier: ^3.0.0-rc.8
specifier: ^3.0.0-rc.11
version: link:../../packages/astro
html-minifier:
specifier: ^4.0.0
@ -330,19 +330,19 @@ importers:
examples/minimal:
dependencies:
astro:
specifier: ^3.0.0-rc.8
specifier: ^3.0.0-rc.11
version: link:../../packages/astro
examples/non-html-pages:
dependencies:
astro:
specifier: ^3.0.0-rc.8
specifier: ^3.0.0-rc.11
version: link:../../packages/astro
examples/portfolio:
dependencies:
astro:
specifier: ^3.0.0-rc.8
specifier: ^3.0.0-rc.11
version: link:../../packages/astro
examples/ssr:
@ -351,10 +351,10 @@ importers:
specifier: ^6.0.0-rc.1
version: link:../../packages/integrations/node
'@astrojs/svelte':
specifier: ^4.0.0-rc.2
specifier: ^4.0.0-rc.3
version: link:../../packages/integrations/svelte
astro:
specifier: ^3.0.0-rc.8
specifier: ^3.0.0-rc.11
version: link:../../packages/astro
svelte:
specifier: ^4.2.0
@ -366,7 +366,7 @@ importers:
specifier: ^0.5.0-rc.1
version: link:../../packages/integrations/markdoc
astro:
specifier: ^3.0.0-rc.8
specifier: ^3.0.0-rc.11
version: link:../../packages/astro
examples/with-markdown-plugins:
@ -375,7 +375,7 @@ importers:
specifier: ^3.0.0-rc.1
version: link:../../packages/markdown/remark
astro:
specifier: ^3.0.0-rc.8
specifier: ^3.0.0-rc.11
version: link:../../packages/astro
hast-util-select:
specifier: ^5.0.5
@ -396,7 +396,7 @@ importers:
examples/with-markdown-shiki:
dependencies:
astro:
specifier: ^3.0.0-rc.8
specifier: ^3.0.0-rc.11
version: link:../../packages/astro
examples/with-mdx:
@ -405,10 +405,10 @@ importers:
specifier: ^1.0.0-rc.2
version: link:../../packages/integrations/mdx
'@astrojs/preact':
specifier: ^3.0.0-rc.2
specifier: ^3.0.0-rc.3
version: link:../../packages/integrations/preact
astro:
specifier: ^3.0.0-rc.8
specifier: ^3.0.0-rc.11
version: link:../../packages/astro
preact:
specifier: ^10.17.1
@ -417,13 +417,13 @@ importers:
examples/with-nanostores:
dependencies:
'@astrojs/preact':
specifier: ^3.0.0-rc.2
specifier: ^3.0.0-rc.3
version: link:../../packages/integrations/preact
'@nanostores/preact':
specifier: ^0.5.0
version: 0.5.0(nanostores@0.9.3)(preact@10.17.1)
astro:
specifier: ^3.0.0-rc.8
specifier: ^3.0.0-rc.11
version: link:../../packages/astro
nanostores:
specifier: ^0.9.3
@ -444,7 +444,7 @@ importers:
specifier: ^1.6.0
version: 1.6.0
astro:
specifier: ^3.0.0-rc.8
specifier: ^3.0.0-rc.11
version: link:../../packages/astro
autoprefixer:
specifier: ^10.4.15
@ -462,7 +462,7 @@ importers:
examples/with-vite-plugin-pwa:
dependencies:
astro:
specifier: ^3.0.0-rc.8
specifier: ^3.0.0-rc.11
version: link:../../packages/astro
vite-plugin-pwa:
specifier: 0.16.4
@ -474,7 +474,7 @@ importers:
examples/with-vitest:
dependencies:
astro:
specifier: ^3.0.0-rc.8
specifier: ^3.0.0-rc.11
version: link:../../packages/astro
vitest:
specifier: ^0.34.2