Skip to content

Commit

Permalink
Merge pull request #148 from withastro/main
Browse files Browse the repository at this point in the history
A890
  • Loading branch information
akshit20421 authored Mar 8, 2024
2 parents 5c90331 + dfdf6b3 commit 8ddd479
Show file tree
Hide file tree
Showing 217 changed files with 4,167 additions and 1,284 deletions.
16 changes: 0 additions & 16 deletions .changeset/bright-students-worry.md

This file was deleted.

7 changes: 7 additions & 0 deletions .changeset/brown-pets-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"astro": minor
---

Allows middleware to run when a matching page or endpoint is not found. Previously, a `pages/404.astro` or `pages/[...catch-all].astro` route had to match to allow middleware. This is now not necessary.

When a route does not match in SSR deployments, your adapter may show a platform-specific 404 page instead of running Astro's SSR code. In these cases, you may still need to add a `404.astro` or fallback route with spread params, or use a routing configuration option if your adapter provides one.
6 changes: 6 additions & 0 deletions .changeset/calm-bags-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@astrojs/markdown-remark": minor
"astro": minor
---

Allows passing any props to the `<Code />` component
5 changes: 0 additions & 5 deletions .changeset/chilly-cherries-appear.md

This file was deleted.

25 changes: 25 additions & 0 deletions .changeset/cool-jobs-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
"astro": minor
---

Adds a new `experimental.directRenderScript` configuration option which provides a more reliable strategy to prevent scripts from being executed in pages where they are not used.

This replaces the `experimental.optimizeHoistedScript` flag introduced in v2.10.4 to prevent unused components' scripts from being included in a page unexpectedly. That experimental option no longer exists and must be removed from your configuration, whether or not you enable `directRenderScript`:

```diff
// astro.config.mjs
import { defineConfig } from 'astro/config';

export default defineConfig({
experimental: {
- optimizeHoistedScript: true,
+ directRenderScript: true
}
});
```

With `experimental.directRenderScript` configured, scripts are now directly rendered 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>` and multiple scripts on a page are no longer bundled together. If you enable this option, you should check that all your `<script>` tags behave as expected.

This option will be enabled by default in Astro 5.0.
5 changes: 5 additions & 0 deletions .changeset/curvy-hats-shave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": minor
---

Stabilizes `markdown.shikiConfig.experimentalThemes` as `markdown.shikiConfig.themes`. No behaviour changes are made to this option.
5 changes: 0 additions & 5 deletions .changeset/empty-bees-help.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/fluffy-bobcats-arrive.md

This file was deleted.

26 changes: 26 additions & 0 deletions .changeset/fluffy-readers-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
"@astrojs/internal-helpers": minor
"astro": minor
---

Adds the option to pass an object to `build.assetsPrefix`. This allows for the use of multiple CDN prefixes based on the target file type.

When passing an object to `build.assetsPrefix`, you must also specify a `fallback` domain to be used for all other file types not specified.

Specify a file extension as the key (e.g. 'js', 'png') and the URL serving your assets of that file type as the value:

```js
// astro.config.mjs
import { defineConfig } from "astro/config"

