0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-04-07 23:41:43 -05:00

Merge pull request #9247 from withastro/next

Merge the `next` branch into `main` for the 4.0 release
This commit is contained in:
Matthew Phillips 2023-11-30 10:03:51 -05:00 committed by GitHub
commit fbf145af8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
408 changed files with 7792 additions and 5393 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Redesign Dev Overlay main screen to show more information, such as the coolest integrations, your current Astro version and more.

View file

@ -0,0 +1,9 @@
---
'@astrojs/mdx': major
'@astrojs/markdown-remark': major
'astro': major
---
Updates the unified, remark, and rehype dependencies to latest. Make sure to update your custom remark and rehype plugins as well to be compatible with the latest versions.
**Potentially breaking change:** The default value of `markdown.remarkRehype.footnoteBackLabel` is changed from `"Back to content"` to `"Back to reference 1"`. See the `mdast-util-to-hast` [commit](https://github.com/syntax-tree/mdast-util-to-hast/commit/56c88e45690be138fad9f0bf367b939d09816863) for more information.

View file

@ -0,0 +1,6 @@
---
'@astrojs/vercel': major
'@astrojs/node': major
---
The internals of the integration have been updated to support Astro 4.0. Make sure to upgrade your Astro version as Astro 3.0 is no longer supported.

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fixes an issue where links with the same pathname as the current page, but different search params, were not prefetched.

View file

@ -0,0 +1,5 @@
---
'astro': minor
---
Update CLI logging experience

View file

@ -0,0 +1,9 @@
---
'astro': major
---
Removes support for returning simple objects from endpoints (deprecated since Astro 3.0). You should return a `Response` instead.
`ResponseWithEncoding` is also removed. You can refactor the code to return a response with an array buffer instead, which is encoding agnostic.
The types for middlewares have also been revised. To type a middleware function, you should now use `MiddlewareHandler` instead of `MiddlewareResponseHandler`. If you used `defineMiddleware()` to type the function, no changes are needed.

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Ensure the dev-overlay-window is anchored to the bottom

View file

@ -0,0 +1,17 @@
---
'astro': minor
---
Adds the `astro preferences` command to manage user preferences. User preferences are specific to individual Astro users, unlike the `astro.config.mjs` file which changes behavior for everyone working on a project.
User preferences are scoped to the current project by default, stored in a local `.astro/settings.json` file. Using the `--global` flag, user preferences can also be applied to every Astro project on the current machine. Global user preferences are stored in an operating system-specific location.
```sh
# Disable the dev overlay for the current user in the current project
npm run astro preferences disable devOverlay
# Disable the dev overlay for the current user in all Astro projects on this machine
npm run astro preferences --global disable devOverlay
# Check if the dev overlay is enabled for the current user
npm run astro preferences list devOverlay
```

View file

@ -0,0 +1,5 @@
---
'@astrojs/vercel': major
---
Removes deprecated `analytics` option. Use the `webAnalytics` option instead.

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fix SVG icons not showing properly in the extended dropdown menu of the dev overlay

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Improve high contrast mode with the Dev Overlay

View file

@ -0,0 +1,5 @@
---
'@astrojs/markdown-remark': patch
---
Fixes `RemarkRehype` type's `handler` and `handlers` properties

View file

@ -0,0 +1,8 @@
---
'@astrojs/svelte': major
'@astrojs/react': patch
'@astrojs/vue': patch
'astro': major
---
Adds Vite 5 support. There are no breaking changes from Astro. Check the [Vite migration guide](https://vitejs.dev/guide/migration.html) for details of the breaking changes from Vite instead.

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Update the look and feel of the dev overlay

View file

@ -0,0 +1,5 @@
---
'create-astro': patch
---
Stop clearing the console on start

View file

@ -0,0 +1,5 @@
---
'astro': major
---
Removes the opt-in `handleForms` property for `<ViewTransitions />`. Form submissions are now handled by default and can be disabled by setting `data-astro-reload` on relevant `<form />` elements.

View file

@ -0,0 +1,21 @@
---
'astro': major
---
Removes support for Shiki custom language's `path` property. The language JSON file should be imported and passed to the option instead.
```diff
// astro.config.js
+ import customLang from './custom.tmLanguage.json'
export default defineConfig({
markdown: {
shikiConfig: {
langs: [
- { path: './custom.tmLanguage.json' },
+ customLang,
],
},
},
})
```

62
.changeset/pre.json Normal file
View file

@ -0,0 +1,62 @@
{
"mode": "pre",
"tag": "beta",
"initialVersions": {
"astro": "3.5.5",
"@astrojs/prism": "3.0.0",
"@astrojs/rss": "3.0.0",
"create-astro": "4.5.1",
"@astrojs/alpinejs": "0.3.1",
"@astrojs/cloudflare": "0.0.0",
"@astrojs/lit": "3.0.3",
"@astrojs/markdoc": "0.7.2",
"@astrojs/mdx": "1.1.5",
"@astrojs/netlify": "0.0.0",
"@astrojs/node": "6.0.4",
"@astrojs/partytown": "2.0.2",
"@astrojs/preact": "3.0.1",
"@astrojs/prefetch": "0.4.1",
"@astrojs/react": "3.0.5",
"@astrojs/sitemap": "3.0.3",
"@astrojs/solid-js": "3.0.2",
"@astrojs/svelte": "4.0.4",
"@astrojs/tailwind": "5.0.2",
"@astrojs/vercel": "5.2.0",
"@astrojs/vue": "3.0.4",
"@astrojs/internal-helpers": "0.2.1",
"@astrojs/markdown-remark": "3.5.0",
"@astrojs/telemetry": "3.0.4",
"@astrojs/underscore-redirects": "0.3.3",
"@astrojs/upgrade": "0.0.1"
},
"changesets": [
"angry-swans-fry",
"beige-jokes-report",
"big-cooks-notice",
"brown-jars-lick",
"calm-baboons-watch",
"clever-beds-notice",
"famous-eels-trade",
"gentle-cobras-wash",
"giant-snails-perform",
"grumpy-seas-switch",
"khaki-fans-sell",
"light-ties-poke",
"modern-candles-sip",
"odd-rivers-happen",
"plenty-candles-help",
"rude-hairs-whisper",
"sharp-starfishes-compete",
"shiny-trees-sip",
"short-deers-whisper",
"slow-hornets-try",
"sour-games-burn",
"spicy-starfishes-shake",
"tasty-dryers-bathe",
"three-chairs-sip",
"tricky-dragons-explain",
"weak-wolves-bow",
"wicked-sloths-develop",
"wild-apricots-rescue"
]
}

View file

@ -0,0 +1,5 @@
---
'astro': minor
---
Renames the `entryPoint` property of the `injectRoute` integrations API to `entrypoint` for consistency. A warning will be shown prompting you to update your code when using the old name.

View file

@ -0,0 +1,20 @@
---
'astro': major
---
This change only affects maintainers of third-party adapters. In the Integration API, the `app.render()` method of the `App` class has been simplified.
Instead of two optional arguments, it now takes a single optional argument that is an object with two optional properties: `routeData` and `locals`.
```diff
app.render(request)
- app.render(request, routeData)
+ app.render(request, { routeData })
- app.render(request, routeData, locals)
+ app.render(request, { routeData, locals })
- app.render(request, undefined, locals)
+ app.render(request, { locals })
```
The current signature is deprecated but will continue to function until next major version.

View file

@ -0,0 +1,5 @@
---
'@astrojs/markdown-remark': major
---
Removes deprecated APIs. All Astro packages had been refactored to not use these APIs.

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Removes vendored Vite's `importMeta.d.ts` file in favour of Vite 5's new `vite/types/import-meta.d.ts` export

View file

@ -0,0 +1,5 @@
---
'@astrojs/rss': major
---
Removes the `drafts` option as the feature is deprecated in Astro 3.0

View file

@ -0,0 +1,13 @@
---
"astro": patch
---
Refactors virtual modules exports. This should not break your project unless you import Astro's internal modules, including:
- `astro/middleware/namespace`
- `astro/transitions`
- `astro/transitions/router`
- `astro/transitions/events`
- `astro/transitions/types`
- `astro/prefetch`
- `astro/i18n`

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Ensure overlay x-ray z-index is higher than the island

View file

@ -0,0 +1,27 @@
---
'@astrojs/upgrade': minor
---
Initial release!
`@astrojs/upgrade` is an automated command-line tool for upgrading Astro and your official Astro integrations together.
Inside of your existing `astro` project, run the following command to install the `latest` version of your integrations.
**With NPM:**
```bash
npx @astrojs/upgrade
```
**With Yarn:**
```bash
yarn dlx @astrojs/upgrade
```
**With PNPM:**
```bash
pnpm dlx @astrojs/upgrade
```

View file

@ -0,0 +1,5 @@
---
'astro': minor
---
Update error log formatting

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fixes a number of small user experience bugs with the dev overlay

View file

@ -0,0 +1,5 @@
---
'astro': major
---
Removes deprecated `app.match()` option, `matchNotFound`

View file

@ -0,0 +1,11 @@
---
'astro': major
---
Removes deprecated features from Astro 3.0
- Adapters are now required to pass `supportedAstroFeatures` to specify a list of features they support.
- The `build.split` and `build.excludeMiddleware` options are removed. Use `functionPerRoute` and `edgeMiddleware` from adapters instead.
- The `markdown.drafts` option and draft feature is removed. Use content collections instead.
- Lowercase endpoint names are no longer supported. Use uppercase endpoint names instead.
- `getHeaders()` exported from markdown files is removed. Use `getHeadings()` instead.

View file

@ -0,0 +1,5 @@
---
'@astrojs/svelte': major
---
Drops support for Svelte 3 as `@sveltejs/vite-plugin-svelte` is updated to `3.0.0` which does not support Svelte 3

View file

@ -248,7 +248,7 @@ If you have gotten permission from the core contributors, you can enter into pre
- Run: `pnpm exec changeset pre enter next` in the project root
- Create a new PR from the changes created by this command
- Review, approve, and more the PR to enter prerelease mode.
- If successful, The "Version Packages" PR (if one exists) will now say "Version Packages (next)".
- If successful, The "[ci] release" PR (if one exists) will now say "[ci] release (next)".
### Exiting prerelease mode
@ -257,7 +257,7 @@ Exiting prerelease mode should happen once an experimental release is ready to g
- Run: `pnpm exec changeset pre exit` in the project root
- Create a new PR from the changes created by this command.
- Review, approve, and more the PR to enter prerelease mode.
- If successful, The "Version Packages (next)" PR (if one exists) will now say "Version Packages".
- If successful, The "[ci] release (next)" PR (if one exists) will now say "[ci] release".
### Releasing `astro@latest` while in prerelease mode

View file

@ -29,7 +29,7 @@
"astro": "workspace:*"
},
"devDependencies": {
"@types/server-destroy": "^1.0.1",
"@types/server-destroy": "^1.0.3",
"astro": "workspace:*",
"astro-scripts": "workspace:*"
}

View file

@ -6,6 +6,7 @@ export function getAdapter(): AstroAdapter {
serverEntrypoint: '@benchmark/timer/server.js',
previewEntrypoint: '@benchmark/timer/preview.js',
exports: ['handler'],
supportedAstroFeatures: {},
};
}

