diff --git a/.changeset/beige-zebras-ring.md b/.changeset/beige-zebras-ring.md deleted file mode 100644 index f81f6aa6fcfe..000000000000 --- a/.changeset/beige-zebras-ring.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Add support for autocomplete attribute to the HTML button type. diff --git a/.changeset/blue-ladybugs-march.md b/.changeset/blue-ladybugs-march.md deleted file mode 100644 index 4394b6ad35e2..000000000000 --- a/.changeset/blue-ladybugs-march.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fixes duplicated CSS modules content when it's imported by both Astro files and framework components diff --git a/.changeset/chilly-tips-breathe.md b/.changeset/chilly-tips-breathe.md deleted file mode 100644 index 6e622f8264df..000000000000 --- a/.changeset/chilly-tips-breathe.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Export JSX namespace from `astro/jsx-runtime` for language tooling to consume diff --git a/.changeset/eight-ears-call.md b/.changeset/eight-ears-call.md deleted file mode 100644 index 41a9140a7a24..000000000000 --- a/.changeset/eight-ears-call.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@astrojs/preact': patch -'@astrojs/react': patch -'@astrojs/solid-js': patch ---- - -Improves compatability with the [Qwik adapter](https://github.com/QwikDev/astro) diff --git a/.changeset/forty-actors-wash.md b/.changeset/forty-actors-wash.md deleted file mode 100644 index 4a5d79d0a625..000000000000 --- a/.changeset/forty-actors-wash.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@astrojs/svelte': patch ---- - -Filter out Svelte's unknown data prop warnings diff --git a/.changeset/gold-zebras-burn.md b/.changeset/gold-zebras-burn.md deleted file mode 100644 index 8cb15a42beaf..000000000000 --- a/.changeset/gold-zebras-burn.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Improves error message for the case where two similarly named files result in the same content entry. diff --git a/.changeset/great-beans-check.md b/.changeset/great-beans-check.md new file mode 100644 index 000000000000..69e188bd0a79 --- /dev/null +++ b/.changeset/great-beans-check.md @@ -0,0 +1,5 @@ +--- +"astro": patch +--- + +Fixes error overlay display on URI malformed error diff --git a/.changeset/great-parrots-raise.md b/.changeset/great-parrots-raise.md deleted file mode 100644 index 8a78a298a937..000000000000 --- a/.changeset/great-parrots-raise.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@astrojs/svelte': patch ---- - -Forwards errors if a Svelte component fails to instantiate in the client diff --git a/.changeset/old-goats-occur.md b/.changeset/old-goats-occur.md deleted file mode 100644 index 8224bbabbd44..000000000000 --- a/.changeset/old-goats-occur.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Prevents unnecessary URI decoding when rendering a route diff --git a/.changeset/olive-sloths-brush.md b/.changeset/olive-sloths-brush.md new file mode 100644 index 000000000000..574af00902b0 --- /dev/null +++ b/.changeset/olive-sloths-brush.md @@ -0,0 +1,5 @@ +--- +'@astrojs/node': patch +--- + +Fixes a bug where an error while serving response stopped the server. diff --git a/.changeset/quiet-weeks-teach.md b/.changeset/quiet-weeks-teach.md new file mode 100644 index 000000000000..bfbbb737c168 --- /dev/null +++ b/.changeset/quiet-weeks-teach.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Prevents ANSI codes from rendering in the error overlay diff --git a/.changeset/rare-ants-swim.md b/.changeset/rare-ants-swim.md deleted file mode 100644 index 1bde7bf14258..000000000000 --- a/.changeset/rare-ants-swim.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Improves errors in certain places to also report their causes. diff --git a/.changeset/rude-deers-turn.md b/.changeset/rude-deers-turn.md deleted file mode 100644 index ee54f44163ee..000000000000 --- a/.changeset/rude-deers-turn.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@astrojs/tailwind': minor ---- - -Adds `nesting` option to enable `tailwindcss/nesting` support diff --git a/.changeset/shy-knives-unite.md b/.changeset/shy-knives-unite.md deleted file mode 100644 index 5aa3c87bfd00..000000000000 --- a/.changeset/shy-knives-unite.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Update Sharp version to ^0.33.1 diff --git a/.changeset/silent-wasps-learn.md b/.changeset/silent-wasps-learn.md new file mode 100644 index 000000000000..60f8d4c0efc9 --- /dev/null +++ b/.changeset/silent-wasps-learn.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Toggle dev toolbar hitbox height when toolbar is visible diff --git a/.changeset/small-emus-deny.md b/.changeset/small-emus-deny.md deleted file mode 100644 index 4926c0655c81..000000000000 --- a/.changeset/small-emus-deny.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"astro": patch ---- - -Prevents dev toolbar tooltip from overflowing outside of the screen diff --git a/.changeset/small-snakes-build.md b/.changeset/small-snakes-build.md new file mode 100644 index 000000000000..9f1c9f8ac0ec --- /dev/null +++ b/.changeset/small-snakes-build.md @@ -0,0 +1,5 @@ +--- +"astro": patch +--- + +Fixes remote images with encoded characters diff --git a/.changeset/soft-sheep-glow.md b/.changeset/soft-sheep-glow.md deleted file mode 100644 index 90b26828a350..000000000000 --- a/.changeset/soft-sheep-glow.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -'@astrojs/alpinejs': patch -'@astrojs/lit': patch -'@astrojs/markdoc': patch -'@astrojs/mdx': patch -'@astrojs/node': patch -'@astrojs/partytown': patch -'@astrojs/preact': patch -'@astrojs/react': patch -'@astrojs/sitemap': patch -'@astrojs/solid-js': patch -'@astrojs/svelte': patch -'@astrojs/tailwind': patch -'@astrojs/vercel': patch -'@astrojs/vue': patch ---- - -Updates README diff --git a/.changeset/tidy-dogs-remain.md b/.changeset/tidy-dogs-remain.md deleted file mode 100644 index aef030c9d05c..000000000000 --- a/.changeset/tidy-dogs-remain.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Adds a helpful warning message for when an exported API Route is not uppercase. diff --git a/.changeset/weak-oranges-relate.md b/.changeset/weak-oranges-relate.md new file mode 100644 index 000000000000..c61c4b7e05e8 --- /dev/null +++ b/.changeset/weak-oranges-relate.md @@ -0,0 +1,5 @@ +--- +"astro": patch +--- + +`` srcset now parses encoded paths correctly diff --git a/.changeset/yellow-yaks-promise.md b/.changeset/yellow-yaks-promise.md new file mode 100644 index 000000000000..2b9aa21ff90c --- /dev/null +++ b/.changeset/yellow-yaks-promise.md @@ -0,0 +1,5 @@ +--- +"@astrojs/vercel": patch +--- + +Fixes an issue where a build could not complete on Node 21. diff --git a/examples/basics/package.json b/examples/basics/package.json index e6e61c6d70e5..ff55e0d315af 100644 --- a/examples/basics/package.json +++ b/examples/basics/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.0.7" + "astro": "^4.0.8" } } diff --git a/examples/blog/package.json b/examples/blog/package.json index 32e32622640d..6e0bd7a2cf9e 100644 --- a/examples/blog/package.json +++ b/examples/blog/package.json @@ -11,9 +11,9 @@ "astro": "astro" }, "dependencies": { - "@astrojs/mdx": "^2.0.2", + "@astrojs/mdx": "^2.0.3", "@astrojs/rss": "^4.0.1", - "@astrojs/sitemap": "^3.0.3", - "astro": "^4.0.7" + "@astrojs/sitemap": "^3.0.4", + "astro": "^4.0.8" } } diff --git a/examples/component/package.json b/examples/component/package.json index 6b056cff0f4b..67ec5a3a801d 100644 --- a/examples/component/package.json +++ b/examples/component/package.json @@ -15,7 +15,7 @@ ], "scripts": {}, "devDependencies": { - "astro": "^4.0.7" + "astro": "^4.0.8" }, "peerDependencies": { "astro": "^3.0.0" diff --git a/examples/framework-alpine/package.json b/examples/framework-alpine/package.json index 8747cae30a6b..da02b10cec53 100644 --- a/examples/framework-alpine/package.json +++ b/examples/framework-alpine/package.json @@ -11,9 +11,9 @@ "astro": "astro" }, "dependencies": { - "@astrojs/alpinejs": "^0.3.1", + "@astrojs/alpinejs": "^0.3.2", "@types/alpinejs": "^3.13.5", "alpinejs": "^3.13.3", - "astro": "^4.0.7" + "astro": "^4.0.8" } } diff --git a/examples/framework-lit/package.json b/examples/framework-lit/package.json index 483b3209dda0..a12879c13052 100644 --- a/examples/framework-lit/package.json +++ b/examples/framework-lit/package.json @@ -11,9 +11,9 @@ "astro": "astro" }, "dependencies": { - "@astrojs/lit": "^4.0.0", + "@astrojs/lit": "^4.0.1", "@webcomponents/template-shadowroot": "^0.2.1", - "astro": "^4.0.7", + "astro": "^4.0.8", "lit": "^2.8.0" } } diff --git a/examples/framework-multiple/package.json b/examples/framework-multiple/package.json index 725a8252b349..235c0015ef11 100644 --- a/examples/framework-multiple/package.json +++ b/examples/framework-multiple/package.json @@ -11,12 +11,12 @@ "astro": "astro" }, "dependencies": { - "@astrojs/preact": "^3.0.1", - "@astrojs/react": "^3.0.8", - "@astrojs/solid-js": "^3.0.2", - "@astrojs/svelte": "^5.0.2", - "@astrojs/vue": "^4.0.5", - "astro": "^4.0.7", + "@astrojs/preact": "^3.0.2", + "@astrojs/react": "^3.0.9", + "@astrojs/solid-js": "^3.0.3", + "@astrojs/svelte": "^5.0.3", + "@astrojs/vue": "^4.0.6", + "astro": "^4.0.8", "preact": "^10.19.2", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/examples/framework-preact/package.json b/examples/framework-preact/package.json index d767c0b5fdd1..182488e94ae6 100644 --- a/examples/framework-preact/package.json +++ b/examples/framework-preact/package.json @@ -11,9 +11,9 @@ "astro": "astro" }, "dependencies": { - "@astrojs/preact": "^3.0.1", + "@astrojs/preact": "^3.0.2", "@preact/signals": "^1.2.1", - "astro": "^4.0.7", + "astro": "^4.0.8", "preact": "^10.19.2" } } diff --git a/examples/framework-react/package.json b/examples/framework-react/package.json index bf1e2ee34d23..c82665504727 100644 --- a/examples/framework-react/package.json +++ b/examples/framework-react/package.json @@ -11,10 +11,10 @@ "astro": "astro" }, "dependencies": { - "@astrojs/react": "^3.0.8", + "@astrojs/react": "^3.0.9", "@types/react": "^18.2.37", "@types/react-dom": "^18.2.15", - "astro": "^4.0.7", + "astro": "^4.0.8", "react": "^18.2.0", "react-dom": "^18.2.0" } diff --git a/examples/framework-solid/package.json b/examples/framework-solid/package.json index a283d3f78473..a872508abefa 100644 --- a/examples/framework-solid/package.json +++ b/examples/framework-solid/package.json @@ -11,8 +11,8 @@ "astro": "astro" }, "dependencies": { - "@astrojs/solid-js": "^3.0.2", - "astro": "^4.0.7", + "@astrojs/solid-js": "^3.0.3", + "astro": "^4.0.8", "solid-js": "^1.8.5" } } diff --git a/examples/framework-svelte/package.json b/examples/framework-svelte/package.json index e14692cf3a60..86e67d122441 100644 --- a/examples/framework-svelte/package.json +++ b/examples/framework-svelte/package.json @@ -11,8 +11,8 @@ "astro": "astro" }, "dependencies": { - "@astrojs/svelte": "^5.0.2", - "astro": "^4.0.7", + "@astrojs/svelte": "^5.0.3", + "astro": "^4.0.8", "svelte": "^4.2.5" } } diff --git a/examples/framework-vue/package.json b/examples/framework-vue/package.json index 851ac283bc0e..29ad35c9275e 100644 --- a/examples/framework-vue/package.json +++ b/examples/framework-vue/package.json @@ -11,8 +11,8 @@ "astro": "astro" }, "dependencies": { - "@astrojs/vue": "^4.0.5", - "astro": "^4.0.7", + "@astrojs/vue": "^4.0.6", + "astro": "^4.0.8", "vue": "^3.3.8" } } diff --git a/examples/hackernews/package.json b/examples/hackernews/package.json index 1a7646ac8b66..b10f2aaeba20 100644 --- a/examples/hackernews/package.json +++ b/examples/hackernews/package.json @@ -11,7 +11,7 @@ "astro": "astro" }, "dependencies": { - "@astrojs/node": "^7.0.2", - "astro": "^4.0.7" + "@astrojs/node": "^7.0.3", + "astro": "^4.0.8" } } diff --git a/examples/integration/index.ts b/examples/integration/index.ts index 54d917e78e9f..8b34afd2334a 100644 --- a/examples/integration/index.ts +++ b/examples/integration/index.ts @@ -10,11 +10,11 @@ export default function createIntegration(): AstroIntegration { // See the @astrojs/react integration for an example // https://github.com/withastro/astro/blob/main/packages/integrations/react/src/index.ts }, - 'astro:build:setup': ({ pages, updateConfig }) => { + 'astro:build:setup': () => { // See the @astrojs/lit integration for an example // https://github.com/withastro/astro/blob/main/packages/integrations/lit/src/index.ts }, - 'astro:build:done': ({ dir, routes }) => { + 'astro:build:done': () => { // See the @astrojs/partytown integration for an example // https://github.com/withastro/astro/blob/main/packages/integrations/partytown/src/index.ts }, diff --git a/examples/integration/package.json b/examples/integration/package.json index e59c8e1ef9d0..cac406ddca81 100644 --- a/examples/integration/package.json +++ b/examples/integration/package.json @@ -15,7 +15,7 @@ ], "scripts": {}, "devDependencies": { - "astro": "^4.0.7" + "astro": "^4.0.8" }, "peerDependencies": { "astro": "^3.0.0" diff --git a/examples/middleware/package.json b/examples/middleware/package.json index fdea138649af..69424f74c935 100644 --- a/examples/middleware/package.json +++ b/examples/middleware/package.json @@ -12,8 +12,11 @@ "server": "node dist/server/entry.mjs" }, "dependencies": { - "@astrojs/node": "^7.0.2", - "astro": "^4.0.7", + "@astrojs/node": "^7.0.3", + "astro": "^4.0.8", "html-minifier": "^4.0.0" + }, + "devDependencies": { + "@types/html-minifier": "^4.0.5" } } diff --git a/examples/middleware/src/middleware.ts b/examples/middleware/src/middleware.ts index eb764453545c..f92b64d4404a 100644 --- a/examples/middleware/src/middleware.ts +++ b/examples/middleware/src/middleware.ts @@ -3,12 +3,15 @@ import htmlMinifier from 'html-minifier'; const limit = 50; -const loginInfo = { +const loginInfo: { + token: undefined | string; + currentTime: undefined | number; +} = { token: undefined, currentTime: undefined, }; -export const minifier = defineMiddleware(async (context, next) => { +export const minifier = defineMiddleware(async (_context, next) => { const response = await next(); // check if the response is returning some HTML if (response.headers.get('content-type') === 'text/html') { diff --git a/examples/minimal/package.json b/examples/minimal/package.json index 768f60a0952e..860897d1bf8b 100644 --- a/examples/minimal/package.json +++ b/examples/minimal/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.0.7" + "astro": "^4.0.8" } } diff --git a/examples/non-html-pages/package.json b/examples/non-html-pages/package.json index e77e7bfc319d..2a1c4d61a8e4 100644 --- a/examples/non-html-pages/package.json +++ b/examples/non-html-pages/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.0.7" + "astro": "^4.0.8" } } diff --git a/examples/portfolio/package.json b/examples/portfolio/package.json index 124a9f059baa..3332fc3a332e 100644 --- a/examples/portfolio/package.json +++ b/examples/portfolio/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.0.7" + "astro": "^4.0.8" } } diff --git a/examples/ssr/package.json b/examples/ssr/package.json index 30d9218dda55..7ed70e2bf89d 100644 --- a/examples/ssr/package.json +++ b/examples/ssr/package.json @@ -12,9 +12,9 @@ "server": "node dist/server/entry.mjs" }, "dependencies": { - "@astrojs/node": "^7.0.2", - "@astrojs/svelte": "^5.0.2", - "astro": "^4.0.7", + "@astrojs/node": "^7.0.3", + "@astrojs/svelte": "^5.0.3", + "astro": "^4.0.8", "svelte": "^4.2.5" } } diff --git a/examples/ssr/src/api.ts b/examples/ssr/src/api.ts index 1be1f54f00ec..ec4ba9eec76d 100644 --- a/examples/ssr/src/api.ts +++ b/examples/ssr/src/api.ts @@ -32,7 +32,7 @@ async function get( }); if (!response.ok) { // TODO make this better... - return null; + throw new Error('Fetch failed'); } return cb(response); } diff --git a/examples/ssr/src/pages/api/cart.ts b/examples/ssr/src/pages/api/cart.ts index 2449e0c945b5..8d64ec7d84de 100644 --- a/examples/ssr/src/pages/api/cart.ts +++ b/examples/ssr/src/pages/api/cart.ts @@ -1,4 +1,4 @@ -import { APIContext } from 'astro'; +import type { APIContext } from 'astro'; import { userCartItems } from '../../models/session'; export function GET({ cookies }: APIContext) { @@ -21,7 +21,7 @@ interface AddToCartItem { export async function POST({ cookies, request }: APIContext) { const item: AddToCartItem = await request.json(); - let userId = cookies.get('user-id').value; + let userId = cookies.get('user-id')?.value; if (!userCartItems.has(userId)) { userCartItems.set(userId, new Map()); diff --git a/examples/ssr/src/pages/login.form.async.ts b/examples/ssr/src/pages/login.form.async.ts index 22c1022ed57c..94020d9c9b11 100644 --- a/examples/ssr/src/pages/login.form.async.ts +++ b/examples/ssr/src/pages/login.form.async.ts @@ -1,4 +1,4 @@ -import { APIContext, APIRoute } from 'astro'; +import type { APIContext, APIRoute } from 'astro'; export const POST: APIRoute = ({ cookies }: APIContext) => { // add a new cookie diff --git a/examples/ssr/src/pages/login.form.ts b/examples/ssr/src/pages/login.form.ts index 54ec10f471e7..f3cd50db46c4 100644 --- a/examples/ssr/src/pages/login.form.ts +++ b/examples/ssr/src/pages/login.form.ts @@ -1,4 +1,4 @@ -import { APIContext } from 'astro'; +import type { APIContext } from 'astro'; export function POST({ cookies }: APIContext) { // add a new cookie diff --git a/examples/starlog/README.md b/examples/starlog/README.md new file mode 100644 index 000000000000..da5cb142c056 --- /dev/null +++ b/examples/starlog/README.md @@ -0,0 +1,7 @@ +# Starlog + +## Release notes theme for Astro + +![starlog-gh](https://github.com/doodlemarks/starlog/assets/2244813/9c5c2e46-665a-437e-a971-053db4dbff63) + +Built with Astro and Sass. Supports both dark and light modes. diff --git a/examples/starlog/astro.config.mjs b/examples/starlog/astro.config.mjs new file mode 100644 index 000000000000..b093ec0e02bc --- /dev/null +++ b/examples/starlog/astro.config.mjs @@ -0,0 +1,6 @@ +import { defineConfig } from 'astro/config'; + +// https://astro.build/config +export default defineConfig({ + site: 'https://example.com', +}); diff --git a/examples/starlog/package.json b/examples/starlog/package.json new file mode 100644 index 000000000000..8975eaa5cd03 --- /dev/null +++ b/examples/starlog/package.json @@ -0,0 +1,17 @@ +{ + "name": "@example/starlog", + "type": "module", + "version": "0.0.1", + "scripts": { + "dev": "astro dev", + "start": "astro dev", + "build": "astro build", + "preview": "astro preview", + "astro": "astro" + }, + "dependencies": { + "astro": "^4.0.5", + "sass": "^1.69.5", + "sharp": "^0.32.5" + } +} diff --git a/examples/starlog/public/favicon.svg b/examples/starlog/public/favicon.svg new file mode 100644 index 000000000000..f157bd1c5e28 --- /dev/null +++ b/examples/starlog/public/favicon.svg @@ -0,0 +1,9 @@ + + + + diff --git a/examples/starlog/src/assets/starlog-placeholder-1.jpg b/examples/starlog/src/assets/starlog-placeholder-1.jpg new file mode 100644 index 000000000000..846bdcd45285 Binary files /dev/null and b/examples/starlog/src/assets/starlog-placeholder-1.jpg differ diff --git a/examples/starlog/src/assets/starlog-placeholder-14.jpg b/examples/starlog/src/assets/starlog-placeholder-14.jpg new file mode 100644 index 000000000000..e2e0acb9eff3 Binary files /dev/null and b/examples/starlog/src/assets/starlog-placeholder-14.jpg differ diff --git a/examples/starlog/src/assets/starlog-placeholder-18.jpg b/examples/starlog/src/assets/starlog-placeholder-18.jpg new file mode 100644 index 000000000000..211c85cf54ad Binary files /dev/null and b/examples/starlog/src/assets/starlog-placeholder-18.jpg differ diff --git a/examples/starlog/src/assets/starlog-placeholder-2.jpg b/examples/starlog/src/assets/starlog-placeholder-2.jpg new file mode 100644 index 000000000000..2251c1c49d2f Binary files /dev/null and b/examples/starlog/src/assets/starlog-placeholder-2.jpg differ diff --git a/examples/starlog/src/components/BaseHead.astro b/examples/starlog/src/components/BaseHead.astro new file mode 100644 index 000000000000..e32945c1c8f5 --- /dev/null +++ b/examples/starlog/src/components/BaseHead.astro @@ -0,0 +1,19 @@ +--- +import { ViewTransitions } from 'astro:transitions'; +import SEO, { type Props as SEOProps } from './SEO.astro'; +import { SiteTitle, SiteDescription } from '../consts'; + +export type Props = Partial; +const { title = SiteTitle, name = SiteTitle, description = SiteDescription, ...seo } = Astro.props; +--- + + + + + + + + diff --git a/examples/starlog/src/components/Footer.astro b/examples/starlog/src/components/Footer.astro new file mode 100644 index 000000000000..276550d4ae2c --- /dev/null +++ b/examples/starlog/src/components/Footer.astro @@ -0,0 +1,12 @@ +--- +import '../styles/global.scss'; +--- + + diff --git a/examples/starlog/src/components/FormattedDate.astro b/examples/starlog/src/components/FormattedDate.astro new file mode 100644 index 000000000000..377286d9f421 --- /dev/null +++ b/examples/starlog/src/components/FormattedDate.astro @@ -0,0 +1,25 @@ +--- +import type { HTMLAttributes } from 'astro/types'; + +type Props = HTMLAttributes<'time'> & { + date: Date; +}; + +const { date, ...attrs } = Astro.props; +--- + + + { + date.toLocaleDateString('en-us', { + year: 'numeric', + month: 'short', + day: 'numeric', + }) + } + + + diff --git a/examples/starlog/src/components/Header.astro b/examples/starlog/src/components/Header.astro new file mode 100644 index 000000000000..bbdaf1e70c10 --- /dev/null +++ b/examples/starlog/src/components/Header.astro @@ -0,0 +1,54 @@ +--- +import '../styles/global.scss'; +import { SiteTitle } from '../consts'; +--- + + + + + + + {SiteTitle} + + + + Contact + + + + + diff --git a/examples/starlog/src/components/SEO.astro b/examples/starlog/src/components/SEO.astro new file mode 100644 index 000000000000..1e2ddcca2777 --- /dev/null +++ b/examples/starlog/src/components/SEO.astro @@ -0,0 +1,87 @@ +--- +import type { ImageMetadata } from 'astro'; +type Image = { + src: string | ImageMetadata; + alt: string; +}; + +type SEOMetadata = { + name: string; + title: string; + description: string; + image?: Image | undefined; + canonicalURL?: URL | string | undefined; + locale?: string; +}; + +type OpenGraph = Partial & { + type?: string; +}; + +type Twitter = Partial & { + handle?: string; + card?: 'summary' | 'summary_large_image'; +}; + +export type Props = SEOMetadata & { + og?: OpenGraph; + twitter?: Twitter; +}; + +const { + name, + title, + description, + image, + locale = 'en', + canonicalURL = new URL(Astro.url.pathname, Astro.site), +} = Astro.props; + +const og = { + name, + title, + description, + canonicalURL, + image, + locale, + type: 'website', + ...(Astro.props.og ?? {}), +} satisfies OpenGraph; + +const twitter = { + name, + title, + description, + canonicalURL, + image, + locale, + card: 'summary_large_image', + ...Astro.props.twitter, +}; + +function normalizeImageUrl(image: string | ImageMetadata) { + return typeof image === 'string' ? image : image.src; +} +--- + + + + + + + + + + + + +{og.image && } +{og.image && } + + + + + + +{twitter.image && } +{twitter.image && } diff --git a/examples/starlog/src/consts.ts b/examples/starlog/src/consts.ts new file mode 100644 index 000000000000..3e91752e1783 --- /dev/null +++ b/examples/starlog/src/consts.ts @@ -0,0 +1,5 @@ +// Place any global data in this file. +// You can import this data from anywhere in your site by using the `import` keyword. + +export const SiteTitle = 'Starlog'; +export const SiteDescription = 'Welcome to my website!'; diff --git a/examples/starlog/src/content/config.ts b/examples/starlog/src/content/config.ts new file mode 100644 index 000000000000..5cc4c697f7e4 --- /dev/null +++ b/examples/starlog/src/content/config.ts @@ -0,0 +1,19 @@ +import { defineCollection, z } from 'astro:content'; + +const releases = defineCollection({ + // Type-check frontmatter using a schema + schema: ({ image }) => + z.object({ + title: z.string(), + description: z.string(), + versionNumber: z.string(), + image: z.object({ + src: image(), + alt: z.string(), + }), + // Transform string to Date object + date: z.date({ coerce: true }), + }), +}); + +export const collections = { releases }; diff --git a/examples/starlog/src/content/releases/1_0.md b/examples/starlog/src/content/releases/1_0.md new file mode 100644 index 000000000000..a5eeff43724a --- /dev/null +++ b/examples/starlog/src/content/releases/1_0.md @@ -0,0 +1,29 @@ +--- +title: 'Introducing Nebulous 1.0!' +date: '2022-03-21' +versionNumber: '1.0' +description: 'This is the first post of my new Astro blog.' +image: + src: '../../assets/starlog-placeholder-1.jpg' + alt: 'The full Astro logo.' +--- + +## A New World with 1.0 + +![Nebulous 2.0 Release](../../assets/starlog-placeholder-1.jpg) + +Hey there, Nebulous users! We're back with some exciting updates that will turbocharge your Nebulous experience. Here's the lowdown: + +### ๐ฟ New Features & Enhancements + +- **NebulaProtect Supercharged:** Enjoy beefed-up security and real-time monitoring to keep your digital fortress unbreachable. +- **NebulaConnect for Teams:** Collaboration is a breeze with integrated project management tools. +- **Speed Boost Galore:** We've fine-tuned Nebulous for ultimate speed and responsiveness. + +### ๐ Bug Fixes + +- Kicked pesky crashes out the door for NebulaSync. +- Fixed rare data hiccups during file transfers. +- Nebulous is now even friendly with older devices. + +Thank you for making Nebulous your tech partner. We thrive on your feedback, so if you have ideas or run into bumps, don't hesitate to drop a line to our support wizards. Together, we're taking Nebulous to the next level! diff --git a/examples/starlog/src/content/releases/1_4.md b/examples/starlog/src/content/releases/1_4.md new file mode 100644 index 000000000000..aacab8a847af --- /dev/null +++ b/examples/starlog/src/content/releases/1_4.md @@ -0,0 +1,29 @@ +--- +title: 'Introducing Nebulous 1.8!' +date: '2022-04-16' +versionNumber: '1.4' +description: 'This is the first post of my new Astro blog.' +image: + src: '../../assets/starlog-placeholder-14.jpg' + alt: 'The full Astro logo.' +--- + +## Go further with 1.4 + +![Nebulous 1.4 Release](../../assets/starlog-placeholder-14.jpg) + +Hello, Nebulous enthusiasts! It's that time againโtime for us to unveil the latest and greatest in our tech universe. Buckle up as we introduce you to the future of Nebulous: + +### ๐ฟ New Features & Enhancements + +- **NebulaSync Quantum:** Prepare for a mind-blowing file syncing experience. It's faster, smarter, and more intuitive than ever before. +- **NebulaAI Odyssey:** Welcome to the era of NebulaAI Odysseyโa journey into the boundless possibilities of artificial intelligence. From image manipulation to language translation, Odyssey empowers you like never before. + +### ๐ Bug Fixes + +- Squashed even more bugs, making NebulaSync and other features more reliable than ever. +- Streamlined data transfer processes for flawless file exchanges. +- Extended support for older devices to ensure everyone enjoys Nebulous. +- Elevating error handling to the next level, ensuring a hiccup-free experience. + +Thank you for being a part of the Nebulous journey. Your feedback fuels our innovation, so don't hesitate to share your thoughts or report any hiccups with our dedicated support team. Together, we're shaping the future of tech with Nebulous! diff --git a/examples/starlog/src/content/releases/1_8.md b/examples/starlog/src/content/releases/1_8.md new file mode 100644 index 000000000000..d300f964c413 --- /dev/null +++ b/examples/starlog/src/content/releases/1_8.md @@ -0,0 +1,29 @@ +--- +title: 'Introducing Nebulous 1.8!' +date: '2022-06-01' +versionNumber: '1.8' +description: 'This is the first post of my new Astro blog.' +image: + src: '../../assets/starlog-placeholder-18.jpg' + alt: 'The full Astro logo.' +--- + +## Faster, Stronger, Betterer + +![Nebulous 2.0 Release](../../assets/starlog-placeholder-18.jpg) + +Hey there, Nebulous users! We're back with some exciting updates that will turbocharge your Nebulous experience. Here's the lowdown: + +### New Features & Enhancements + +- **NebulaProtect Supercharged:** Enjoy beefed-up security and real-time monitoring to keep your digital fortress unbreachable. +- **NebulaConnect for Teams:** Collaboration is a breeze with integrated project management tools. +- **Speed Boost Galore:** We've fine-tuned Nebulous for ultimate speed and responsiveness. + +### ๐ Bug Fixes + +- Kicked pesky crashes out the door for NebulaSync. +- Fixed rare data hiccups during file transfers. +- Nebulous is now even friendly with older devices. + +Thank you for making Nebulous your tech partner. We thrive on your feedback, so if you have ideas or run into bumps, don't hesitate to drop a line to our support wizards. Together, we're taking Nebulous to the next level! diff --git a/examples/starlog/src/content/releases/2_0.md b/examples/starlog/src/content/releases/2_0.md new file mode 100644 index 000000000000..6a01d76fc88b --- /dev/null +++ b/examples/starlog/src/content/releases/2_0.md @@ -0,0 +1,38 @@ +--- +title: 'Introducing Nebulous 2.0!' +date: '2022-07-01' +versionNumber: '2.0' +description: 'This is the first post of my new Astro blog.' +image: + src: '../../assets/starlog-placeholder-2.jpg' + alt: 'The full Astro logo.' +--- + +## Introducing Nebulous 2.0! + +![Nebulous 2.0 Release](../../assets/starlog-placeholder-2.jpg) + +Greetings, Nebulous users! We're excited to bring you the latest updates in our [ever-evolving tech ecosystem](#). In this release, we're introducing some exciting new features and squashing a few pesky bugs. Let's dive in! + +### ๐ฟ New Features & Enhancements + +- **NebulaSync v2.0:** We're thrilled to introduce NebulaSync 2.0, our revamped file synchronization tool. It now offers blazing-fast sync speeds, improved reliability, and enhanced cross-device compatibility. +- **Enhanced NebulaProtect:** NebulaProtect, our comprehensive security suite, has received a major update. Enjoy advanced threat detection, and real-time monitoring. +- **NebulaConnect for Teams:** Collaborate effortlessly with NebulaConnect for Teams. This powerful feature allows seamless integration with your favorite project management tools, enabling you to manage tasks, share documents, and track progress in real-time. + +### ๐ Bug Fixes + +- Resolved occasional crashing issues when using NebulaSync. +- Fixed a bug causing data corruption in rare cases during file transfers. +- Improved compatibility with older devices to ensure a seamless experience for all users. +- Enhanced error handling and reporting for a smoother user experience. + +### ๐ Coming Soon + +We can't spill all the beans just yet, but we're thrilled to give you a sneak peek of what's coming in the next Nebulous release: + +- **NebulaWallet:** A secure and user-friendly cryptocurrency wallet integrated directly into Nebulous for seamless digital asset management. +- **NebulaConnect Mobile:** Take your collaboration to the next level with our upcoming mobile app, enabling you to work on the go. +- **NebulaLabs:** Our developer tools and API enhancements, providing you with even more customization options and possibilities. + +If you have any suggestions or encounter any issues, don't hesitate to reach out to our support team. Together, we'll continue to make Nebulous the ultimate tech solution for you. diff --git a/examples/starlog/src/layouts/IndexLayout.astro b/examples/starlog/src/layouts/IndexLayout.astro new file mode 100644 index 000000000000..3f0bd0c96357 --- /dev/null +++ b/examples/starlog/src/layouts/IndexLayout.astro @@ -0,0 +1,23 @@ +--- +import BaseHead, { type Props as HeadProps } from '../components/BaseHead.astro'; +import Header from '../components/Header.astro'; +import Footer from '../components/Footer.astro'; + +type Props = HeadProps; + +const { ...head } = Astro.props; +--- + + + + + + + + + + + + + + diff --git a/examples/starlog/src/layouts/PostLayout.astro b/examples/starlog/src/layouts/PostLayout.astro new file mode 100644 index 000000000000..9c87a7b883c9 --- /dev/null +++ b/examples/starlog/src/layouts/PostLayout.astro @@ -0,0 +1,39 @@ +--- +import type { CollectionEntry } from 'astro:content'; +import BaseHead from '../components/BaseHead.astro'; +import FormattedDate from '../components/FormattedDate.astro'; +import Header from '../components/Header.astro'; +import Footer from '../components/Footer.astro'; + +type Props = { + release: CollectionEntry<'releases'>; +}; + +const { release } = Astro.props; +--- + + + + + + + + + + + + {release.data.versionNumber} + + + + + + + + + + diff --git a/examples/starlog/src/pages/index.astro b/examples/starlog/src/pages/index.astro new file mode 100644 index 000000000000..b7e6ea0f5c73 --- /dev/null +++ b/examples/starlog/src/pages/index.astro @@ -0,0 +1,36 @@ +--- +import { getCollection } from 'astro:content'; +import FormattedDate from '../components/FormattedDate.astro'; +import Layout from '../layouts/IndexLayout.astro'; + +const posts = await getCollection('releases'); +posts.sort((a, b) => +b.data.date - +a.data.date); +--- + + + + Changelog + + + { + posts.map((post) => ( + + + + + {post.data.versionNumber} + + + + + + {post.render().then(({ Content }) => ( + + ))} + + + )) + } + + + diff --git a/examples/starlog/src/pages/releases/[slug].astro b/examples/starlog/src/pages/releases/[slug].astro new file mode 100644 index 000000000000..88fa74d3caea --- /dev/null +++ b/examples/starlog/src/pages/releases/[slug].astro @@ -0,0 +1,21 @@ +--- +import { getCollection } from 'astro:content'; +import Layout from '../../layouts/PostLayout.astro'; + +export async function getStaticPaths() { + const releases = await getCollection('releases'); + + return releases.map((release) => ({ + params: { slug: release.slug }, + props: { release }, + })); +} + +const { release } = Astro.props; + +const { Content } = await release.render(); +--- + + + + diff --git a/examples/starlog/src/styles/colors.scss b/examples/starlog/src/styles/colors.scss new file mode 100644 index 000000000000..151abb0ed46b --- /dev/null +++ b/examples/starlog/src/styles/colors.scss @@ -0,0 +1,61 @@ +@function color($color, $tone) { + // @warn map-get($palette,$color); + + @if map-has-key($palette, $color) { + $color: map-get($palette, $color); + + @if map-has-key($color, $tone) { + $tone: map-get($color, $tone); + @return $tone; + } + + @warn "unknown tone `#{$tone}` in color"; + @return null; + } + + @warn "unknown color `#{$color}` in palette"; + @return null; +} + +$white: #ffffff; +$palette: ( + purple: ( + 50: #f2e8fd, + 100: #e6d1fa, + 200: #cfa3f5, + 300: #ba75f0, + 400: #a846ec, + 500: #9818e7, + 600: #7b13b4, + 700: #5b0e81, + 800: #3a084e, + 900: #15031c, + 950: #020002, + ), + orange: ( + 50: #fbf0ea, + 100: #f8e3d9, + 200: #f2cab7, + 300: #ecb194, + 400: #e59872, + 500: #df7f4f, + 600: #d05f26, + 700: #a1491d, + 800: #713315, + 900: #421e0c, + 950: #2a1308, + ), + gray: ( + 50: #f6f6f9, + 100: #e6e7ef, + 200: #c7c9db, + 300: #a8abc7, + 400: #898eb4, + 500: #6a71a0, + 600: #545b83, + 700: #404664, + 800: #2c3145, + 900: #181b26, + 950: #0e1016, + ), +); diff --git a/examples/starlog/src/styles/global.scss b/examples/starlog/src/styles/global.scss new file mode 100644 index 000000000000..fd08233799ec --- /dev/null +++ b/examples/starlog/src/styles/global.scss @@ -0,0 +1,3 @@ +@import 'colors.scss'; +@import 'type.scss'; +@import 'layout.scss'; diff --git a/examples/starlog/src/styles/layout.scss b/examples/starlog/src/styles/layout.scss new file mode 100644 index 000000000000..f36c223a51b7 --- /dev/null +++ b/examples/starlog/src/styles/layout.scss @@ -0,0 +1,291 @@ +$container: 1040px; +$tablet: 768px; +$mobile: 420px; + +* { + box-sizing: border-box; +} + +body { + margin: 0 auto; + padding: 0 1em; + width: 1040px; + max-width: 100%; + background-color: $white; + @media (prefers-color-scheme: dark) { + background-color: color(gray, 950); + } + @media (max-width: $tablet) { + font-size: 16px; + } +} + +.glow { + width: 100%; + height: 100%; + position: absolute; + z-index: -1; + top: 0; + left: 0; + overflow: hidden; + + &:after { + content: ''; + display: block; + position: absolute; + top: -120px; + left: calc(50% - 360px); + width: 720px; + height: 240px; + background: radial-gradient( + 50% 50% at 50% 50%, + rgba(color(orange, 500), 0.2) 0%, + rgba(color(orange, 500), 0) 100% + ); + @media (prefers-color-scheme: dark) { + background: radial-gradient( + 50% 50% at 50% 50%, + rgba(255, 255, 255, 0.06) 0%, + rgba(255, 255, 255, 0) 100% + ); + } + } +} + +::selection { + background: color(orange, 200); + @media (prefers-color-scheme: dark) { + background: color(orange, 600); + } +} + +a, +a:visited { + color: color(orange, 600); + @media (prefers-color-scheme: dark) { + color: color(orange, 300); + } + transition: 0.1s ease; + + &:hover { + color: color(orange, 500); + } +} + +hr { + margin: 1em 0; + border: 0; + border-bottom: 1px solid color(gray, 100); + @media (prefers-color-scheme: dark) { + border-color: color(gray, 900); + } +} + +nav { + display: flex; + align-items: center; + justify-content: space-between; + margin: 0 0 2em 0; + padding: 2em 0; + + a { + transition: 0.1s ease; + &:hover { + opacity: 0.6; + } + } + + #site_title { + margin: 0; + } + #site_title a { + display: flex; + align-items: center; + gap: 10px; + color: color(gray, 950); + @media (prefers-color-scheme: dark) { + color: $white; + } + font-size: 16px; + font-weight: 700; + letter-spacing: 2px; + line-height: 1; + text-decoration: none; + text-transform: uppercase; + } + .links a { + margin-left: 1em; + color: color(gray, 800); + @media (prefers-color-scheme: dark) { + color: color(gray, 200); + } + } +} + +.content { + ol, + ul { + padding-left: 2em; + margin-bottom: 1em; + } + + ul { + list-style: none; + + li { + position: relative; + margin-bottom: 0.75em; + + &:before { + content: ''; + display: block; + position: absolute; + left: -1em; + top: 0.63em; + width: 8px; + height: 8px; + background: linear-gradient(25deg, color(purple, 500), color(orange, 500)); + border-radius: 99px; + } + } + } +} + +.page_title { + margin: 1.5em 0; + @media (max-width: $tablet) { + margin: 0.5em 0; + } +} + +.posts { + list-style: none; + padding: 0; +} + +.post { + display: flex; + width: 100%; + @media (max-width: $tablet) { + flex-flow: column; + } + + &:last-child .content, + &.single .content { + border-bottom: 0; + } +} + +.version_wrapper { + flex-basis: 260px; + @media (max-width: $container) { + flex-basis: 140px; + } + flex-grow: 0; + flex-shrink: 0; + margin: 4.5em 0 0 0; + @media (max-width: $tablet) { + flex-basis: 0; + margin-top: 2em; + } + + .version_info { + position: sticky; + top: 1em; + @media (max-width: $tablet) { + position: relative; + top: 0; + } + } + + a { + float: left; + color: $white; + text-decoration: none; + transition: 0.1s ease; + + &:hover { + opacity: 0.6; + } + } +} + +.version_number { + display: inline-block; + font-family: $codeFont; + line-height: 1; + margin-bottom: 8px; + padding: 4px 12px; + color: $white; + background: linear-gradient( + 25deg, + color(purple, 800), + color(purple, 700), + mix(color(purple, 500), color(orange, 500)), + color(orange, 500) + ); + border-radius: 8px; +} + +.date { + clear: both; + @media (max-width: $tablet) { + display: inline; + margin-left: 1em; + } + color: color(gray, 800); + @media (prefers-color-scheme: dark) { + color: color(gray, 200); + } + font-family: $codeFont; + font-size: $fontSizeSmall; +} + +.content { + margin: 0; + padding: 4em 0; + @media (max-width: $tablet) { + margin: 1em 0; + padding: 0 0 2em 0; + } + border-bottom: 1px solid color(gray, 100); + @media (prefers-color-scheme: dark) { + border-color: color(gray, 900); + } + *:first-child { + margin-top: 0; + } + img { + max-width: 100%; + height: auto; + border-radius: 12px; + border: 1px solid color(gray, 200); + @media (prefers-color-scheme: dark) { + border-color: color(gray, 800); + } + } +} + +footer { + display: flex; + padding: 2em 0; + @media (max-width: $tablet) { + padding: 1em 0; + } + color: color(gray, 500); + justify-content: space-between; + border-top: 1px solid color(gray, 100); + @media (prefers-color-scheme: dark) { + border-color: color(gray, 900); + } + + a { + margin-left: 1em; + color: color(gray, 500); + text-decoration: none; + &:hover { + color: color(gray, 500); + opacity: 0.6; + } + } +} diff --git a/examples/starlog/src/styles/type.scss b/examples/starlog/src/styles/type.scss new file mode 100644 index 000000000000..388a71c89550 --- /dev/null +++ b/examples/starlog/src/styles/type.scss @@ -0,0 +1,65 @@ +$baseFont: 'Lato', sans-serif; +$codeFont: 'Source Code Pro', monospace; +$fontSizeSmall: 15px; + +body { + font-family: $baseFont; + font-size: 18px; + line-height: 1.65; + font-weight: 400; + @media (prefers-color-scheme: dark) { + color: color(gray, 200); + } + color: color(gray, 800); + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + text-rendering: optimizeLegibility; +} + +h1, +h2, +h3, +h4, +h5 { + line-height: 1.2; + margin: 1em 0 0.5em 0; + @media (prefers-color-scheme: dark) { + color: $white; + } + color: color(gray, 950); + font-weight: 700; +} + +h1 { + font-size: 3.052em; +} +h2 { + font-size: 2.441em; +} +h3 { + font-size: 1.953em; +} +h4 { + font-size: 1.563em; +} +h5 { + font-size: 1.25em; +} + +p { + margin: 0 0 1em 0; +} + +code { + font-family: $codeFont; +} + +b, +strong { + font-weight: 700; + color: #fff; + @media (prefers-color-scheme: dark) { + color: $white; + } + color: color(gray, 950); +} diff --git a/examples/starlog/tsconfig.json b/examples/starlog/tsconfig.json new file mode 100644 index 000000000000..da42df94e013 --- /dev/null +++ b/examples/starlog/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "astro/tsconfigs/strict", + "exclude": ["dist"] +} diff --git a/examples/view-transitions/package.json b/examples/view-transitions/package.json index 18e9dbbd0206..51069d03d0a6 100644 --- a/examples/view-transitions/package.json +++ b/examples/view-transitions/package.json @@ -10,8 +10,8 @@ "astro": "astro" }, "devDependencies": { - "@astrojs/tailwind": "^5.0.4", - "@astrojs/node": "^7.0.2", - "astro": "^4.0.7" + "@astrojs/tailwind": "^5.1.0", + "@astrojs/node": "^7.0.3", + "astro": "^4.0.8" } } diff --git a/examples/with-markdoc/package.json b/examples/with-markdoc/package.json index 67211e723ace..3a256c74cb5c 100644 --- a/examples/with-markdoc/package.json +++ b/examples/with-markdoc/package.json @@ -11,7 +11,7 @@ "astro": "astro" }, "dependencies": { - "@astrojs/markdoc": "^0.8.1", - "astro": "^4.0.7" + "@astrojs/markdoc": "^0.8.2", + "astro": "^4.0.8" } } diff --git a/examples/with-markdown-plugins/package.json b/examples/with-markdown-plugins/package.json index 7cdb99e34f11..070443067aa9 100644 --- a/examples/with-markdown-plugins/package.json +++ b/examples/with-markdown-plugins/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/markdown-remark": "^4.0.1", - "astro": "^4.0.7", + "astro": "^4.0.8", "hast-util-select": "^6.0.2", "rehype-autolink-headings": "^7.1.0", "rehype-slug": "^6.0.0", diff --git a/examples/with-markdown-shiki/package.json b/examples/with-markdown-shiki/package.json index 02263dcbd446..562d476ee881 100644 --- a/examples/with-markdown-shiki/package.json +++ b/examples/with-markdown-shiki/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.0.7" + "astro": "^4.0.8" } } diff --git a/examples/with-mdx/package.json b/examples/with-mdx/package.json index 11afa24841bc..016370f40d0a 100644 --- a/examples/with-mdx/package.json +++ b/examples/with-mdx/package.json @@ -11,9 +11,9 @@ "astro": "astro" }, "dependencies": { - "@astrojs/mdx": "^2.0.2", - "@astrojs/preact": "^3.0.1", - "astro": "^4.0.7", + "@astrojs/mdx": "^2.0.3", + "@astrojs/preact": "^3.0.2", + "astro": "^4.0.8", "preact": "^10.19.2" } } diff --git a/examples/with-nanostores/package.json b/examples/with-nanostores/package.json index 1c7e196caf56..86a6305f4d88 100644 --- a/examples/with-nanostores/package.json +++ b/examples/with-nanostores/package.json @@ -11,9 +11,9 @@ "astro": "astro" }, "dependencies": { - "@astrojs/preact": "^3.0.1", + "@astrojs/preact": "^3.0.2", "@nanostores/preact": "^0.5.0", - "astro": "^4.0.7", + "astro": "^4.0.8", "nanostores": "^0.9.5", "preact": "^10.19.2" } diff --git a/examples/with-nanostores/src/cartStore.ts b/examples/with-nanostores/src/cartStore.ts index f490a2447f04..00270180a29e 100644 --- a/examples/with-nanostores/src/cartStore.ts +++ b/examples/with-nanostores/src/cartStore.ts @@ -13,7 +13,7 @@ export type CartItemDisplayInfo = Pick; export const cartItems = map>({}); -export function addCartItem({ id, name, imageSrc }) { +export function addCartItem({ id, name, imageSrc }: CartItem) { const existingEntry = cartItems.get()[id]; if (existingEntry) { cartItems.setKey(id, { diff --git a/examples/with-tailwindcss/package.json b/examples/with-tailwindcss/package.json index 7531abebb0bb..c497f3f8a3f0 100644 --- a/examples/with-tailwindcss/package.json +++ b/examples/with-tailwindcss/package.json @@ -11,10 +11,10 @@ "astro": "astro" }, "dependencies": { - "@astrojs/mdx": "^2.0.2", - "@astrojs/tailwind": "^5.0.4", + "@astrojs/mdx": "^2.0.3", + "@astrojs/tailwind": "^5.1.0", "@types/canvas-confetti": "^1.6.3", - "astro": "^4.0.7", + "astro": "^4.0.8", "autoprefixer": "^10.4.15", "canvas-confetti": "^1.9.1", "postcss": "^8.4.28", diff --git a/examples/with-vitest/package.json b/examples/with-vitest/package.json index f2dc137867ff..ff523da7d7cb 100644 --- a/examples/with-vitest/package.json +++ b/examples/with-vitest/package.json @@ -12,7 +12,7 @@ "test": "vitest" }, "dependencies": { - "astro": "^4.0.7", + "astro": "^4.0.8", "vitest": "^0.34.2" } } diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md index ed5853be59c6..86a1df59a10c 100644 --- a/packages/astro/CHANGELOG.md +++ b/packages/astro/CHANGELOG.md @@ -1,5 +1,27 @@ # astro +## 4.0.8 + +### Patch Changes + +- [#9522](https://github.com/withastro/astro/pull/9522) [`bb1438d20d325acd15f3755c6e306e45a7c64bcd`](https://github.com/withastro/astro/commit/bb1438d20d325acd15f3755c6e306e45a7c64bcd) Thanks [@Zegnat](https://github.com/Zegnat)! - Add support for autocomplete attribute to the HTML button type. + +- [#9531](https://github.com/withastro/astro/pull/9531) [`662f06fd9fae377bed1aaa49adbba3542cced087`](https://github.com/withastro/astro/commit/662f06fd9fae377bed1aaa49adbba3542cced087) Thanks [@bluwy](https://github.com/bluwy)! - Fixes duplicated CSS modules content when it's imported by both Astro files and framework components + +- [#9501](https://github.com/withastro/astro/pull/9501) [`eb36e95596fcdb3db4a31744e910495e22e3af84`](https://github.com/withastro/astro/commit/eb36e95596fcdb3db4a31744e910495e22e3af84) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Export JSX namespace from `astro/jsx-runtime` for language tooling to consume + +- [#9492](https://github.com/withastro/astro/pull/9492) [`89a2a07c2e411cda32244b7b05d3c79e93f7dd84`](https://github.com/withastro/astro/commit/89a2a07c2e411cda32244b7b05d3c79e93f7dd84) Thanks [@lilnasy](https://github.com/lilnasy)! - Improves error message for the case where two similarly named files result in the same content entry. + +- [#9532](https://github.com/withastro/astro/pull/9532) [`7224809b73d2c3ec8e8aee2fa07463dc3b57a7a2`](https://github.com/withastro/astro/commit/7224809b73d2c3ec8e8aee2fa07463dc3b57a7a2) Thanks [@bluwy](https://github.com/bluwy)! - Prevents unnecessary URI decoding when rendering a route + +- [#9478](https://github.com/withastro/astro/pull/9478) [`dfef925e1fd07f3efb9fde6f4f23548f2af7dc75`](https://github.com/withastro/astro/commit/dfef925e1fd07f3efb9fde6f4f23548f2af7dc75) Thanks [@lilnasy](https://github.com/lilnasy)! - Improves errors in certain places to also report their causes. + +- [#9463](https://github.com/withastro/astro/pull/9463) [`3b0eaed3b544ef8c4ec1f7b0d5a8f475bcfeb25e`](https://github.com/withastro/astro/commit/3b0eaed3b544ef8c4ec1f7b0d5a8f475bcfeb25e) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Update Sharp version to ^0.33.1 + +- [#9512](https://github.com/withastro/astro/pull/9512) [`1469e0e5a915e6b42b9953dbb48fe57a74518056`](https://github.com/withastro/astro/commit/1469e0e5a915e6b42b9953dbb48fe57a74518056) Thanks [@mingjunlu](https://github.com/mingjunlu)! - Prevents dev toolbar tooltip from overflowing outside of the screen + +- [#9497](https://github.com/withastro/astro/pull/9497) [`7f7a7f1aeaec6b327ae0e5e7470a4f46174bf8ae`](https://github.com/withastro/astro/commit/7f7a7f1aeaec6b327ae0e5e7470a4f46174bf8ae) Thanks [@lilnasy](https://github.com/lilnasy)! - Adds a helpful warning message for when an exported API Route is not uppercase. + ## 4.0.7 ### Patch Changes diff --git a/packages/astro/package.json b/packages/astro/package.json index bc142674421a..370c5f829cda 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -1,6 +1,6 @@ { "name": "astro", - "version": "4.0.7", + "version": "4.0.8", "description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.", "type": "module", "author": "withastro", diff --git a/packages/astro/src/assets/utils/transformToPath.ts b/packages/astro/src/assets/utils/transformToPath.ts index affeea8eb4ac..dd8d17fbeaf3 100644 --- a/packages/astro/src/assets/utils/transformToPath.ts +++ b/packages/astro/src/assets/utils/transformToPath.ts @@ -10,7 +10,7 @@ export function propsToFilename(transform: ImageTransform, hash: string) { isESMImportedImage(transform.src) ? transform.src.src : transform.src ); const ext = extname(filename); - filename = basename(filename, ext); + filename = decodeURIComponent(basename(filename, ext)); let outputExt = transform.format ? `.${transform.format}` : ext; return `/${filename}_${hash}${outputExt}`; diff --git a/packages/astro/src/assets/vite-plugin-assets.ts b/packages/astro/src/assets/vite-plugin-assets.ts index 8dfd86d66264..85868f6e1ce3 100644 --- a/packages/astro/src/assets/vite-plugin-assets.ts +++ b/packages/astro/src/assets/vite-plugin-assets.ts @@ -132,10 +132,12 @@ export default function assets({ }); } + // The paths here are used for URLs, so we need to make sure they have the proper format for an URL + // (leading slash, prefixed with the base / assets prefix, encoded, etc) if (settings.config.build.assetsPrefix) { - return joinPaths(settings.config.build.assetsPrefix, finalFilePath); + return encodeURI(joinPaths(settings.config.build.assetsPrefix, finalFilePath)); } else { - return prependForwardSlash(joinPaths(settings.config.base, finalFilePath)); + return encodeURI(prependForwardSlash(joinPaths(settings.config.base, finalFilePath))); } }; }, diff --git a/packages/astro/src/core/errors/dev/utils.ts b/packages/astro/src/core/errors/dev/utils.ts index fd69b74dbfae..7db29c2f854b 100644 --- a/packages/astro/src/core/errors/dev/utils.ts +++ b/packages/astro/src/core/errors/dev/utils.ts @@ -26,7 +26,7 @@ export function collectErrorMetadata(e: any, rootFolder?: URL | undefined): Erro err.forEach((error) => { if (e.stack) { const stackInfo = collectInfoFromStacktrace(e); - error.stack = stackInfo.stack; + error.stack = stripAnsi(stackInfo.stack); error.loc = stackInfo.loc; error.plugin = stackInfo.plugin; error.pluginCode = stackInfo.pluginCode; @@ -57,7 +57,7 @@ export function collectErrorMetadata(e: any, rootFolder?: URL | undefined): Erro if (!error.frame) { const frame = codeFrame(fileContents, error.loc); - error.frame = frame; + error.frame = stripAnsi(frame); } if (!error.fullCode) { @@ -68,6 +68,12 @@ export function collectErrorMetadata(e: any, rootFolder?: URL | undefined): Erro // Generic error (probably from Vite, and already formatted) error.hint = generateHint(e); + + // Strip ANSI for `message` property. Note that ESBuild errors may not have the property, + // but it will be handled and added below, which is already ANSI-free + if (error.message) { + error.message = stripAnsi(error.message); + } }); // If we received an array of errors and it's not from us, it's most likely from ESBuild, try to extract info for Vite to display diff --git a/packages/astro/src/core/errors/dev/vite.ts b/packages/astro/src/core/errors/dev/vite.ts index f2f149b3f51d..1bd448145123 100644 --- a/packages/astro/src/core/errors/dev/vite.ts +++ b/packages/astro/src/core/errors/dev/vite.ts @@ -111,7 +111,7 @@ export interface AstroErrorPayload { hint?: string; docslink?: string; highlightedCode?: string; - loc: { + loc?: { file?: string; line?: number; column?: number; diff --git a/packages/astro/src/core/errors/overlay.ts b/packages/astro/src/core/errors/overlay.ts index 9a6e5481c88e..1062680bd9da 100644 --- a/packages/astro/src/core/errors/overlay.ts +++ b/packages/astro/src/core/errors/overlay.ts @@ -631,7 +631,7 @@ class ErrorOverlay extends HTMLElement { } const code = this.root.querySelector('#code'); - if (code && err.loc.file) { + if (code && err.loc?.file) { code.style.display = 'block'; const codeHeader = code.querySelector('#code header'); const codeContent = code.querySelector('#code-content'); @@ -670,7 +670,7 @@ class ErrorOverlay extends HTMLElement { } // Add an empty line below the error line so we can show a caret under the error - if (err.loc.column) { + if (err.loc?.column) { errorLine.insertAdjacentHTML( 'afterend', `\n + + + +