Skip to content

Commit

Permalink
Merge branch 'next' into alexanderniebuhr/7948-port-functionPerRoute
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderniebuhr authored Aug 17, 2023
2 parents 3880256 + bbf0b74 commit c068f41
Show file tree
Hide file tree
Showing 183 changed files with 2,550 additions and 1,596 deletions.
5 changes: 5 additions & 0 deletions .changeset/big-elephants-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/svelte': patch
---

Filter unknown `class` prop warnings
5 changes: 5 additions & 0 deletions .changeset/brown-wolves-tan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-astro': patch
---

Update 'dev' command for Bun users
13 changes: 13 additions & 0 deletions .changeset/clever-bats-breathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'astro': major
---

This import alias is no longer included by default with astro:assets. If you were using this alias with experimental assets, you must convert them to relative file paths, or create your own [import aliases](https://docs.astro.build/en/guides/aliases/).

```diff
---
// src/pages/posts/post-1.astro
- import rocket from '~/assets/rocket.png'
+ import rocket from '../../assets/rocket.png';
---
```
5 changes: 5 additions & 0 deletions .changeset/eleven-wasps-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Ensure dotfiles are cleaned during static builds
5 changes: 0 additions & 5 deletions .changeset/green-islands-repeat.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/itchy-pants-grin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/vercel': patch
---

Update image support to work with latest version of Astro
5 changes: 0 additions & 5 deletions .changeset/lazy-pillows-burn.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/many-actors-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": patch
---

Fix a handful of edge cases with prerendered 404/500 pages
5 changes: 0 additions & 5 deletions .changeset/moody-houses-drum.md

This file was deleted.

8 changes: 8 additions & 0 deletions .changeset/neat-mugs-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'astro': minor
---


`astro:`namespace aliases for middleware and components

This adds aliases of `astro:middleware` and `astro:components` for the middleware and components modules. This is to make our documentation consistent between are various modules, where some are virtual modules and others are not. Going forward new built-in modules will use this namespace.
5 changes: 0 additions & 5 deletions .changeset/odd-plants-tie.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/olive-queens-drum.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/orange-foxes-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/solid-js': patch
---

Update `babel-preset-solid` dependency to `^1.7.7`
5 changes: 5 additions & 0 deletions .changeset/popular-planes-cover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

ViewTransition: bug fix for lost scroll position in browser history
5 changes: 5 additions & 0 deletions .changeset/silent-baboons-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-astro': patch
---

Verify internet connection and that `--template` exists before continuing
5 changes: 0 additions & 5 deletions .changeset/soft-colts-heal.md

This file was deleted.

27 changes: 27 additions & 0 deletions .changeset/sour-frogs-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
'astro': patch
---

Added support for optimizing remote images from authorized sources when using `astro:assets`. This comes with two new parameters to specify which domains (`image.domains`) and host patterns (`image.remotePatterns`) are authorized for remote images.

For example, the following configuration will only allow remote images from `astro.build` to be optimized:

```ts
// astro.config.mjs
export default defineConfig({
image: {
domains: ["astro.build"],
}
});
```

The following configuration will only allow remote images from HTTPS hosts:

```ts
// astro.config.mjs
export default defineConfig({
image: {
remotePatterns: [{ protocol: "https" }],
}
});
```
5 changes: 0 additions & 5 deletions .changeset/thin-plums-drop.md

This file was deleted.

21 changes: 21 additions & 0 deletions .changeset/yellow-snakes-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
'@astrojs/react': minor
---

Optionally parse React slots as React children.

This adds a new configuration option for the React integration `experimentalReactChildren`:

```js
export default {
integrations: [
react({
experimentalReactChildren: true,
})
]
}
```

With this enabled, children passed to React from Astro components via the default slot are parsed as React components.

This enables better compatibility with certain React components which manipulate their children.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Astro is generously supported by Netlify, Storyblok, and several other amazing o

[![Astro's sponsors.](https://astro.build/sponsors.png "Astro's sponsors.
Platinum sponsors: Netlify, storyblok, Vercel, Ship Shape, Google Chrome
Gold sponsors: ‹div›RIOTS, DEEPGRAM, CloudCannon
Gold sponsors: ‹div›RIOTS, DEEPGRAM, Transloadit, CloudCannon
Sponsors: Monogram, Qoddi, Dimension")](https://github.com/sponsors/withastro)

</a>
Expand Down
2 changes: 1 addition & 1 deletion examples/middleware/src/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineMiddleware, sequence } from 'astro/middleware';
import { defineMiddleware, sequence } from 'astro:middleware';
import htmlMinifier from 'html-minifier';

const limit = 50;
Expand Down
46 changes: 43 additions & 3 deletions examples/portfolio/src/components/Nav.astro
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,45 @@ const iconLinks: { label: string; href: string; icon: keyof typeof iconPaths }[]
</template>
</menu-button>
</div>
<div id="menu-content">
<noscript class="menu-noscript">
<ul class="nav-items">
{
textLinks.map(({ label, href }) => (
<li>
<a
aria-current={Astro.url.pathname === href}
class:list={[
'link',
{
active:
Astro.url.pathname === href ||
(href !== '/' && Astro.url.pathname.startsWith(href)),
},
]}
href={href}
>
{label}
</a>
</li>
))
}
</ul>
</noscript>
<noscript style="display: contents;">
<div class="menu-footer">
<div class="socials">
{
iconLinks.map(({ href, icon, label }) => (
<a href={href} class="social">
<span class="sr-only">{label}</span>
<Icon icon={icon} />
</a>
))
}
</div>
</div>
</noscript>
<div id="menu-content" hidden>
<ul class="nav-items">
{
textLinks.map(({ label, href }) => (
Expand Down Expand Up @@ -90,6 +128,8 @@ const iconLinks: { label: string; href: string; icon: keyof typeof iconPaths }[]
// Hide menu (shown by default to support no-JS browsers).
const menu = document.getElementById('menu-content')!;
menu.hidden = true;
// Add "menu-content" class in JS to avoid covering content in non-JS browsers.
menu.classList.add('menu-content');

/** Set whether the menu is currently expanded or collapsed. */
const setExpanded = (expand: boolean) => {
Expand Down Expand Up @@ -169,7 +209,7 @@ const iconLinks: { label: string; href: string; icon: keyof typeof iconPaths }[]
z-index: -1;
}

#menu-content {
.menu-content {
position: absolute;
left: 0;
right: 0;
Expand Down Expand Up @@ -254,7 +294,7 @@ const iconLinks: { label: string; href: string; icon: keyof typeof iconPaths }[]
font-size: var(--text-lg);
}

#menu-content {
.menu-content {
display: contents;
}

Expand Down
4 changes: 2 additions & 2 deletions examples/with-markdoc/src/pages/index.astro
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
import { getEntryBySlug } from 'astro:content';
import { getEntry } from 'astro:content';
import Layout from '../layouts/Layout.astro';
const intro = await getEntryBySlug('docs', 'intro');
const intro = await getEntry('docs', 'intro');
const { Content } = await intro.render();
---

Expand Down
22 changes: 22 additions & 0 deletions packages/astro/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,28 @@
- @astrojs/internal-helpers@0.2.0-beta.0
- @astrojs/markdown-remark@3.0.0-beta.0

## 2.10.9

### Patch Changes

- [#8091](https://github.com/withastro/astro/pull/8091) [`56e7c5177`](https://github.com/withastro/astro/commit/56e7c5177bd61b404978dc9b82e2d34d76a4b2f9) Thanks [@martrapp](https://github.com/martrapp)! - Handle `<noscript>` tags in `<head>` during ViewTransitions

## 2.10.8

### Patch Changes

- [#7702](https://github.com/withastro/astro/pull/7702) [`c19987df0`](https://github.com/withastro/astro/commit/c19987df0be3520cf774476cea270c03edd08354) Thanks [@shishkin](https://github.com/shishkin)! - Fix AstroConfigSchema type export

- [#8084](https://github.com/withastro/astro/pull/8084) [`560e45924`](https://github.com/withastro/astro/commit/560e45924622141206ff5b47d134cb343d6d2a71) Thanks [@hbgl](https://github.com/hbgl)! - Stream request body instead of buffering it in memory.

- [#8066](https://github.com/withastro/astro/pull/8066) [`afc45af20`](https://github.com/withastro/astro/commit/afc45af2022f7c43fbb6c5c04983695f3819e47e) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Add support for non-awaited imports to the Image component and `getImage`

- [#7866](https://github.com/withastro/astro/pull/7866) [`d1f7143f9`](https://github.com/withastro/astro/commit/d1f7143f9caf2ffa0e87cc55c0e05339d3501db3) Thanks [@43081j](https://github.com/43081j)! - Add second type argument to the AstroGlobal type to type Astro.self. This change will ultimately allow our editor tooling to provide props completions and intellisense for `<Astro.self />`

- [#8032](https://github.com/withastro/astro/pull/8032) [`3e46634fd`](https://github.com/withastro/astro/commit/3e46634fd540e5b967d2e5c9abd6235452cee2f2) Thanks [@natemoo-re](https://github.com/natemoo-re)! - `astro add` now passes down `--save-prod`, `--save-dev`, `--save-exact`, and `--no-save` flags for installation

- [#8035](https://github.com/withastro/astro/pull/8035) [`a12027b6a`](https://github.com/withastro/astro/commit/a12027b6af411be39700919ca47e240a335e9887) Thanks [@fyndor](https://github.com/fyndor)! - Removed extra double quotes from computed style in shiki code component

## 2.10.7

### Patch Changes
Expand Down
8 changes: 8 additions & 0 deletions packages/astro/client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ declare module 'astro:transitions' {
export const ViewTransitions: ViewTransitionsModule['default'];
}

declare module 'astro:middleware' {
export * from 'astro/middleware/namespace';
}

declare module 'astro:components' {
export * from 'astro/components';
}

type MD = import('./dist/@types/astro').MarkdownInstance<Record<string, any>>;
interface ExportedMarkdownModuleEntities {
frontmatter: MD['frontmatter'];
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/components/Code.astro
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ const html = renderToHtml(tokens, {
// Handle code wrapping
// if wrap=null, do nothing.
if (wrap === false) {
style += '; overflow-x: auto;"';
style += '; overflow-x: auto;';
} else if (wrap === true) {
style += '; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;"';
style += '; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;';
}
return `<${tag} class="${className}" style="${style}" tabindex="0">${children}</${tag}>`;
},
Expand Down
19 changes: 17 additions & 2 deletions packages/astro/components/ViewTransitions.astro
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,21 @@ const { fallback = 'animate' } = Astro.props as Props;

const throttle = (cb: (...args: any[]) => any, delay: number) => {
let wait = false;
// During the waiting time additional events are lost.
// So repeat the callback at the end if we have swallowed events.
let onceMore = false;
return (...args: any[]) => {
if (wait) return;

if (wait) {
onceMore = true;
return;
}
cb(...args);
wait = true;
setTimeout(() => {
if (onceMore) {
onceMore = false;
cb(...args);
}
wait = false;
}, delay);
};
Expand Down Expand Up @@ -125,6 +134,10 @@ const { fallback = 'animate' } = Astro.props as Props;
};

const swap = () => {
// noscript tags inside head element are not honored on swap (#7969).
// Remove them before swapping.
doc.querySelectorAll('head noscript').forEach((el) => el.remove());

// Swap head
for (const el of Array.from(document.head.children)) {
const newEl = persistedHeadElement(el);
Expand Down Expand Up @@ -159,6 +172,8 @@ const { fallback = 'animate' } = Astro.props as Props;
}
if (state?.scrollY != null) {
scrollTo(0, state.scrollY);
// Overwrite erroneous updates by the scroll handler during transition
persistState(state);
}

triggerEvent('astro:beforeload');
Expand Down
9 changes: 9 additions & 0 deletions packages/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
],
"middleware": [
"./dist/core/middleware/index.d.ts"
],
"middleware/namespace": [
"./dist/core/middleware/namespace.d.ts"
]
}
},
Expand Down Expand Up @@ -70,6 +73,10 @@
"types": "./dist/core/middleware/index.d.ts",
"default": "./dist/core/middleware/index.js"
},
"./middleware/namespace": {
"types": "./dist/core/middleware/namespace.d.ts",
"default": "./dist/core/middleware/namespace.js"
},
"./transitions": "./dist/transitions/index.js"
},
"imports": {
Expand Down Expand Up @@ -139,6 +146,7 @@
"fast-glob": "^3.2.12",
"github-slugger": "^2.0.0",
"gray-matter": "^4.0.3",
"http-cache-semantics": "^4.1.1",
"html-escaper": "^3.0.3",
"js-yaml": "^4.1.0",
"kleur": "^4.1.4",
Expand Down Expand Up @@ -180,6 +188,7 @@
"@types/estree": "^0.0.51",
"@types/hast": "^2.3.4",
"@types/html-escaper": "^3.0.0",
"@types/http-cache-semantics": "^4.0.1",
"@types/js-yaml": "^4.0.5",
"@types/mime": "^2.0.3",
"@types/mocha": "^9.1.1",
Expand Down
Loading

0 comments on commit c068f41

Please sign in to comment.