-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'next' into plt-1631-config-external-true
- Loading branch information
Showing
378 changed files
with
5,214 additions
and
4,182 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,9 @@ | ||
--- | ||
'astro': major | ||
--- | ||
|
||
Unflag globalRoutePriority | ||
|
||
The previously experimental feature `globalRoutePriority` is now the default in Astro 5. | ||
|
||
This was a refactoring of route prioritization in Astro, making it so that injected routes, file-based routes, and redirects are all prioritized using the same logic. This feature has been enabled for all Starlight projects since it was added and should not affect most users. |
This file was deleted.
Oops, something went wrong.
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,11 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Updates Astro's default `<script>` rendering strategy and removes the `experimental.directRenderScript` option as this is now the default behavior: scripts are always rendered directly. This new strategy prevents scripts from being executed in pages where they are not used. | ||
|
||
Scripts will directly render as declared in Astro files (including existing features like TypeScript, importing `node_modules`, and deduplicating scripts). You can also now conditionally render scripts in your Astro file. | ||
|
||
However, this means scripts are no longer hoisted to the `<head>`, multiple scripts on a page are no longer bundled together, and the `<script>` tag may interfere with the CSS styling. | ||
|
||
As this is a potentially breaking change to your script behavior, please review your `<script>` tags and ensure that they behave as expected. |
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': major | ||
--- | ||
|
||
Updates the default value of `security.checkOrigin` to `true`, which enables Cross-Site Request Forgery (CSRF) protection by default for pages rendered on demand. | ||
|
||
If you had previously configured `security.checkOrigin: true`, you no longer need this set in your Astro config. This is now the default and it is safe to remove. | ||
|
||
To disable this behavior and opt out of automatically checking that the “origin” header matches the URL sent by each request, you must explicitly set `security.checkOrigin: false`: | ||
|
||
```diff | ||
export default defineConfig({ | ||
+ security: { | ||
+ checkOrigin: false | ||
+ } | ||
}) | ||
``` |
This file was deleted.
Oops, something went wrong.
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,19 @@ | ||
--- | ||
'astro': major | ||
--- | ||
|
||
Deprecate Astro.glob | ||
|
||
The `Astro.glob` function has been deprecated in favor of Content Collections and `import.meta.glob`. | ||
|
||
- If you want to query for markdown and MDX in your project, use Content Collections. | ||
- If you want to query source files in your project, use `import.meta.glob`(https://vitejs.dev/guide/features.html#glob-import). | ||
|
||
Also consider using glob packages from npm, like [fast-glob](https://www.npmjs.com/package/fast-glob), especially if statically generating your site, as it is faster for most use-cases. | ||
|
||
The easiest path is to migrate to `import.meta.glob` like so: | ||
|
||
```diff | ||
- const posts = Astro.glob('./posts/*.md'); | ||
+ const posts = Object.values(import.meta.glob('./posts/*.md', { eager: true })); | ||
``` |
This file was deleted.
Oops, something went wrong.
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,25 @@ | ||
--- | ||
'astro': minor | ||
--- | ||
|
||
Adds a new property to the globals `Astro` and `APIContext` called `routePattern`. The `routePattern` represents the current route (component) | ||
that is being rendered by Astro. It's usually a path pattern will look like this: `blog/[slug]`: | ||
|
||
```asto | ||
--- | ||
// src/pages/blog/[slug].astro | ||
const route = Astro.routePattern; | ||
console.log(route); // it will log "blog/[slug]" | ||
--- | ||
``` | ||
|
||
```js | ||
// src/pages/index.js | ||
|
||
export const GET = (ctx) => { | ||
console.log(ctx.routePattern) // it will log src/pages/index.js | ||
return new Response.json({ loreum: "ipsum" }) | ||
} | ||
``` | ||
|
||
|
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,11 @@ | ||
--- | ||
'astro': major | ||
--- | ||
|
||
Prevent usage of `astro:content` in the client | ||
|
||
Usage of `astro:content` in the client has always been discouraged because it leads to all of your content winding up in your client bundle, and can possibly leaks secrets. | ||
|
||
This formally makes doing so impossible, adding to the previous warning with errors. | ||
|
||
In the future Astro might add APIs for client-usage based on needs. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,5 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Refactors content layer sync to use a queue |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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': major | ||
--- | ||
|
||
Changes the data returned for `page.url.current`, `page.url.next`, `page.url.prev`, `page.url.first` and `page.url.last` to include the value set for `base` in your Astro config. | ||
|
||
Previously, you had to manually prepend your configured value for `base` to the URL path. Now, Astro automatically includes your `base` value in `next` and `prev` URLs. | ||
|
||
If you are using the `paginate()` function for "previous" and "next" URLs, remove any existing `base` value as it is now added for you: | ||
|
||
```diff | ||
--- | ||
export async function getStaticPaths({ paginate }) { | ||
const astronautPages = [{ | ||
astronaut: 'Neil Armstrong', | ||
}, { | ||
astronaut: 'Buzz Aldrin', | ||
}, { | ||
astronaut: 'Sally Ride', | ||
}, { | ||
astronaut: 'John Glenn', | ||
}]; | ||
return paginate(astronautPages, { pageSize: 1 }); | ||
} | ||
const { page } = Astro.props; | ||
// `base: /'docs'` configured in `astro.config.mjs` | ||
- const prev = "/docs" + page.url.prev; | ||
+ const prev = page.url.prev; | ||
--- | ||
<a id="prev" href={prev}>Back</a> | ||
``` | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,61 @@ | ||
name: Dispatch event | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- '!**' | ||
|
||
permissions: | ||
contents: read | ||
actions: write | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
ASTRO_ADAPTERS_REPO: withastro/adapters | ||
ASTRO_STARLIGHT_REPO: withastro/starlight | ||
ASTRO_PUSH_MAIN_EVENT: astro-push-main-event | ||
|
||
jobs: | ||
repository-dispatch: | ||
name: Repository dispatch | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Dispatch event on push - adapters | ||
if: ${{ github.event_name == 'push' }} | ||
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3 | ||
with: | ||
token: ${{ secrets.ASTRO_REPOSITORY_DISPATCH }} | ||
repository: ${{ env.ASTRO_ADAPTERS_REPO }} | ||
event-type: ${{ env.ASTRO_PUSH_MAIN_EVENT }} | ||
client-payload: '{"event": ${{ toJson(github.event) }}}' | ||
- name: Dispatch event on push - starlight | ||
if: ${{ github.event_name == 'push' }} | ||
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3 | ||
with: | ||
token: ${{ secrets.ASTRO_REPOSITORY_DISPATCH }} | ||
repository: ${{ env.ASTRO_STARLIGHT_REPO }} | ||
event-type: ${{ env.ASTRO_PUSH_MAIN_EVENT }} | ||
client-payload: '{"event": ${{ toJson(github.event) }}}' | ||
# For testing only, the payload is mocked | ||
- name: Dispatch event on workflow dispatch - adapters | ||
if: ${{ github.event_name == 'workflow_dispatch' }} | ||
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3 | ||
with: | ||
token: ${{ secrets.ASTRO_REPOSITORY_DISPATCH }} | ||
repository: ${{ env.ASTRO_ADAPTERS_REPO }} | ||
event-type: ${{ env.ASTRO_PUSH_MAIN_EVENT }} | ||
client-payload: '{"event": {"head_commit": {"id": "${{ env.GITHUB_SHA }}"}}}' | ||
- name: Dispatch event on workflow dispatch - starlight | ||
if: ${{ github.event_name == 'workflow_dispatch' }} | ||
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3 | ||
with: | ||
token: ${{ secrets.ASTRO_REPOSITORY_DISPATCH }} | ||
repository: ${{ env.ASTRO_STARLIGHT_REPO }} | ||
event-type: ${{ env.ASTRO_PUSH_MAIN_EVENT }} | ||
client-payload: '{"event": {"head_commit": {"id": "${{ env.GITHUB_SHA }}"}}}' |
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,19 @@ | ||
name: Add continuous release label | ||
|
||
on: | ||
issue_comment: | ||
types: [created] | ||
|
||
permissions: | ||
pull-requests: write | ||
|
||
jobs: | ||
label: | ||
if: ${{ github.repository_owner == 'withastro' && startsWith(github.event.comment.body, '!preview') }} | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- run: | | ||
gh issue edit ${{ github.event.issue.number }} --add-label "pr: preview" --repo ${{ github.repository }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,60 @@ | ||
name: Preview release | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
types: [opened, synchronize, labeled, ready_for_review] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.number }} | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
contents: read | ||
actions: write | ||
|
||
env: | ||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | ||
TURBO_TEAM: ${{ secrets.TURBO_TEAM }} | ||
FORCE_COLOR: true | ||
ASTRO_TELEMETRY_DISABLED: true | ||
# 7 GiB by default on GitHub, setting to 6 GiB | ||
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources | ||
NODE_OPTIONS: --max-old-space-size=6144 | ||
|
||
jobs: | ||
preview: | ||
if: | | ||
${{ github.repository_owner == 'withastro' && github.event.issue.pull_request && contains(github.event.pull_request.labels.*.name, 'pr: preview') }} | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
id-token: write | ||
issues: write | ||
pull-requests: write | ||
name: Publish preview release | ||
timeout-minutes: 5 | ||
steps: | ||
- name: Disable git crlf | ||
run: git config --global core.autocrlf false | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup PNPM | ||
uses: pnpm/action-setup@v3 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
cache: "pnpm" | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Build Packages | ||
run: pnpm run build | ||
|
||
- name: Publish packages | ||
run: pnpx pkg-pr-new publish --pnpm './packages/*' './packages/integrations/*' |
Oops, something went wrong.