Skip to content

Commit

Permalink
Merge branch 'withastro:main' into cloudflare
Browse files Browse the repository at this point in the history
  • Loading branch information
AirBorne04 authored Oct 20, 2022
2 parents f88fad8 + 863391f commit d53df75
Show file tree
Hide file tree
Showing 46 changed files with 225 additions and 78 deletions.
5 changes: 0 additions & 5 deletions .changeset/eight-swans-divide.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/many-lions-relate.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tall-trainers-do.md

This file was deleted.

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": "^1.5.1"
"astro": "^1.5.2"
}
}
2 changes: 1 addition & 1 deletion examples/blog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.1",
"astro": "^1.5.2",
"@astrojs/mdx": "^0.11.4",
"@astrojs/rss": "^1.0.2",
"@astrojs/sitemap": "^1.0.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
],
"scripts": {},
"devDependencies": {
"astro": "^1.5.1"
"astro": "^1.5.2"
},
"peerDependencies": {
"astro": "^1.5.1"
"astro": "^1.5.2"
}
}
2 changes: 1 addition & 1 deletion examples/deno/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.1"
"astro": "^1.5.2"
},
"devDependencies": {
"@astrojs/deno": "^1.2.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.1",
"astro": "^1.5.2",
"preact": "^10.7.3",
"react": "^18.1.0",
"react-dom": "^18.1.0",
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 @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.1",
"astro": "^1.5.2",
"alpinejs": "^3.10.2",
"@astrojs/alpinejs": "^0.1.2",
"@types/alpinejs": "^3.7.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-lit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.1",
"astro": "^1.5.2",
"lit": "^2.2.5",
"@astrojs/lit": "^1.0.0",
"@webcomponents/template-shadowroot": "^0.1.0"
Expand Down
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": {
"astro": "^1.5.1",
"astro": "^1.5.2",
"preact": "^10.7.3",
"react": "^18.1.0",
"react-dom": "^18.1.0",
Expand All @@ -22,6 +22,6 @@
"@astrojs/react": "^1.2.1",
"@astrojs/solid-js": "^1.2.1",
"@astrojs/svelte": "^1.0.2",
"@astrojs/vue": "^1.2.0"
"@astrojs/vue": "^1.2.1"
}
}
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": {
"astro": "^1.5.1",
"astro": "^1.5.2",
"preact": "^10.7.3",
"@astrojs/preact": "^1.2.0",
"@preact/signals": "^1.1.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.1",
"astro": "^1.5.2",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"@astrojs/react": "^1.2.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 @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.1",
"astro": "^1.5.2",
"solid-js": "^1.4.3",
"@astrojs/solid-js": "^1.2.1"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"dependencies": {
"svelte": "^3.48.0",
"@astrojs/svelte": "^1.0.2",
"astro": "^1.5.1"
"astro": "^1.5.2"
}
}
4 changes: 2 additions & 2 deletions examples/framework-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.1",
"astro": "^1.5.2",
"vue": "^3.2.37",
"@astrojs/vue": "^1.2.0"
"@astrojs/vue": "^1.2.1"
}
}
4 changes: 2 additions & 2 deletions examples/integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
],
"scripts": {},
"devDependencies": {
"astro": "^1.5.1"
"astro": "^1.5.2"
},
"peerDependencies": {
"astro": "^1.5.1"
"astro": "^1.5.2"
}
}
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": "^1.5.1"
"astro": "^1.5.2"
}
}
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": "^1.5.1"
"astro": "^1.5.2"
}
}
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": "^1.5.1"
"astro": "^1.5.2"
}
}
2 changes: 1 addition & 1 deletion examples/ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"server": "node dist/server/entry.mjs"
},
"dependencies": {
"astro": "^1.5.1",
"astro": "^1.5.2",
"svelte": "^3.48.0",
"@astrojs/svelte": "^1.0.2",
"@astrojs/node": "^2.0.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-markdown-plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.1",
"astro": "^1.5.2",
"@astrojs/markdown-remark": "^1.1.3",
"hast-util-select": "5.0.1",
"rehype-autolink-headings": "^6.1.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-markdown-shiki/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.1"
"astro": "^1.5.2"
}
}
2 changes: 1 addition & 1 deletion examples/with-mdx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.1",
"astro": "^1.5.2",
"preact": "^10.6.5",
"@astrojs/preact": "^1.2.0",
"@astrojs/mdx": "^0.11.4"
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": {
"astro": "^1.5.1",
"astro": "^1.5.2",
"preact": "^10.7.3",
"@astrojs/preact": "^1.2.0",
"nanostores": "^0.5.12",
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 @@ -14,7 +14,7 @@
"@astrojs/mdx": "^0.11.4",
"@astrojs/tailwind": "^2.1.1",
"@types/canvas-confetti": "^1.4.3",
"astro": "^1.5.1",
"astro": "^1.5.2",
"autoprefixer": "^10.4.7",
"canvas-confetti": "^1.5.1",
"postcss": "^8.4.14",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-vite-plugin-pwa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.1",
"astro": "^1.5.2",
"vite-plugin-pwa": "0.11.11",
"workbox-window": "^6.5.3"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/with-vitest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"test": "vitest"
},
"dependencies": {
"astro": "^1.5.1",
"astro": "^1.5.2",
"vitest": "^0.20.3"
}
}
10 changes: 10 additions & 0 deletions packages/astro/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# astro