View file

@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^3.6.4"
"astro": "^4.0.0-beta.2"
}
}

View file

@ -11,9 +11,9 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/mdx": "^1.1.5",
"@astrojs/rss": "^3.0.0",
"@astrojs/mdx": "^2.0.0-beta.0",
"@astrojs/rss": "^4.0.0-beta.0",
"@astrojs/sitemap": "^3.0.3",
"astro": "^3.6.4"
"astro": "^4.0.0-beta.2"
}
}

View file

@ -15,7 +15,7 @@
],
"scripts": {},
"devDependencies": {
"astro": "^3.6.4"
"astro": "^4.0.0-beta.2"
},
"peerDependencies": {
"astro": "^3.0.0"

View file

@ -12,8 +12,8 @@
},
"dependencies": {
"@astrojs/alpinejs": "^0.3.1",
"@types/alpinejs": "^3.7.2",
"alpinejs": "^3.12.3",
"astro": "^3.6.4"
"@types/alpinejs": "^3.13.5",
"alpinejs": "^3.13.3",
"astro": "^4.0.0-beta.2"
}
}

View file

@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/lit": "^3.0.3",
"@webcomponents/template-shadowroot": "^0.2.1",
"astro": "^3.6.4",
"astro": "^4.0.0-beta.2",
"lit": "^2.8.0"
}
}

View file

@ -12,16 +12,16 @@
},
"dependencies": {
"@astrojs/preact": "^3.0.1",
"@astrojs/react": "^3.0.6",
"@astrojs/react": "^3.0.7-beta.0",
"@astrojs/solid-js": "^3.0.2",
"@astrojs/svelte": "^4.0.4",
"@astrojs/vue": "^3.0.4",
"astro": "^3.6.4",
"preact": "^10.17.1",
"@astrojs/svelte": "^5.0.0-beta.0",
"@astrojs/vue": "^4.0.0-beta.0",
"astro": "^4.0.0-beta.2",
"preact": "^10.19.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"solid-js": "^1.7.11",
"svelte": "^4.2.0",
"vue": "^3.3.4"
"solid-js": "^1.8.5",
"svelte": "^4.2.5",
"vue": "^3.3.8"
}
}

View file

@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/preact": "^3.0.1",
"@preact/signals": "^1.2.1",
"astro": "^3.6.4",
"preact": "^10.17.1"
"astro": "^4.0.0-beta.2",
"preact": "^10.19.2"
}
}

View file

@ -11,10 +11,10 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/react": "^3.0.6",
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"astro": "^3.6.4",
"@astrojs/react": "^3.0.7-beta.0",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
"astro": "^4.0.0-beta.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
}

View file

@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/solid-js": "^3.0.2",
"astro": "^3.6.4",
"solid-js": "^1.7.11"
"astro": "^4.0.0-beta.2",
"solid-js": "^1.8.5"
}
}

View file

@ -11,8 +11,8 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/svelte": "^4.0.4",
"astro": "^3.6.4",
"svelte": "^4.2.0"
"@astrojs/svelte": "^5.0.0-beta.0",
"astro": "^4.0.0-beta.2",
"svelte": "^4.2.5"
}
}

View file

