forked from withastro/astro
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from withastro/main
A221
- Loading branch information
Showing
98 changed files
with
2,504 additions
and
1,354 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,6 @@ | ||
--- | ||
"@astrojs/markdown-remark": minor | ||
"astro": minor | ||
--- | ||
|
||
Allows remark plugins to pass options specifying how images in `.md` files will be optimized |
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,32 @@ | ||
--- | ||
"astro": minor | ||
--- | ||
|
||
Adds new helper functions for adapter developers. | ||
|
||
- `Astro.clientAddress` can now be passed directly to the `app.render()` method. | ||
```ts | ||
const response = await app.render(request, { clientAddress: "012.123.23.3" }) | ||
``` | ||
|
||
- Helper functions for converting Node.js HTTP request and response objects to web-compatible `Request` and `Response` objects are now provided as static methods on the `NodeApp` class. | ||
```ts | ||
http.createServer((nodeReq, nodeRes) => { | ||
const request: Request = NodeApp.createRequest(nodeReq) | ||
const response = await app.render(request) | ||
await NodeApp.writeResponse(response, nodeRes) | ||
}) | ||
``` | ||
|
||
- Cookies added via `Astro.cookies.set()` can now be automatically added to the `Response` object by passing the `addCookieHeader` option to `app.render()`. | ||
```diff | ||
-const response = await app.render(request) | ||
-const setCookieHeaders: Array<string> = Array.from(app.setCookieHeaders(webResponse)); | ||
|
||
-if (setCookieHeaders.length) { | ||
- for (const setCookieHeader of setCookieHeaders) { | ||
- headers.append('set-cookie', setCookieHeader); | ||
- } | ||
-} | ||
+const response = await app.render(request, { addCookieHeader: true }) | ||
``` |
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/sitemap": patch | ||
--- | ||
|
||
Fixes generated URLs when using a `base` with a SSR adapter |
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/mdx": patch | ||
--- | ||
|
||
Removes redundant HMR handling code |
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,24 @@ | ||
--- | ||
"astro": minor | ||
--- | ||
|
||
|
||
Adds a new `i18n.routing` config option `redirectToDefaultLocale` to disable automatic redirects of the root URL (`/`) to the default locale when `prefixDefaultLocale: true` is set. | ||
|
||
In projects where every route, including the default locale, is prefixed with `/[locale]/` path, this property allows you to control whether or not `src/pages/index.astro` should automatically redirect your site visitors from `/` to `/[defaultLocale]`. | ||
|
||
You can now opt out of this automatic redirection by setting `redirectToDefaultLocale: false`: | ||
|
||
```js | ||
// astro.config.mjs | ||
export default defineConfig({ | ||
i18n:{ | ||
defaultLocale: "en", | ||
locales: ["en", "fr"], | ||
routing: { | ||
prefixDefaultLocale: true, | ||
redirectToDefaultLocale: false | ||
} | ||
} | ||
}) | ||
``` |
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/vercel": major | ||
--- | ||
|
||
**Breaking**: Minimum required Astro version is now 4.2.0. | ||
Reorganizes internals to be more maintainable. | ||
--- |
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,16 @@ | ||
--- | ||
"astro": minor | ||
--- | ||
|
||
Removes the requirement for non-content files and assets inside content collections to be prefixed with an underscore. For files with extensions like `.astro` or `.css`, you can now remove underscores without seeing a warning in the terminal. | ||
|
||
```diff | ||
src/content/blog/ | ||
post.mdx | ||
- _styles.css | ||
- _Component.astro | ||
+ styles.css | ||
+ Component.astro | ||
``` | ||
|
||
Continue to use underscores in your content collections to exclude individual content files, such as drafts, from the build output. |
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": minor | ||
--- | ||
|
||
Improves the a11y-missing-content rule and error message for audit feature of dev-overlay. This also fixes an error where this check was falsely reporting accessibility errors. |
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/markdoc": patch | ||
--- | ||
|
||
Removes unnecessary `shikiji` 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,16 @@ | ||
--- | ||
"astro": patch | ||
--- | ||
|
||
Updates [Astro's routing priority rules](https://docs.astro.build/en/core-concepts/routing/#route-priority-order) to prioritize the most specifically-defined routes. | ||
|
||
Now, routes with **more defined path segments** will take precedence over less specific routes. | ||
|
||
For example, `/blog/posts/[pid].astro` (3 path segments) takes precedence over `/blog/[...slug].astro` (2 path segments). This means that: | ||
|
||
- `/pages/blog/posts/[id].astro` will build routes of the form `/blog/posts/1` and `/blog/posts/a` | ||
- `/pages/blog/[...slug].astro` will build routes of a variety of forms, including `blog/1` and `/blog/posts/1/a`, but will not build either of the previous routes. | ||
|
||
For a complete list of Astro's routing priority rules, please see the [routing guide](https://docs.astro.build/en/core-concepts/routing/#route-priority-order). This should not be a breaking change, but you may wish to inspect your built routes to ensure that your project is unaffected. | ||
|
||
|
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,8 @@ | ||
--- | ||
"@astrojs/markdown-remark": minor | ||
"astro": minor | ||
--- | ||
|
||
Adds a new `markdown.shikiConfig.transformers` config option. You can use this option to transform the Shikiji hast (AST format of the generated HTML) to customize the final HTML. Also updates Shikiji to the latest stable version. | ||
|
||
See [Shikiji's documentation](https://shikiji.netlify.app/guide/transformers) for more details about creating your own custom transformers, and [a list of common transformers](https://shikiji.netlify.app/packages/transformers) you can add directly to your project. |
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,24 @@ | ||
--- | ||
"astro": minor | ||
--- | ||
|
||
Adds an experimental flag `clientPrerender` to prerender your prefetched pages on the client with the [Speculation Rules API](https://developer.mozilla.org/en-US/docs/Web/API/Speculation_Rules_API). | ||
|
||
```js | ||
// astro.config.mjs | ||
{ | ||
prefetch: { | ||
prefetchAll: true, | ||
defaultStrategy: 'viewport', | ||
}, | ||
experimental: { | ||
clientPrerender: true, | ||
}, | ||
} | ||
``` | ||
|
||
Enabling this feature overrides the default `prefetch` behavior globally to prerender links on the client according to your `prefetch` configuration. Instead of appending a `<link>` tag to the head of the document or fetching the page with JavaScript, a `<script>` tag will be appended with the corresponding speculation rules. | ||
|
||
Client side prerendering requires browser support. If the Speculation Rules API is not supported, `prefetch` will fallback to the supported strategy. | ||
|
||
See the [Prefetch Guide](https://docs.astro.build/en/guides/prefetch/) for more `prefetch` options and usage. |
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,34 @@ | ||
--- | ||
'astro': minor | ||
--- | ||
|
||
Adds an experimental flag `globalRoutePriority` to prioritize redirects and injected routes equally alongside file-based project routes, following the same [route priority order rules](https://docs.astro.build/en/core-concepts/routing/#route-priority-order) for all routes. | ||
|
||
```js | ||
// astro.config.mjs | ||
export default defineConfig({ | ||
experimental: { | ||
globalRoutePriority: true, | ||
}, | ||
}) | ||
``` | ||
|
||
Enabling this feature ensures that all routes in your project follow the same, predictable route priority order rules. In particular, this avoids an issue where redirects or injected routes (e.g. from an integration) would always take precedence over local route definitions, making it impossible to override some routes locally. | ||
|
||
The following table shows which route builds certain page URLs when file-based routes, injected routes, and redirects are combined as shown below: | ||
|
||
- File-based route: `/blog/post/[pid]` | ||
- File-based route: `/[page]` | ||
- Injected route: `/blog/[...slug]` | ||
- Redirect: `/blog/tags/[tag]` -> `/[tag]` | ||
- Redirect: `/posts` -> `/blog` | ||
|
||
URLs are handled by the following routes: | ||
|
||
| Page | Current Behavior | Global Routing Priority Behavior | | ||
|--------------------|----------------------------------|-------------------------------------| | ||
| `/blog/tags/astro` | Injected route `/blog/[...slug]` | Redirect to `/tags/[tag]` | | ||
| `/blog/post/0` | Injected route `/blog/[...slug]` | File-based route `/blog/post/[pid]` | | ||
| `/posts` | File-based route `/[page]` | Redirect to `/blog` | | ||
|
||
In the event of route collisions, where two routes of equal route priority attempt to build the same URL, Astro will log a warning identifying the conflicting routes. |
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/node': major | ||
--- | ||
|
||
If host is unset in standalone mode, the server host will now fallback to `localhost` instead of `127.0.0.1`. When `localhost` is used, the operating system can decide to use either `::1` (ipv6) or `127.0.0.1` (ipv4) itself. This aligns with how the Astro dev and preview server works by default. | ||
|
||
If you relied on `127.0.0.1` (ipv4) before, you can set the `HOST` environment variable to `127.0.0.1` to explicitly use ipv4. For example, `HOST=127.0.0.1 node ./dist/server/entry.mjs`. |
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 | ||
--- | ||
|
||
Simplifies HMR handling, improves circular dependency invalidation, and fixes Astro styles invalidation |
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/node": patch | ||
--- | ||
|
||
Fixes an issue where the preview server appeared to be ready to serve requests before binding to a port. |
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/node": major | ||
--- | ||
|
||
**Breaking**: Minimum required Astro version is now 4.2.0. | ||
Reorganizes internals to be more maintainable. |
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
16 changes: 16 additions & 0 deletions
16
packages/astro/e2e/fixtures/tailwindcss/src/components/Layout.astro
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,16 @@ | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/x-icon" href="/favicon.ico" /> | ||
<title>Astro + TailwindCSS</title> | ||
</head> | ||
<body class="bg-dawn text-midnight"> | ||
<slot/> | ||
</body> | ||
</html> | ||
|
||
<style is:global> | ||
@tailwind base; | ||
|
||
@tailwind utilities; | ||
</style> |
17 changes: 5 additions & 12 deletions
17
packages/astro/e2e/fixtures/tailwindcss/src/pages/index.astro
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 |
---|---|---|
@@ -1,18 +1,11 @@ | ||
--- | ||
// Component Imports | ||
import Layout from '../components/Layout.astro'; | ||
import Button from '../components/Button.astro'; | ||
import Complex from '../components/Complex.astro'; | ||
--- | ||
|
||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/x-icon" href="/favicon.ico" /> | ||
<title>Astro + TailwindCSS</title> | ||
</head> | ||
|
||
<body class="bg-dawn text-midnight"> | ||
<Button>I’m a Tailwind Button!</Button> | ||
<Complex /> | ||
</body> | ||
</html> | ||
<Layout> | ||
<Button>I’m a Tailwind Button!</Button> | ||
<Complex /> | ||
</Layout> |
Oops, something went wrong.