## 1.5.2

### Patch Changes

- [#5119](https://github.com/withastro/astro/pull/5119) [`430e0346c`](https://github.com/withastro/astro/commit/430e0346c9dc0def8af93e0a393dc2847e145d2f) Thanks [@bluwy](https://github.com/bluwy)! - Use `fs.promises.rm` to remove node deprecation warning

- [#5123](https://github.com/withastro/astro/pull/5123) [`9745009ae`](https://github.com/withastro/astro/commit/9745009ae0e7fe8691c75657c5c9586a548bf2e0) Thanks [@matthewp](https://github.com/matthewp)! - Fixes index page with build.format=file

- [#5116](https://github.com/withastro/astro/pull/5116) [`500acb3c1`](https://github.com/withastro/astro/commit/500acb3c117070ee5838a8b567e9bdcf68703227) Thanks [@matthewp](https://github.com/matthewp)! - Throws when using Response.redirect in SSG mode

## 1.5.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "astro",
"version": "1.5.1",
"version": "1.5.2",
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
"type": "module",
"author": "withastro",
Expand Down
6 changes: 6 additions & 0 deletions packages/integrations/prefetch/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @astrojs/prefetch

## 0.1.0

### Minor Changes

- [#5125](https://github.com/withastro/astro/pull/5125) [`5a674f976`](https://github.com/withastro/astro/commit/5a674f976d6138ec5c87441a579c2ccf37713e73) Thanks [@Jelenkee](https://github.com/Jelenkee)! - Prefetch CSS files once

## 0.0.8

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/integrations/prefetch/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@astrojs/prefetch",
"description": "Faster page navigations by prefetching links when the browser is idle.",
"version": "0.0.8",
"version": "0.1.0",
"type": "module",
"types": "./dist/index.d.ts",
"author": "withastro",
Expand Down
10 changes: 9 additions & 1 deletion packages/integrations/prefetch/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import requestIdleCallback from './requestIdleCallback.js';
const events = ['mouseenter', 'touchstart', 'focus'];

const preloaded = new Set<string>();
const loadedStyles = new Set<string>();

function shouldPreload({ href }: { href: string }) {
try {
Expand Down Expand Up @@ -53,7 +54,14 @@ async function preloadHref(link: HTMLAnchorElement) {
const html = parser.parseFromString(contents, 'text/html');
const styles = Array.from(html.querySelectorAll<HTMLLinkElement>('link[rel="stylesheet"]'));

await Promise.all(styles.map((el) => fetch(el.href)));
await Promise.all(
styles
.filter((el) => !loadedStyles.has(el.href))
.map((el) => {
loadedStyles.add(el.href);
return fetch(el.href);
})
);
} catch {}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from 'astro/config';
import prefetch from '@astrojs/prefetch';

// https://astro.build/config
export default defineConfig({
integrations: [prefetch()],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@test/astro-prefetch",
"version": "0.0.0",
"private": true,
"dependencies": {
"@astrojs/prefetch": "workspace:*",
"astro": "workspace:*"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
---

<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home</title>
</head>
<body>
<h1>Home</h1>
<ul>
<li><a href="/style1" rel="prefetch">1</a></li>
<li><a href="/style2" rel="prefetch">2</a></li>
</ul>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
---

<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Style1</title>
<link rel="stylesheet" href="/main.css">
</head>
<body>
<h1>Style1</h1>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
---

<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Style2</title>
<link rel="stylesheet" href="/main.css">
</head>
<body>
<h1>Style2</h1>
</body>
</html>
Loading

0 comments on commit d53df75

Please sign in to comment.