@ -11,8 +11,8 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/vue": "^3.0.4",
"astro": "^3.6.4",
"vue": "^3.3.4"
"@astrojs/vue": "^4.0.0-beta.0",
"astro": "^4.0.0-beta.2",
"vue": "^3.3.8"
}
}

View file

@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/node": "^6.1.0",
"astro": "^3.6.4"
"@astrojs/node": "^7.0.0-beta.1",
"astro": "^4.0.0-beta.2"
}
}

View file

@ -15,7 +15,7 @@
],
"scripts": {},
"devDependencies": {
"astro": "^3.6.4"
"astro": "^4.0.0-beta.2"
},
"peerDependencies": {
"astro": "^3.0.0"

View file

@ -12,8 +12,8 @@
"server": "node dist/server/entry.mjs"
},
"dependencies": {
"@astrojs/node": "^6.1.0",
"astro": "^3.6.4",
"@astrojs/node": "^7.0.0-beta.1",
"astro": "^4.0.0-beta.2",
"html-minifier": "^4.0.0"
}
}

View file

@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^3.6.4"
"astro": "^4.0.0-beta.2"
}
}

View file

@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^3.6.4"
"astro": "^4.0.0-beta.2"
}
}

View file

@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^3.6.4"
"astro": "^4.0.0-beta.2"
}
}

View file

@ -12,9 +12,9 @@
"server": "node dist/server/entry.mjs"
},
"dependencies": {
"@astrojs/node": "^6.1.0",
"@astrojs/svelte": "^4.0.4",
"astro": "^3.6.4",
"svelte": "^4.2.0"
"@astrojs/node": "^7.0.0-beta.1",
"@astrojs/svelte": "^5.0.0-beta.0",
"astro": "^4.0.0-beta.2",
"svelte": "^4.2.5"
}
}

View file

@ -10,8 +10,8 @@
"astro": "astro"
},
"devDependencies": {
"@astrojs/tailwind": "^5.0.2",
"@astrojs/node": "^6.1.0",
"astro": "^3.6.4"
"@astrojs/tailwind": "^6.0.0-beta.0",
"@astrojs/node": "^7.0.0-beta.1",
"astro": "^4.0.0-beta.2"
}
}

View file

@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/markdoc": "^0.7.2",
"astro": "^3.6.4"
"@astrojs/markdoc": "^1.0.0-beta.0",
"astro": "^4.0.0-beta.2"
}
}

View file

@ -11,11 +11,11 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/markdown-remark": "^3.5.0",
"astro": "^3.6.4",
"hast-util-select": "^5.0.5",
"rehype-autolink-headings": "^6.1.1",
"rehype-slug": "^5.1.0",
"@astrojs/markdown-remark": "^4.0.0-beta.0",
"astro": "^4.0.0-beta.2",
"hast-util-select": "^6.0.2",
"rehype-autolink-headings": "^7.1.0",
"rehype-slug": "^6.0.0",
"rehype-toc": "^3.0.2",
"remark-code-titles": "^0.1.2"
}

View file

@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^3.6.4"
"astro": "^4.0.0-beta.2"
}
}

View file

@ -11,9 +11,9 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/mdx": "^1.1.5",
"@astrojs/mdx": "^2.0.0-beta.0",
"@astrojs/preact": "^3.0.1",
"astro": "^3.6.4",
"preact": "^10.17.1"
"astro": "^4.0.0-beta.2",
"preact": "^10.19.2"
}
}

View file

@ -13,8 +13,8 @@
"dependencies": {
"@astrojs/preact": "^3.0.1",
"@nanostores/preact": "^0.5.0",
"astro": "^3.6.4",
"nanostores": "^0.9.3",
"preact": "^10.17.1"
"astro": "^4.0.0-beta.2",
"nanostores": "^0.9.5",
"preact": "^10.19.2"
}
}

View file

@ -11,13 +11,13 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/mdx": "^1.1.5",
"@astrojs/tailwind": "^5.0.2",
"@types/canvas-confetti": "^1.6.0",
"astro": "^3.6.4",
"@astrojs/mdx": "^2.0.0-beta.0",
"@astrojs/tailwind": "^6.0.0-beta.0",
"@types/canvas-confetti": "^1.6.3",
"astro": "^4.0.0-beta.2",
"autoprefixer": "^10.4.15",
"canvas-confetti": "^1.6.0",
"canvas-confetti": "^1.9.1",
"postcss": "^8.4.28",
"tailwindcss": "^3.3.3"
"tailwindcss": "^3.3.5"
}
}

View file

@ -11,8 +11,8 @@
"astro": "astro"
},
"dependencies": {
"astro": "^3.6.4",
"vite-plugin-pwa": "0.16.4",
"astro": "^4.0.0-beta.2",
"vite-plugin-pwa": "0.17.0",
"workbox-window": "^7.0.0"
}
}

View file

@ -12,7 +12,7 @@
"test": "vitest"
},
"dependencies": {
"astro": "^3.6.4",
"astro": "^4.0.0-beta.2",
"vitest": "^0.34.2"
}
}

View file

@ -77,23 +77,23 @@
"astro-benchmark": "workspace:*"
},
"devDependencies": {
"@astrojs/check": "^0.1.0",
"@astrojs/check": "^0.3.1",
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.2",
"@types/node": "^18.17.8",
"@typescript-eslint/eslint-plugin": "^6.4.1",
"@typescript-eslint/parser": "^6.4.1",
"esbuild": "^0.19.2",
"eslint": "^8.47.0",
"@typescript-eslint/eslint-plugin": "^6.11.0",
"@typescript-eslint/parser": "^6.11.0",
"esbuild": "^0.19.6",
"eslint": "^8.54.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-prettier": "^5.0.0",
"only-allow": "^1.1.1",
"organize-imports-cli": "^0.10.0",
"prettier": "^3.0.3",
"prettier-plugin-astro": "^0.12.0",
"prettier": "^3.1.0",
"prettier-plugin-astro": "^0.12.2",
"tiny-glob": "^0.2.9",
"turbo": "^1.10.12",
"typescript": "~5.1.6"
"typescript": "~5.2.2"
}
}

View file