export default defineConfig({
build: {
assetsPrefix: {
'js': "https://js.cdn.example.com",
'mjs': "https://js.cdn.example.com", // if you have .mjs files, you must add a new entry like this
'png': "https://images.cdn.example.com",
'fallback': "https://generic.cdn.example.com"
}
}
})
```
17 changes: 17 additions & 0 deletions .changeset/hungry-needles-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
"astro": minor
---

Adds support for emitting warning and info notifications from dev toolbar apps.

When using the `toggle-notification` event, the severity can be specified through `detail.level`:

```ts
eventTarget.dispatchEvent(
new CustomEvent("toggle-notification", {
detail: {
level: "warning",
},
})
);
```
5 changes: 5 additions & 0 deletions .changeset/khaki-elephants-hang.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": minor
---

Adds the ability to set colors on all the included UI elements for dev toolbar apps. Previously, only badge and buttons could be customized.
5 changes: 5 additions & 0 deletions .changeset/khaki-emus-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": patch
---

Fixes an issue where some CLI commands attempted to directly read vite config files.
26 changes: 26 additions & 0 deletions .changeset/lovely-nails-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
"@astrojs/react": minor
"astro": minor
---

Changes the default behavior of `transition:persist` to update the props of persisted islands upon navigation. Also adds a new view transitions option `transition:persist-props` (default: `false`) to prevent props from updating as needed.

Islands which have the `transition:persist` property to keep their state when using the `<ViewTransitions />` router will now have their props updated upon navigation. This is useful in cases where the component relies on page-specific props, such as the current page title, which should update upon navigation.

For example, the component below is set to persist across navigation. This component receives a `products` props and might have some internal state, such as which filters are applied:

```astro
<ProductListing transition:persist products={products} />
```

Upon navigation, this component persists, but the desired `products` might change, for example if you are visiting a category of products, or you are performing a search.

Previously the props would not change on navigation, and your island would have to handle updating them externally, such as with API calls.

With this change the props are now updated, while still preserving state.

You can override this new default behavior on a per-component basis using `transition:persist-props=true` to persist both props and state during navigation:

```astro
<ProductListing transition:persist-props=true products={products} />
```
5 changes: 5 additions & 0 deletions .changeset/nine-trains-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": patch
---

Treeshakes unused Astro component scoped styles
9 changes: 9 additions & 0 deletions .changeset/rare-coins-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"astro": minor
---

Supports adding the `data-astro-rerun` attribute on script tags so that they will be re-executed after view transitions

```html
<script is:inline data-astro-rerun>...</script>
```
5 changes: 5 additions & 0 deletions .changeset/slimy-avocados-sniff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": patch
---

Updates the base `tsconfig.json` preset with `jsx: 'preserve'` in order to fix errors when importing Astro files inside `.js` and `.ts` files.
44 changes: 44 additions & 0 deletions .changeset/slow-items-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
"astro": minor
---

Adds experimental JSON Schema support for content collections.

This feature will auto-generate a JSON Schema for content collections of `type: 'data'` which can be used as the `$schema` value for TypeScript-style autocompletion/hints in tools like VSCode.

To enable this feature, add the experimental flag:

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

export default defineConfig({
experimental: {
+ contentCollectionJsonSchema: true
}
});
```

This experimental implementation requires you to manually reference the schema in each data entry file of the collection:

```diff
// src/content/test/entry.json
{
+ "$schema": "../../../.astro/collections/test.schema.json",
"test": "test"
}
```

