Skip to content

Commit

Permalink
Merge branch 'next' into plt-1631-config-external-true
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy authored Sep 2, 2024
2 parents 7bd9d01 + edd8ae9 commit bcb2ab8
Show file tree
Hide file tree
Showing 378 changed files with 5,214 additions and 4,182 deletions.
9 changes: 9 additions & 0 deletions .changeset/blue-boats-relax.md
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.
5 changes: 0 additions & 5 deletions .changeset/fair-rats-fail.md

This file was deleted.

11 changes: 11 additions & 0 deletions .changeset/five-jars-hear.md
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.
17 changes: 17 additions & 0 deletions .changeset/itchy-toys-march.md
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
+ }
})
```
5 changes: 0 additions & 5 deletions .changeset/long-months-burn.md

This file was deleted.

19 changes: 19 additions & 0 deletions .changeset/long-months-rule.md
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 }));
```
5 changes: 0 additions & 5 deletions .changeset/mighty-trees-teach.md

This file was deleted.

25 changes: 25 additions & 0 deletions .changeset/nasty-crabs-worry.md
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" })
}
```


11 changes: 11 additions & 0 deletions .changeset/neat-dots-hear.md
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.
5 changes: 0 additions & 5 deletions .changeset/new-pillows-kick.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/odd-donuts-impress.md

This file was deleted.

20 changes: 15 additions & 5 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,25 @@
"@astrojs/upgrade": "0.3.1"
},
"changesets": [
"blue-boats-relax",
"chatty-teachers-sit",
"mighty-trees-teach",
"new-pillows-kick",
"eighty-boxes-applaud",
"five-jars-hear",
"healthy-ads-scream",
"itchy-toys-march",
"long-months-rule",
"many-garlics-lick",
"modern-bears-deny",
"nasty-crabs-worry",
"neat-dots-hear",
"perfect-fans-fly",
"poor-frogs-dream",
"quick-ads-exercise",
"selfish-impalas-grin",
"sixty-masks-lie",
"small-ties-sort",
"smart-comics-doubt",
"spicy-houses-fry",
"spotty-garlics-cheat",
"ten-students-repair",
"weak-dancers-beam"
"twenty-cobras-push"
]
}
5 changes: 5 additions & 0 deletions .changeset/sixty-masks-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Refactors content layer sync to use a queue
5 changes: 0 additions & 5 deletions .changeset/smart-comics-doubt.md

This file was deleted.

7 changes: 0 additions & 7 deletions .changeset/smooth-melons-cough.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/spicy-houses-fry.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tiny-lamps-lick.md

This file was deleted.

32 changes: 32 additions & 0 deletions .changeset/twenty-cobras-push.md
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>
```

20 changes: 0 additions & 20 deletions .changeset/weak-dancers-beam.md

This file was deleted.

6 changes: 0 additions & 6 deletions .changeset/weak-masks-do.md

This file was deleted.

61 changes: 61 additions & 0 deletions .github/workflows/dispatch-event.yml
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 }}"}}}'
19 changes: 19 additions & 0 deletions .github/workflows/preview-comment.yml
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 }}
60 changes: 60 additions & 0 deletions .github/workflows/preview-release.yml
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/*'
Loading

0 comments on commit bcb2ab8

Please sign in to comment.