@ -35,7 +35,7 @@
"prismjs": "^1.29.0"
},
"devDependencies": {
"@types/prismjs": "1.26.0",
"@types/prismjs": "1.26.3",
"astro-scripts": "workspace:*"
},
"engines": {

View file

@ -1,5 +1,11 @@
# @astrojs/rss
## 4.0.0-beta.0
### Major Changes
- [#9168](https://github.com/withastro/astro/pull/9168) [`153a5abb9`](https://github.com/withastro/astro/commit/153a5abb905042ac68b712514dc9ec387d3e6b17) Thanks [@bluwy](https://github.com/bluwy)! - Removes the `drafts` option as the feature is deprecated in Astro 3.0
## 3.0.0
### Major Changes

View file

@ -28,7 +28,7 @@ Start by [adding a `site` to your project's `astro.config` for link generation](
import rss from '@astrojs/rss';
import { getCollection } from 'astro:content';
export async function get(context) {
export async function GET(context) {
const posts = await getCollection('blog');
return rss({
title: 'Buzzs Blog',
@ -55,7 +55,7 @@ Read **[Astro's RSS docs][astro-rss]** for more on using content collections, an
The `rss` default export offers a number of configuration options. Here's a quick reference:
```js
export function get(context) {
export function GET(context) {
return rss({
// `<title>` field in output xml
title: 'Buzzs Blog',
@ -98,7 +98,7 @@ The base URL to use when generating RSS item links. We recommend using the [endp
```ts
import rss from '@astrojs/rss';
export const get = (context) =>
export const GET = (context) =>
rss({
site: context.site,
// ...
@ -113,14 +113,6 @@ A list of formatted RSS feed items. See [Astro's RSS items documentation](https:
When providing a formatted RSS item list, see the [`RSSFeedItem` type reference](#rssfeeditem).
### drafts
Type: `boolean (optional)`
**Deprecated**: Manually filter `items` instead.
Set `drafts: true` to include [draft posts](https://docs.astro.build/en/guides/markdown-content/#draft-pages) in the feed output. By default, this option is `false` and draft posts are not included.
### stylesheet
Type: `string (optional)`
@ -136,7 +128,7 @@ A string of valid XML to be injected between your feed's `<description>` and `<i
```js
import rss from '@astrojs/rss';
export const get = () => rss({
export const GET = () => rss({
...
customData: '<language>en-us</language>',
});
@ -181,7 +173,7 @@ By default, the library will add trailing slashes to the emitted URLs. To preven
```js
import rss from '@astrojs/rss';
export const get = () =>
export const GET = () =>
rss({
trailingSlash: false,
});
@ -361,7 +353,7 @@ This function assumes, but does not verify, you are globbing for items inside `s
// src/pages/rss.xml.js
import rss, { pagesGlobToRssItems } from '@astrojs/rss';
export async function get(context) {
export async function GET(context) {
return rss({
title: 'Buzzs Blog',
description: 'A humble Astronauts guide to the stars',
@ -379,7 +371,7 @@ As `rss()` returns a `Response`, you can also use `getRssString()` to get the RS
// src/pages/rss.xml.js
import { getRssString } from '@astrojs/rss';
export async function get(context) {
export async function GET(context) {
const rssString = await getRssString({
title: 'Buzzs Blog',
...

View file

@ -1,7 +1,7 @@
{
"name": "@astrojs/rss",
"description": "Add RSS feeds to your Astro projects",
"version": "3.0.0",
"version": "4.0.0-beta.0",
"type": "module",
"types": "./dist/index.d.ts",
"author": "withastro",
@ -27,9 +27,9 @@
"test": "mocha --exit --timeout 20000"
},
"devDependencies": {
"@types/chai": "^4.3.5",
"@types/chai-as-promised": "^7.1.5",
"@types/mocha": "^10.0.1",
"@types/chai": "^4.3.10",
"@types/chai-as-promised": "^7.1.8",
"@types/mocha": "^10.0.4",
"astro": "workspace:*",
"astro-scripts": "workspace:*",
"chai": "^4.3.7",

View file

@ -27,11 +27,6 @@ export type RSSOptions = {
stylesheet?: z.infer<typeof rssOptionsValidator>['stylesheet'];
/** Specify custom data in opening of file */
customData?: z.infer<typeof rssOptionsValidator>['customData'];
/**
* Whether to include drafts or not
* @deprecated Deprecated since version 3.0. Use content collections instead.
*/
drafts?: z.infer<typeof rssOptionsValidator>['drafts'];
trailingSlash?: z.infer<typeof rssOptionsValidator>['trailingSlash'];
};
@ -48,11 +43,6 @@ export type RSSFeedItem = {
description?: z.infer<typeof rssSchema>['description'];
/** Append some other XML-valid data to this item */
customData?: z.infer<typeof rssSchema>['customData'];
/**
* Whether draft or not
* @deprecated Deprecated since version 3.0. Use content collections instead.
*/
draft?: z.infer<typeof rssSchema>['draft'];
/** Categories or tags related to the item */
categories?: z.infer<typeof rssSchema>['categories'];
/** The item author's email address */
@ -92,7 +82,6 @@ const rssOptionsValidator = z.object({
return items;
}),
xmlns: z.record(z.string()).optional(),
drafts: z.boolean().default(false),
stylesheet: z.union([z.string(), z.boolean()]).optional(),
customData: z.string().optional(),
trailingSlash: z.boolean().default(true),
@ -159,10 +148,7 @@ export function pagesGlobToRssItems(items: GlobResult): Promise<ValidatedRSSFeed
/** Generate RSS 2.0 feed */
async function generateRSS(rssOptions: ValidatedRSSOptions): Promise<string> {
const { site } = rssOptions;
const items = rssOptions.drafts
? rssOptions.items
: rssOptions.items.filter((item) => !item.draft);
const { items, site } = rssOptions;
const xmlOptions = {
ignoreAttributes: false,

View file

@ -8,7 +8,6 @@ export const rssSchema = z.object({
.refine((value) => !isNaN(value.getTime())),
description: z.string().optional(),
customData: z.string().optional(),
draft: z.boolean().optional(),
categories: z.array(z.string()).optional(),
author: z.string().optional(),
commentsUrl: z.string().optional(),

View file

@ -156,36 +156,12 @@ describe('getRssString', () => {
chai.expect(str).to.contain(customData);
});
it('should filter out entries marked as `draft`', async () => {
const str = await getRssString({
title,
description,
items: [phpFeedItem, { ...web1FeedItem, draft: true }],
site,
});
chai.expect(str).xml.to.equal(validXmlWithoutWeb1FeedResult);
});
it('should respect drafts option', async () => {
const str = await getRssString({
title,
description,
items: [phpFeedItem, { ...web1FeedItem, draft: true }],
site,
drafts: true,
});
chai.expect(str).xml.to.equal(validXmlResult);
});
it('should not append trailing slash to URLs with the given option', async () => {
const str = await getRssString({
title,
description,
items: [phpFeedItem, { ...web1FeedItem, draft: true }],
items: [phpFeedItem],
site,
drafts: true,
trailingSlash: false,
});

View file

@ -1,5 +1,183 @@
# astro
## 4.0.0-beta.2
### Major Changes
- [#9225](https://github.com/withastro/astro/pull/9225) [`c421a3d17`](https://github.com/withastro/astro/commit/c421a3d17911aeda29b5204f6d568ae87e329eaf) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Removes the opt-in `handleForms` property for `<ViewTransitions />`. Form submissions are now handled by default and can be disabled by setting `data-astro-reload` on relevant `<form />` elements.
- [#9199](https://github.com/withastro/astro/pull/9199) [`49aa215a0`](https://github.com/withastro/astro/commit/49aa215a01ee1c4805316c85bb0aea6cfbc25a31) Thanks [@lilnasy](https://github.com/lilnasy)! - This change only affects maintainers of third-party adapters. In the Integration API, the `app.render()` method of the `App` class has been simplified.
Instead of two optional arguments, it now takes a single optional argument that is an object with two optional properties: `routeData` and `locals`.
```diff
app.render(request)
- app.render(request, routeData)
+ app.render(request, { routeData })
- app.render(request, routeData, locals)
+ app.render(request, { routeData, locals })
- app.render(request, undefined, locals)
+ app.render(request, { locals })
```
The current signature is deprecated but will continue to function until next major version.
- [#9212](https://github.com/withastro/astro/pull/9212) [`c0383ea0c`](https://github.com/withastro/astro/commit/c0383ea0c102cb62b7235823c706a090ba08715f) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Removes deprecated `app.match()` option, `matchNotFound`
### Minor Changes
- [#9115](https://github.com/withastro/astro/pull/9115) [`3b77889b4`](https://github.com/withastro/astro/commit/3b77889b47750ed6e17c7858780dc4aae9201b58) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Adds the `astro preferences` command to manage user preferences. User preferences are specific to individual Astro users, unlike the `astro.config.mjs` file which changes behavior for everyone working on a project.
User preferences are scoped to the current project by default, stored in a local `.astro/settings.json` file. Using the `--global` flag, user preferences can also be applied to every Astro project on the current machine. Global user preferences are stored in an operating system-specific location.
```sh
# Disable the dev overlay for the current user in the current project
npm run astro preferences disable devOverlay
# Disable the dev overlay for the current user in all Astro projects on this machine
npm run astro preferences --global disable devOverlay
# Check if the dev overlay is enabled for the current user
npm run astro preferences list devOverlay
```
- [#9129](https://github.com/withastro/astro/pull/9129) [`8bfc20511`](https://github.com/withastro/astro/commit/8bfc20511918d675202cdc100d4efab293e5cbac) Thanks [@FredKSchott](https://github.com/FredKSchott)! - Update error log formatting
### Patch Changes
- [#9222](https://github.com/withastro/astro/pull/9222) [`279e3c1b3`](https://github.com/withastro/astro/commit/279e3c1b3d06e7b48f01c0ef8285c3719ac74ace) Thanks [@matthewp](https://github.com/matthewp)! - Ensure the dev-overlay-window is anchored to the bottom
- [#9218](https://github.com/withastro/astro/pull/9218) [`f4401c8c1`](https://github.com/withastro/astro/commit/f4401c8c1fa203431b4e7b2e89381a91b4ef1ac6) Thanks [@matthewp](https://github.com/matthewp)! - Improve high contrast mode with the Dev Overlay
- [#9227](https://github.com/withastro/astro/pull/9227) [`4b8a42406`](https://github.com/withastro/astro/commit/4b8a42406bbdcc68604ea4ecc2a926721fbc4d52) Thanks [@matthewp](https://github.com/matthewp)! - Ensure overlay x-ray z-index is higher than the island
- [#9214](https://github.com/withastro/astro/pull/9214) [`4fe523b00`](https://github.com/withastro/astro/commit/4fe523b0064b323ee46b2574339d96ea8bdb7b2d) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Fixes a number of small user experience bugs with the dev overlay
## 4.0.0-beta.1
### Patch Changes
- [#9118](https://github.com/withastro/astro/pull/9118) [`000e8f465`](https://github.com/withastro/astro/commit/000e8f4654cae9982e21e0a858366c4844139db6) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Redesign Dev Overlay main screen to show more information, such as the coolest integrations, your current Astro version and more.
- [#9118](https://github.com/withastro/astro/pull/9118) [`000e8f465`](https://github.com/withastro/astro/commit/000e8f4654cae9982e21e0a858366c4844139db6) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Fixes an issue where links with the same pathname as the current page, but different search params, were not prefetched.
## 4.0.0-beta.0
### Major Changes
- [#9138](https://github.com/withastro/astro/pull/9138) [`abf601233`](https://github.com/withastro/astro/commit/abf601233f8188d118a8cb063c777478d8d9f1a3) Thanks [@bluwy](https://github.com/bluwy)! - Updates the unified, remark, and rehype dependencies to latest. Make sure to update your custom remark and rehype plugins as well to be compatible with the latest versions.
**Potentially breaking change:** The default value of `markdown.remarkRehype.footnoteBackLabel` is changed from `"Back to content"` to `"Back to reference 1"`. See the `mdast-util-to-hast` [commit](https://github.com/syntax-tree/mdast-util-to-hast/commit/56c88e45690be138fad9f0bf367b939d09816863) for more information.
- [#9181](https://github.com/withastro/astro/pull/9181) [`cdabf6ef0`](https://github.com/withastro/astro/commit/cdabf6ef02be7220fd2b6bdcef924ceca089381e) Thanks [@bluwy](https://github.com/bluwy)! - Removes support for returning simple objects from endpoints (deprecated since Astro 3.0). You should return a `Response` instead.
`ResponseWithEncoding` is also removed. You can refactor the code to return a response with an array buffer instead, which is encoding agnostic.
The types for middlewares have also been revised. To type a middleware function, you should now use `MiddlewareHandler` instead of `MiddlewareResponseHandler`. If you used `defineMiddleware()` to type the function, no changes are needed.
- [#9122](https://github.com/withastro/astro/pull/9122) [`1c48ed286`](https://github.com/withastro/astro/commit/1c48ed286538ab9e354eca4e4dcd7c6385c96721) Thanks [@bluwy](https://github.com/bluwy)! - Adds Vite 5 support. There are no breaking changes from Astro. Check the [Vite migration guide](https://vitejs.dev/guide/migration.html) for details of the breaking changes from Vite instead.
- [#9196](https://github.com/withastro/astro/pull/9196) [`37697a2c5`](https://github.com/withastro/astro/commit/37697a2c5511572dc29c0a4ea46f90c2f62be8e6) Thanks [@bluwy](https://github.com/bluwy)! - Removes support for Shiki custom language's `path` property. The language JSON file should be imported and passed to the option instead.
```diff
// astro.config.js
+ import customLang from './custom.tmLanguage.json'
export default defineConfig({
markdown: {
shikiConfig: {
langs: [
- { path: './custom.tmLanguage.json' },
+ customLang,
],
},
},
})
```
- [#9168](https://github.com/withastro/astro/pull/9168) [`153a5abb9`](https://github.com/withastro/astro/commit/153a5abb905042ac68b712514dc9ec387d3e6b17) Thanks [@bluwy](https://github.com/bluwy)! - Removes deprecated features from Astro 3.0
- Adapters are now required to pass `supportedAstroFeatures` to specify a list of features they support.
- The `build.split` and `build.excludeMiddleware` options are removed. Use `functionPerRoute` and `edgeMiddleware` from adapters instead.
- The `markdown.drafts` option and draft feature is removed. Use content collections instead.
- Lowercase endpoint names are no longer supported. Use uppercase endpoint names instead.
- `getHeaders()` exported from markdown files is removed. Use `getHeadings()` instead.
### Minor Changes
- [#9105](https://github.com/withastro/astro/pull/9105) [`6201bbe96`](https://github.com/withastro/astro/commit/6201bbe96c2a083fb201e4a43a9bd88499821a3e) Thanks [@FredKSchott](https://github.com/FredKSchott)! - Update CLI logging experience
- [#9161](https://github.com/withastro/astro/pull/9161) [`bd0c2e9ae`](https://github.com/withastro/astro/commit/bd0c2e9ae3389a9d3085050c1e8134ae98dff299) Thanks [@bluwy](https://github.com/bluwy)! - Renames the `entryPoint` property of the `injectRoute` integrations API to `entrypoint` for consistency. A warning will be shown prompting you to update your code when using the old name.
### Patch Changes
- [#9149](https://github.com/withastro/astro/pull/9149) [`0fe3a7ed5`](https://github.com/withastro/astro/commit/0fe3a7ed5d7bb1a9fce1623e84ba14104b51223c) Thanks [@bluwy](https://github.com/bluwy)! - Removes vendored Vite's `importMeta.d.ts` file in favour of Vite 5's new `vite/types/import-meta.d.ts` export
- [#9150](https://github.com/withastro/astro/pull/9150) [`710be505c`](https://github.com/withastro/astro/commit/710be505c9ddf416e77a75343d8cae9c497d72c6) Thanks [@bluwy](https://github.com/bluwy)! - Refactors virtual modules exports. This should not break your project unless you import Astro's internal modules, including:
- `astro/middleware/namespace`
- `astro/transitions`
- `astro/transitions/router`
- `astro/transitions/events`
- `astro/transitions/types`
- `astro/prefetch`
- `astro/i18n`
- Updated dependencies [[`abf601233`](https://github.com/withastro/astro/commit/abf601233f8188d118a8cb063c777478d8d9f1a3), [`addb57c8e`](https://github.com/withastro/astro/commit/addb57c8e80b7b67ec61224666f3a1db5c44410c), [`c7953645e`](https://github.com/withastro/astro/commit/c7953645eeaaf9e87c6db4494b0023d2c1878ff0)]:
- @astrojs/markdown-remark@4.0.0-beta.0
## 3.6.4
### Patch Changes
- [#9226](https://github.com/withastro/astro/pull/9226) [`8f8a40e93`](https://github.com/withastro/astro/commit/8f8a40e93d6a0774ba84a6f5db8c42cd81db005e) Thanks [@outofambit](https://github.com/outofambit)! - Fix i18n fallback routing with routing strategy of always-prefix
- [#9179](https://github.com/withastro/astro/pull/9179) [`3f28336d9`](https://github.com/withastro/astro/commit/3f28336d9a52d7e4364d455ee3128d14d10a078a) Thanks [@lilnasy](https://github.com/lilnasy)! - Fixes an issue where the presence of a slot in a page led to an error.
- [#9219](https://github.com/withastro/astro/pull/9219) [`067a65f5b`](https://github.com/withastro/astro/commit/067a65f5b4d163bf1944cf47e6bf891f0b93553f) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Fix edge case where `<style>` updates inside of `.astro` files would ocassionally fail to update without reloading the page.
- [#9236](https://github.com/withastro/astro/pull/9236) [`27d3e86e4`](https://github.com/withastro/astro/commit/27d3e86e4c8d04101113ab7a53477f26a4fb0619) Thanks [@ematipico](https://github.com/ematipico)! - The configuration `i18n.routingStrategy` has been replaced with an object called `routing`.
```diff
export default defineConfig({
experimental: {
i18n: {
- routingStrategy: "prefix-always",
+ routing: {
+ prefixDefaultLocale: true,
+ }
}
}
})
```
```diff
export default defineConfig({
experimental: {
i18n: {
- routingStrategy: "prefix-other-locales",
+ routing: {
+ prefixDefaultLocale: false,
+ }
}
}
})
```
## 3.6.3
### Patch Changes
- [#9193](https://github.com/withastro/astro/pull/9193) [`0dc99c9a2`](https://github.com/withastro/astro/commit/0dc99c9a28fcb6b46db49eefac6afa415875edcb) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Prevents the Code component from crashing if the lang isn't supported by falling back to `plaintext`.
## 3.6.2
### Patch Changes
- [#9189](https://github.com/withastro/astro/pull/9189) [`d90714fc3`](https://github.com/withastro/astro/commit/d90714fc3dd7c3eab0a6b29319b0b666bb04b678) Thanks [@SpencerWhitehead7](https://github.com/SpencerWhitehead7)! - Fixes an issue where links with the same pathname as the current page, but different search params, were not prefetched.
## 3.6.4
### Patch Changes

View file

@ -1,4 +1,4 @@
/// <reference path="./import-meta.d.ts" />
/// <reference types="vite/types/import-meta.d.ts" />
// eslint-disable-next-line @typescript-eslint/no-namespace
declare namespace App {
@ -106,7 +106,7 @@ declare module '*.avif' {
}
declare module 'astro:transitions' {
type TransitionModule = typeof import('./dist/transitions/index.js');
type TransitionModule = typeof import('./dist/virtual-modules/transitions.js');
export const slide: TransitionModule['slide'];
export const fade: TransitionModule['fade'];
export const createAnimationScope: TransitionModule['createAnimationScope'];
@ -116,44 +116,45 @@ declare module 'astro:transitions' {
}
declare module 'astro:transitions/client' {
type TransitionRouterModule = typeof import('./dist/transitions/router.js');
type TransitionRouterModule = typeof import('./dist/virtual-modules/transitions-router.js');
export const navigate: TransitionRouterModule['navigate'];
type TransitionUtilModule = typeof import('./dist/transitions/util.js');
type TransitionUtilModule = typeof import('./dist/virtual-modules/transitions-util.js');
export const supportsViewTransitions: TransitionUtilModule['supportsViewTransitions'];
export const getFallback: TransitionUtilModule['getFallback'];
export const transitionEnabledOnThisPage: TransitionUtilModule['transitionEnabledOnThisPage'];
export type Fallback = import('./dist/transitions/types.ts').Fallback;
export type Direction = import('./dist/transitions/types.ts').Direction;
export type NavigationTypeString = import('./dist/transitions/types.ts').NavigationTypeString;
export type Options = import('./dist/transitions/types.ts').Options;
export type Fallback = import('./dist/virtual-modules/transitions-types.js').Fallback;
export type Direction = import('./dist/virtual-modules/transitions-types.ts').Direction;
export type NavigationTypeString =
import('./dist/virtual-modules/transitions-types.js').NavigationTypeString;
export type Options = import('./dist/virtual-modules/transitions-types.js').Options;
type EventModule = typeof import('./dist/transitions/events.js');
type EventModule = typeof import('./dist/virtual-modules/transitions-events.js');
export const TRANSITION_BEFORE_PREPARATION: EventModule['TRANSITION_BEFORE_PREPARATION'];
export const TRANSITION_AFTER_PREPARATION: EventModule['TRANSITION_AFTER_PREPARATION'];
export const TRANSITION_BEFORE_SWAP: EventModule['TRANSITION_BEFORE_SWAP'];
export const TRANSITION_AFTER_SWAP: EventModule['TRANSITION_AFTER_SWAP'];
export const TRANSITION_PAGE_LOAD: EventModule['TRANSITION_PAGE_LOAD'];
export type TransitionBeforePreparationEvent =
import('./dist/transitions/events.ts').TransitionBeforePreparationEvent;
import('./dist/virtual-modules/transitions-events.js').TransitionBeforePreparationEvent;
export type TransitionBeforeSwapEvent =
import('./dist/transitions/events.ts').TransitionBeforeSwapEvent;
import('./dist/virtual-modules/transitions-events.js').TransitionBeforeSwapEvent;
export const isTransitionBeforePreparationEvent: EventModule['isTransitionBeforePreparationEvent'];
export const isTransitionBeforeSwapEvent: EventModule['isTransitionBeforeSwapEvent'];
}
declare module 'astro:prefetch' {
export { prefetch, PrefetchOptions } from 'astro/prefetch';
export { prefetch, PrefetchOptions } from 'astro/virtual-modules/prefetch.js';
}
declare module 'astro:i18n' {
export type GetLocaleOptions = import('./dist/i18n/index.js').GetLocaleOptions;
export type GetLocaleOptions = import('./dist/virtual-modules/i18n.js').GetLocaleOptions;
/**
* @param {string} locale A locale
* @param {string} [path=""] An optional path to add after the `locale`.
* @param {import('./dist/i18n/index.js').GetLocaleOptions} options Customise the generated path
* @param {import('./dist/virtual-modules/i18n.js').GetLocaleOptions} options Customise the generated path
* @return {string}
*
* Returns a _relative_ path with passed locale.
@ -182,7 +183,7 @@ declare module 'astro:i18n' {
*
* @param {string} locale A locale
* @param {string} [path=""] An optional path to add after the `locale`.
* @param {import('./dist/i18n/index.js').GetLocaleOptions} options Customise the generated path
* @param {import('./dist/virtual-modules/i18n.js').GetLocaleOptions} options Customise the generated path
* @return {string}
*
* Returns an absolute path with the passed locale. The behaviour is subject to change based on `site` configuration.
@ -212,7 +213,7 @@ declare module 'astro:i18n' {
/**
* @param {string} [path=""] An optional path to add after the `locale`.
* @param {import('./dist/i18n/index.js').GetLocaleOptions} options Customise the generated path
* @param {import('./dist/virtual-modules/i18n.js').GetLocaleOptions} options Customise the generated path
* @return {string[]}
*
* Works like `getRelativeLocaleUrl` but it emits the relative URLs for ALL locales:
@ -220,7 +221,7 @@ declare module 'astro:i18n' {
export const getRelativeLocaleUrlList: (path?: string, options?: GetLocaleOptions) => string[];
/**
* @param {string} [path=""] An optional path to add after the `locale`.
* @param {import('./dist/i18n/index.js').GetLocaleOptions} options Customise the generated path
* @param {import('./dist/virtual-modules/i18n.js').GetLocaleOptions} options Customise the generated path
* @return {string[]}
*
* Works like `getAbsoluteLocaleUrl` but it emits the absolute URLs for ALL locales:
@ -229,7 +230,7 @@ declare module 'astro:i18n' {
}
declare module 'astro:middleware' {
export * from 'astro/middleware/namespace';
export * from 'astro/virtual-modules/middleware.js';
}
declare module 'astro:components' {
@ -242,8 +243,6 @@ interface ExportedMarkdownModuleEntities {
file: MD['file'];
url: MD['url'];
getHeadings: MD['getHeadings'];
/** @deprecated Renamed to `getHeadings()` */
getHeaders: () => void;
Content: MD['Content'];
rawContent: MD['rawContent'];
compiledContent: MD['compiledContent'];

View file

@ -1,7 +1,4 @@
---
import path from 'node:path';
import fs from 'node:fs';
import { fileURLToPath } from 'node:url';
import type {
BuiltinLanguage,
BuiltinTheme,
@ -65,23 +62,6 @@ const {
// shiki -> shikiji compat
if (typeof lang === 'object') {
// shikiji does not support `path`
// https://github.com/shikijs/shiki/blob/facb6ff37996129626f8066a5dccb4608e45f649/packages/shiki/src/loader.ts#L98
const langPath = (lang as any).path;
if (langPath) {
// shiki resolves path from within its package directory :shrug:
const astroRoot = fileURLToPath(new URL('../', import.meta.url));
const normalizedPath = path.isAbsolute(langPath) ? langPath : path.resolve(astroRoot, langPath);
try {
const content = fs.readFileSync(normalizedPath, 'utf-8');
const parsed = JSON.parse(content);
Object.assign(lang, parsed);
} catch (e) {
throw new Error(`Unable to find language file at ${normalizedPath}`, {
cause: e,
});
}
}
// `id` renamed to `name` (always override)
if ((lang as any).id) {
lang.name = (lang as any).id;

View file

@ -3,10 +3,14 @@ type Fallback = 'none' | 'animate' | 'swap';
export interface Props {
fallback?: Fallback;
/** @deprecated handleForms is enabled by default in Astro 4.0
*
* Set `data-astro-reload` on your form to opt-out of the default behavior.
*/
handleForms?: boolean;
}
const { fallback = 'animate', handleForms } = Astro.props;
const { fallback = 'animate' } = Astro.props;
---
<style is:global>
@ -25,13 +29,12 @@ const { fallback = 'animate', handleForms } = Astro.props;
</style>
<meta name="astro-view-transitions-enabled" content="true" />
<meta name="astro-view-transitions-fallback" content={fallback} />
{handleForms ? <meta name="astro-view-transitions-forms" content="true" /> : ''}
<script>
import type { Options } from 'astro:transitions/client';
import { supportsViewTransitions, navigate } from 'astro:transitions/client';
// NOTE: import from `astro/prefetch` as `astro:prefetch` requires the `prefetch` config to be enabled
// NOTE: import from `astro/virtual-modules/prefetch.js` as `astro:prefetch` requires the `prefetch` config to be enabled
// @ts-ignore
import { init } from 'astro/prefetch';
import { init } from 'astro/virtual-modules/prefetch.js';
type Fallback = 'none' | 'animate' | 'swap';
@ -89,33 +92,31 @@ const { fallback = 'animate', handleForms } = Astro.props;
});
});
if (document.querySelector('[name="astro-view-transitions-forms"]')) {
document.addEventListener('submit', (ev) => {
let el = ev.target as HTMLElement;
if (el.tagName !== 'FORM' || isReloadEl(el)) {
return;
}
document.addEventListener('submit', (ev) => {
let el = ev.target as HTMLElement;
if (el.tagName !== 'FORM' || isReloadEl(el)) {
return;
}
const form = el as HTMLFormElement;
const submitter = ev.submitter;
const formData = new FormData(form);
// Use the form action, if defined, otherwise fallback to current path.
let action = submitter?.getAttribute('formaction') ?? form.action ?? location.pathname;
const method = submitter?.getAttribute('formmethod') ?? form.method;
const form = el as HTMLFormElement;
const submitter = ev.submitter;
const formData = new FormData(form);
// Use the form action, if defined, otherwise fallback to current path.
let action = submitter?.getAttribute('formaction') ?? form.action ?? location.pathname;
const method = submitter?.getAttribute('formmethod') ?? form.method;
const options: Options = { sourceElement: submitter ?? form };
if (method === 'get') {
const params = new URLSearchParams(formData as any);
const url = new URL(action);
url.search = params.toString();
action = url.toString();
} else {
options.formData = formData;
}
ev.preventDefault();
navigate(action, options);
});
}
const options: Options = { sourceElement: submitter ?? form };
if (method === 'get') {
const params = new URLSearchParams(formData as any);
const url = new URL(action);
url.search = params.toString();
action = url.toString();
} else {
options.formData = formData;
}
ev.preventDefault();
navigate(action, options);
});
// @ts-expect-error injected by vite-plugin-transitions for treeshaking
if (!__PREFETCH_DISABLED__) {

View file

@ -1,7 +1,12 @@
import { expect } from '@playwright/test';
import { testFactory } from './test-utils.js';
const test = testFactory({ root: './fixtures/astro-envs/' });
const test = testFactory({
root: './fixtures/astro-envs/',
devOverlay: {
enabled: false,
},
});
let devServer;

View file

@ -3,6 +3,9 @@ import { testFactory } from './test-utils.js';
const test = testFactory({
root: './fixtures/css/',
devOverlay: {
enabled: false,
},
});
let devServer;

View file

@ -3,5 +3,8 @@ import preact from '@astrojs/preact'
// https://astro.build/config
export default defineConfig({
integrations: [preact()]
integrations: [preact()],
devOverlay: {
enabled: false,
}
});

View file

@ -6,6 +6,6 @@
"@astrojs/preact": "workspace:*",
"@e2e/astro-linked-lib": "link:../_deps/astro-linked-lib",
"astro": "workspace:*",
"preact": "^10.17.1"
"preact": "^10.19.2"
}
}

View file

@ -5,5 +5,8 @@ import vue from '@astrojs/vue';
export default defineConfig({
site: 'http://example.com',
base: '/blog',
devOverlay: {
enabled: false,
},
integrations: [vue()],
});

View file

@ -5,6 +5,6 @@
"dependencies": {
"@astrojs/vue": "workspace:*",
"astro": "workspace:*",
"vue": "^3.3.4"
"vue": "^3.3.8"
}
}

View file

@ -11,11 +11,11 @@
"astro": "workspace:*"
},
"dependencies": {
"preact": "^10.17.1",
"preact": "^10.19.2",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"solid-js": "^1.7.11",
"svelte": "^4.2.0",
"vue": "^3.3.4"
"solid-js": "^1.8.5",
"svelte": "^4.2.5",
"vue": "^3.3.8"
}
}

View file

@ -2,7 +2,4 @@ import preact from '@astrojs/preact';
export default {
integrations: [preact()],
experimental: {
devOverlay: true
}
};

View file

@ -5,6 +5,6 @@
"dependencies": {
"@astrojs/preact": "workspace:*",
"astro": "workspace:*",
"preact": "^10.17.1"
"preact": "^10.19.2"
}
}

View file

@ -5,6 +5,6 @@
"dependencies": {
"@astrojs/preact": "workspace:*",
"astro": "workspace:*",
"preact": "^10.17.1"
"preact": "^10.19.2"
}
}

View file

@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"astro": "workspace:*",
"sass": "^1.66.1"
"sass": "^1.69.5"
}
}

View file

@ -9,12 +9,12 @@
"@astrojs/svelte": "workspace:*",
"@astrojs/vue": "workspace:*",
"astro": "workspace:*",
"preact": "^10.17.1",
"preact": "^10.19.2",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"sass": "^1.66.1",
"solid-js": "^1.7.11",
"svelte": "^4.2.0",
"vue": "^3.3.4"
"sass": "^1.69.5",
"solid-js": "^1.8.5",
"svelte": "^4.2.5",
"vue": "^3.3.8"
}
}

View file

@ -4,6 +4,6 @@
"private": true,
"devDependencies": {
"astro": "workspace:*",
"sass": "^1.66.1"
"sass": "^1.69.5"
}
}

View file

@ -9,6 +9,6 @@
"dependencies": {
"@astrojs/preact": "workspace:*",
"astro": "workspace:*",
"preact": "^10.17.1"
"preact": "^10.19.2"
}
}

View file

@ -4,4 +4,7 @@ import lit from '@astrojs/lit';
// https://astro.build/config
export default defineConfig({
integrations: [lit()],
devOverlay: {
enabled: false,
}
});

View file

@ -14,11 +14,11 @@
"dependencies": {
"@webcomponents/template-shadowroot": "^0.2.1",
"lit": "^2.8.0",
"preact": "^10.17.1",
"preact": "^10.19.2",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"solid-js": "^1.7.11",
"svelte": "^4.2.0",
"vue": "^3.3.4"
"solid-js": "^1.8.5",
"svelte": "^4.2.5",
"vue": "^3.3.8"
}
}

View file

@ -8,6 +8,6 @@
"astro": "workspace:*"
},
"dependencies": {
"preact": "^10.17.1"
"preact": "^10.19.2"
}
}

View file

@ -11,11 +11,11 @@
"astro": "workspace:*"
},
"dependencies": {
"preact": "^10.17.1",
"preact": "^10.19.2",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"solid-js": "^1.7.11",
"svelte": "^4.2.0",
"vue": "^3.3.4"
"solid-js": "^1.8.5",
"svelte": "^4.2.5",
"vue": "^3.3.8"
}
}

View file

@ -11,11 +11,11 @@
"astro": "workspace:*"
},
"dependencies": {
"preact": "^10.17.1",
"preact": "^10.19.2",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"solid-js": "^1.7.11",
"svelte": "^4.2.0",
"vue": "^3.3.4"
"solid-js": "^1.8.5",
"svelte": "^4.2.5",
"vue": "^3.3.8"
}
}

View file

@ -11,11 +11,11 @@
"astro": "workspace:*"
},
"dependencies": {
"preact": "^10.17.1",
"preact": "^10.19.2",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"solid-js": "^1.7.11",
"svelte": "^4.2.0",
"vue": "^3.3.4"
"solid-js": "^1.8.5",
"svelte": "^4.2.5",
"vue": "^3.3.8"
}
}

View file

@ -11,11 +11,11 @@
"astro": "workspace:*"
},
"dependencies": {
"preact": "^10.17.1",
"preact": "^10.19.2",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"solid-js": "^1.7.11",
"svelte": "^4.2.0",
"vue": "^3.3.4"
"solid-js": "^1.8.5",
"svelte": "^4.2.5",
"vue": "^3.3.8"
}
}

View file

@ -11,11 +11,11 @@
"astro": "workspace:*"
},
"dependencies": {
"preact": "^10.17.1",
"preact": "^10.19.2",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"solid-js": "^1.7.11",
"svelte": "^4.2.0",
"vue": "^3.3.4"
"solid-js": "^1.8.5",
"svelte": "^4.2.5",
"vue": "^3.3.8"
}
}

View file

@ -11,12 +11,12 @@
"astro": "workspace:*"
},
"dependencies": {
"preact": "^10.17.1",
"preact": "^10.19.2",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"solid-js": "^1.7.11",
"svelte": "^4.2.0",
"vue": "^3.3.4"
"solid-js": "^1.8.5",
"svelte": "^4.2.5",
"vue": "^3.3.8"
},
"scripts": {
"dev": "astro dev"

View file

@ -5,6 +5,6 @@
"dependencies": {
"@astrojs/preact": "workspace:*",
"astro": "workspace:*",
"preact": "^10.17.1"
"preact": "^10.19.2"
}
}

View file

@ -6,6 +6,6 @@
"@astrojs/mdx": "workspace:*",
"@astrojs/preact": "workspace:*",
"astro": "workspace:*",
"preact": "^10.17.1"
"preact": "^10.19.2"
}
}

View file

@ -2,5 +2,8 @@ import { defineConfig } from 'astro/config';
// https://astro.build/config
export default defineConfig({
devOverlay: {
enabled: false,
},
prefetch: true
});

View file

@ -7,6 +7,6 @@
"astro": "workspace:*"
},
"devDependencies": {
"solid-js": "^1.7.11"
"solid-js": "^1.8.5"
}
}

Some files were not shown because too many files have changed in this diff Show more