Alternatively, you can set this in your [VSCode `json.schemas` settings](https://code.visualstudio.com/docs/languages/json#_json-schemas-and-settings):

```diff
"json.schemas": [
{
"fileMatch": [
"/src/content/test/**"
],
"url": "../../../.astro/collections/test.schema.json"
}
]
```

Note that this initial implementation uses a library with [known issues for advanced Zod schemas](https://github.com/StefanTerdell/zod-to-json-schema#known-issues), so you may wish to consult these limitations before enabling the experimental flag.
5 changes: 0 additions & 5 deletions .changeset/thick-geckos-design.md

This file was deleted.

6 changes: 6 additions & 0 deletions .changeset/thin-chicken-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@astrojs/markdown-remark": minor
"astro": minor
---

Migrates `shikiji` to `shiki` 1.0
12 changes: 12 additions & 0 deletions .changeset/thirty-beds-smoke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@astrojs/mdx": minor
"@astrojs/markdown-remark": minor
---

Changes Astro's internal syntax highlighting to use rehype plugins instead of remark plugins. This provides better interoperability with other [rehype plugins](https://github.com/rehypejs/rehype/blob/main/doc/plugins.md#list-of-plugins) that deal with code blocks, in particular with third party syntax highlighting plugins and [`rehype-mermaid`](https://github.com/remcohaszing/rehype-mermaid).

This may be a breaking change if you are currently using:
- a remark plugin that relies on nodes of type `html`
- a rehype plugin that depends on nodes of type `raw`.

Please review your rendered code samples carefully, and if necessary, consider using a rehype plugin that deals with the generated `element` nodes instead. You can transform the AST of raw HTML strings, or alternatively use [`hast-util-to-html`](https://github.com/syntax-tree/hast-util-to-html) to get a string from a `raw` node.
5 changes: 5 additions & 0 deletions .changeset/two-ads-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": minor
---

Adds support for page mutations to the audits in the dev toolbar. Astro will now rerun the audits whenever elements are added or deleted from the page.
5 changes: 5 additions & 0 deletions .changeset/witty-wombats-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": minor
---

Updates the UI for dev toolbar audits with new information
3 changes: 2 additions & 1 deletion .github/workflows/check-merge.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Check mergeability

on: pull_request
on: pull_request_target

permissions:
pull-requests: write
Expand Down Expand Up @@ -35,6 +35,7 @@ jobs:
- uses: actions/checkout@v4
if: steps.blocked.outputs.result != 'true'
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0

- name: Get changed files in the .changeset folder
Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

## Reporting a Vulnerability

To report a security issue, please email security@astro.build with a detailed description of the issue, the steps you took to create the issue, affected versions, and, if known, mitigations for the issue.
To report a security issue, please [open a security advisory](https://github.com/withastro/astro/security/advisories/new) on GitHub with a detailed description of the issue, the steps you took to create the issue, affected versions, and, if known, mitigations for the issue.

Please remember to include everything required for us to reproduce the issue, including but not limited to a publicly accessible git repository and/or StackBlitz repository. All code samples shared with our Security team will only be used to verify and diagnose the issue and will not be publicly shared with anyone outside of Astro's teams. Astro's Security Team members may share information only within the Astro teams on a need-to-know basis to fix the related issue in Astro.

Our Security team will acknowledge receiving your email within 3 working days.
Our Security team will respond to the security advisory within 3 working days.

<ins>**If you think you've found a security issue, please DO NOT report, discuss, or describe it on Discord, GitHub, or any other public forum; without prior contact and acknowledgment of Astro's Security team.**<ins>

Expand Down
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": "^4.4.14"
"astro": "^4.4.15"
}
}
2 changes: 1 addition & 1 deletion examples/blog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"@astrojs/mdx": "^2.1.1",
"@astrojs/rss": "^4.0.5",
"@astrojs/sitemap": "^3.1.1",
"astro": "^4.4.14"
"astro": "^4.4.15"
}
}
2 changes: 1 addition & 1 deletion examples/component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"scripts": {},
"devDependencies": {
"astro": "^4.4.14"
"astro": "^4.4.15"
},
"peerDependencies": {
"astro": "^4.0.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 @@ -14,6 +14,6 @@
"@astrojs/alpinejs": "^0.4.0",
"@types/alpinejs": "^3.13.5",
"alpinejs": "^3.13.3",
"astro": "^4.4.14"
"astro": "^4.4.15"
}
}
2 changes: 1 addition & 1 deletion examples/framework-lit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/lit": "^4.0.1",
"@webcomponents/template-shadowroot": "^0.2.1",
"astro": "^4.4.14",
"astro": "^4.4.15",
"lit": "^3.1.2"
}
}
2 changes: 1 addition & 1 deletion examples/framework-multiple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@astrojs/solid-js": "^4.0.1",
"@astrojs/svelte": "^5.2.0",
"@astrojs/vue": "^4.0.8",
"astro": "^4.4.14",
"astro": "^4.4.15",
"preact": "^10.19.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/preact": "^3.1.1",
"@preact/signals": "^1.2.1",
"astro": "^4.4.14",
"astro": "^4.4.15",
"preact": "^10.19.2"
}
}
2 changes: 1 addition & 1 deletion examples/framework-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@astrojs/react": "^3.0.10",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
"astro": "^4.4.14",
"astro": "^4.4.15",
"react": "^18.2.0",
"react-dom": "^18.2.0"
}
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 @@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/solid-js": "^4.0.1",
"astro": "^4.4.14",
"astro": "^4.4.15",
"solid-js": "^1.8.5"
}
}
2 changes: 1 addition & 1 deletion examples/framework-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/svelte": "^5.2.0",
"astro": "^4.4.14",
"astro": "^4.4.15",
"svelte": "^4.2.5"
}
}
2 changes: 1 addition & 1 deletion examples/framework-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/vue": "^4.0.8",
"astro": "^4.4.14",
"astro": "^4.4.15",
"vue": "^3.3.8"
}
}
Loading

0 comments on commit 8ddd479

Please sign in to comment.