Skip to content

Commit

Permalink
Merge branch 'main' into fix/directory-redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
natemoo-re committed Jun 6, 2023
2 parents 89c6dc3 + d72cfa7 commit 2b18fcb
Show file tree
Hide file tree
Showing 178 changed files with 2,956 additions and 947 deletions.
33 changes: 33 additions & 0 deletions .changeset/chatty-actors-stare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
'astro': minor
---

Experimental redirects support

This change adds support for the redirects RFC, currently in stage 3: https://github.com/withastro/roadmap/pull/587

Now you can specify redirects in your Astro config:

```js
import { defineConfig } from 'astro/config';

export defineConfig({
redirects: {
'/blog/old-post': '/blog/new-post'
}
});
```

You can also specify spread routes using the same syntax as in file-based routing:

```js
import { defineConfig } from 'astro/config';

export defineConfig({
redirects: {
'/blog/[...slug]': '/articles/[...slug]'
}
});
```

By default Astro will build HTML files that contain the `<meta http-equiv="refresh">` tag. Adapters can also support redirect routes and create configuration for real HTTP-level redirects in production.
7 changes: 7 additions & 0 deletions .changeset/fuzzy-ladybugs-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@astrojs/cloudflare': minor
---

Support for experimental redirects

This adds support for the redirects RFC in the Cloudflare adapter. No changes are necessary, simply use configured redirects and the adapter will update your `_redirects` file.
5 changes: 5 additions & 0 deletions .changeset/fuzzy-tables-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': minor
---

Remove experimental flag for custom client directives
7 changes: 7 additions & 0 deletions .changeset/hip-news-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@astrojs/vercel': minor
---

Support for experimental redirects

This adds support for the redirects RFC in the Vercel adapter. No changes are necessary, simply use configured redirects and the adapter will output the vercel.json file with the configuration values.
5 changes: 5 additions & 0 deletions .changeset/khaki-onions-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fix HTML component type causing an error when imported in the editor
5 changes: 5 additions & 0 deletions .changeset/lazy-falcons-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fix cookies not being set by middleware
5 changes: 5 additions & 0 deletions .changeset/light-sheep-hunt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fix nested astro-island hydration race condition
5 changes: 5 additions & 0 deletions .changeset/slimy-hotels-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': minor
---

Update base `tsconfig.json` template with `allowJs: true` to provide a better relaxed experience for users unfamilliar with TypeScript. `allowJs` is still set to `false` (its default value) when using the `strictest` preset.
24 changes: 24 additions & 0 deletions .changeset/stupid-pumpkins-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
'astro': minor
---

The Inline Stylesheets RFC is now stable!

You can now control how Astro bundles your css with a configuration change:

```ts
export default defineConfig({
...
build: {
inlineStylesheets: "auto"
}
...
})
```

The options:
- `inlineStylesheets: "never"`: This is the behavior you are familiar with. Every stylesheet is external, and added to the page via a `<link>` tag. Default.
- `inlineStylesheets: "auto"`: Small stylesheets are inlined into `<style>` tags and inserted into `<head>`, while larger ones remain external.
- `inlineStylesheets: "always"`: Every style required by the page is inlined.

As always, css files in the `public` folder are not affected.
5 changes: 5 additions & 0 deletions .changeset/tasty-stingrays-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

remove the white space after the doctype according to the property compressHTML
9 changes: 9 additions & 0 deletions .changeset/twenty-suns-vanish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@astrojs/netlify': minor
---

Support for experimental redirects

This adds support for the redirects RFC in the Netlify adapter, including a new `@astrojs/netlify/static` adapter for static sites.

No changes are necessary when using SSR. Simply use configured redirects and the adapter will update your `_redirects` file.
10 changes: 10 additions & 0 deletions .changeset/weak-wombats-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'astro': minor
'@astrojs/image': minor
'@astrojs/cloudflare': patch
'@astrojs/netlify': patch
'@astrojs/node': patch
'@astrojs/vercel': patch
---

Unflags support for `output: 'hybrid'` mode, which enables pre-rendering by default. The additional `experimental.hybridOutput` flag can be safely removed from your configuration.
5 changes: 5 additions & 0 deletions .changeset/young-flies-allow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': minor
---

Remove experimental flag for the middleware
93 changes: 45 additions & 48 deletions .github/workflows/check-merge.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,53 @@
name: Check mergeability

on: pull_request # run on pull request events
on: pull_request

permissions:
# grant write permission on the pull-requests endpoint
pull-requests: write
checks: write
statuses: write

jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Check if there is already a block on this PR
id: set-blocks
id: blocked
uses: actions/github-script@v6
env:
issue_number: ${{ github.event.number }}
with:
script: |
const url = 'https://api.github.com/repos/' + context.repo.owner + '/' + context.repo.repo + '/pulls/' + context.issue.number + '/reviews';
console.log('reviews URL', url);
const result = await github.request(url);
console.log(result);
const reviews = result.data;
for(const review of reviews) {
if(review.user.id === 41898282 && review.state === 'CHANGES_REQUESTED') {
return 'block';
const { data: reviews } = await github.rest.pulls.listReviews({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: process.env.issue_number,
});
for (const review of reviews) {
if (review.user.login === 'github-actions[bot]' && review.state === 'CHANGES_REQUESTED') {
return 'true'
}
}
return '';
return 'false'
result-encoding: string

- uses: actions/checkout@v3
if: steps.set-blocks.outputs.blocks == ''
if: steps.blocked.outputs.result != 'true'
with:
fetch-depth: 0

- name: Get changed files in the .changeset folder
id: changed-files
uses: tj-actions/changed-files@v35
if: steps.set-blocks.outputs.blocks == ''
if: steps.blocked.outputs.result != 'true'
with:
files: |
.changeset/**/*.md
- name: Check if any changesets contain minor changes
id: find-blockers
if: steps.set-blocks.outputs.blocks == ''
id: minor
if: steps.blocked.outputs.result != 'true'
run: |
echo "Checking for changesets marked as minor"
echo '::set-output name=found::false'
Expand All @@ -54,38 +59,30 @@ jobs:
done
- name: Add label
if: steps.find-blockers.outputs.found == 'true'
run: |
curl --request POST \
--url https://api.github.com/repos/${{github.repository}}/issues/${{github.event.number}}/labels \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
-d '["semver minor"]'
- name: Find Comment
uses: peter-evans/find-comment@v2
id: fc
uses: actions/github-script@v6
if: steps.minor.outputs.found == 'true'
env:
issue_number: ${{ github.event.number }}
with:
issue-number: ${{ github.event.number }}
comment-author: 'github-actions[bot]'
script: |
github.rest.issues.addLabels({
issue_number: process.env.issue_number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['semver minor']
});
- name: Send PR review
if: steps.find-blockers.outputs.found == 'true'
uses: peter-evans/create-or-update-comment@v3
continue-on-error: true
- name: Change PR Status
uses: actions/github-script@v6
if: steps.minor.outputs.found == 'true'
env:
issue_number: ${{ github.event.number }}
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.number }}
body: |
This PR is blocked because it contains a `minor` changeset. A reviewer will merge this at the next release if approved.
edit-mode: replace
- name: Change PR status
if: steps.find-blockers.outputs.found == 'true'
run: |
curl --request POST \
--url https://api.github.com/repos/${{github.repository}}/pulls/${{github.event.number}}/reviews \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
-d '{"event":"REQUEST_CHANGES", body: ""}'
script: |
github.rest.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: process.env.issue_number,
event: 'REQUEST_CHANGES',
body: 'This PR is blocked because it contains a `minor` changeset. A reviewer will merge this at the next release if approved.'
});
3 changes: 0 additions & 3 deletions examples/middleware/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,4 @@ export default defineConfig({
adapter: node({
mode: 'standalone',
}),
experimental: {
middleware: true,
},
});
9 changes: 0 additions & 9 deletions examples/with-markdoc/src/content/config.ts

This file was deleted.

16 changes: 16 additions & 0 deletions packages/astro/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# astro

## 2.5.7

### Patch Changes

- [#7215](https://github.com/withastro/astro/pull/7215) [`6e27f2f6d`](https://github.com/withastro/astro/commit/6e27f2f6dbd52f980c487e875faf1b066f65cffd) Thanks [@bmenant](https://github.com/bmenant)! - Node adapter fallbacks to `:authority` http2 pseudo-header when `host` is nullish.

- [#7233](https://github.com/withastro/astro/pull/7233) [`96ae37eb0`](https://github.com/withastro/astro/commit/96ae37eb09f7406f40fba93e14b2a26ccd46640c) Thanks [@bluwy](https://github.com/bluwy)! - Fix `getViteConfig` and Vitest setup with content collections

- [#7136](https://github.com/withastro/astro/pull/7136) [`fea306936`](https://github.com/withastro/astro/commit/fea30693609cc517d8660972151f4d12a0dd4e82) Thanks [@johannesspohr](https://github.com/johannesspohr)! - Render arrays of components in parallel

- [#7257](https://github.com/withastro/astro/pull/7257) [`5156c4f90`](https://github.com/withastro/astro/commit/5156c4f90e0922f62d25fa0c82bbefae39f4c2b6) Thanks [@thiti-y](https://github.com/thiti-y)! - fix: build fail upon have 'process.env' in \*.md file.

- [#7268](https://github.com/withastro/astro/pull/7268) [`9e7366567`](https://github.com/withastro/astro/commit/9e7366567e2b83d46a46db35e74ad508d1978039) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Fix: ignore `.json` files within content collection directories starting with an `_` underscore.

- [#7185](https://github.com/withastro/astro/pull/7185) [`339529fc8`](https://github.com/withastro/astro/commit/339529fc820bac2d514b63198ecf54a1d88c0917) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Bring back improved style and script handling across content collection files. This addresses bugs found in a previous release to `@astrojs/markdoc`.

## 2.5.6

### Patch Changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import { fileURLToPath } from 'url';

export default defineConfig({
integrations: [astroClientClickDirective(), astroClientPasswordDirective(), react()],
experimental: {
customClientDirectives: true
}
});

function astroClientClickDirective() {
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/env.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// <reference path="./client.d.ts" />
/// <reference path="./client-base.d.ts" />

// Caution! The types here are only available inside Astro files (injected automatically by our language server)
// As such, if the typings you're trying to add should be available inside ex: React components, they should instead
Expand All @@ -18,6 +18,6 @@ declare const Astro: Readonly<Astro>;
declare const Fragment: any;

declare module '*.html' {
const Component: { render(opts: { slots: Record<string, string> }): string };
const Component: (opts?: { slots?: Record<string, string> }) => string;
export default Component;
}
3 changes: 2 additions & 1 deletion packages/astro/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "astro",
"version": "2.5.6",
"version": "2.5.7",
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
"type": "module",
"author": "withastro",
Expand Down Expand Up @@ -113,6 +113,7 @@
},
"dependencies": {
"@astrojs/compiler": "^1.4.0",
"@astrojs/internal-helpers": "^0.1.0",
"@astrojs/language-server": "^1.0.0",
"@astrojs/markdown-remark": "^2.2.1",
"@astrojs/telemetry": "^2.1.1",
Expand Down

0 comments on commit 2b18fcb

Please sign in to comment.