The web framework for content-driven websites. ⭐️ Star to support our work!
OTHER License
Published by astrobot-houston 4 months ago
8ce66f2
Thanks @ematipico! - Fixes an issue where the pagesGlobToRssItems
returned an incorrect type for items
Published by astrobot-houston 4 months ago
#11197 4b46bd9
Thanks @braebo! - Adds ShikiTransformer
support to the <Code />
component with a new transformers
prop.
Note that transformers
only applies classes and you must provide your own CSS rules to target the elements of your code block.
---
import { transformerNotationFocus } from '@shikijs/transformers';
import { Code } from 'astro:components';
const code = `const foo = 'hello'
const bar = ' world'
console.log(foo + bar) // [!code focus]
`;
---
<Code {code} lang="js" transformers={[transformerNotationFocus()]} />
<style is:global>
pre.has-focused .line:not(.focused) {
filter: blur(1px);
}
</style>
#11134 9042be0
Thanks @florian-lefebvre! - Improves the developer experience of the 500.astro
file by passing it a new error
prop.
When an error is thrown, the special src/pages/500.astro
page now automatically receives the error as a prop. This allows you to display more specific information about the error on a custom 500 page.
---
// src/pages/500.astro
interface Props {
error: unknown;
}
const { error } = Astro.props;
---
<div>{error instanceof Error ? error.message : 'Unknown error'}</div>
If an error occurs rendering this page, your host's default 500 error page will be shown to your visitor in production, and Astro's default error overlay will be shown in development.
#11280 fd3645f
Thanks @ascorbic! - Fixes a bug that prevented cookies from being set when using experimental rewrites
#11275 bab700d
Thanks @syhily! - Drop duplicated brackets in data collections schema generation.
#11272 ea987d7
Thanks @ematipico! - Fixes a case where rewriting /
would cause an issue, when trailingSlash
was set to "never"
.
#11272 ea987d7
Thanks @ematipico! - Reverts a logic where it wasn't possible to rewrite /404
in static mode. It's now possible again
#11264 5a9c9a6
Thanks @Fryuni! - Fixes type generation for empty content collections
#11279 9a08d74
Thanks @ascorbic! - Improves type-checking and error handling to catch case where an image import is passed directly to getImage()
#11292 7f8f347
Thanks @jdtjenkins! - Fixes a case where defineAction
autocomplete for the accept
prop would not show "form"
as a possible value
#11273 cb4d078
Thanks @ascorbic! - Corrects an inconsistency in dev where middleware would run for prerendered 404 routes.
Middleware is not run for prerendered 404 routes in production, so this was incorrect.
#11284 f4b029b
Thanks @ascorbic! - Fixes an issue that would break Astro.request.url
and Astro.request.headers
in astro dev
if HTTP/2 was enabled.
HTTP/2 is now enabled by default in astro dev
if https
is configured in the Vite config.
Published by astrobot-houston 4 months ago
#11213 94ac7ef
Thanks @florian-lefebvre! - Removes the PUBLIC_
prefix constraint for astro:env
public variables
#11213 94ac7ef
Thanks @florian-lefebvre! - BREAKING CHANGE to the experimental astro:env
feature only
Server secrets specified in the schema must now be imported from astro:env/server
. Using getSecret()
is no longer required to use these environment variables in your schema:
- import { getSecret } from 'astro:env/server'
- const API_SECRET = getSecret("API_SECRET")
+ import { API_SECRET } from 'astro:env/server'
Note that using getSecret()
with these keys is still possible, but no longer involves any special handling and the raw value will be returned, just like retrieving secrets not specified in your schema.
#11234 4385bf7
Thanks @ematipico! - Adds a new function called addServerRenderer
to the Container API. Use this function to manually store renderers inside the instance of your container.
This new function should be preferred when using the Container API in environments like on-demand pages:
import type { APIRoute } from 'astro';
import { experimental_AstroContainer } from 'astro/container';
import reactRenderer from '@astrojs/react/server.js';
import vueRenderer from '@astrojs/vue/server.js';
import ReactComponent from '../components/button.jsx';
import VueComponent from '../components/button.vue';
// MDX runtime is contained inside the Astro core
import mdxRenderer from 'astro/jsx/server.js';
// In case you need to import a custom renderer
import customRenderer from '../renderers/customRenderer.js';
export const GET: APIRoute = async (ctx) => {
const container = await experimental_AstroContainer.create();
container.addServerRenderer({ renderer: reactRenderer });
container.addServerRenderer({ renderer: vueRenderer });
container.addServerRenderer({ renderer: customRenderer });
// You can pass a custom name too
container.addServerRenderer({
name: 'customRenderer',
renderer: customRenderer,
});
const vueComponent = await container.renderToString(VueComponent);
return await container.renderToResponse(Component);
};
#11249 de60c69
Thanks @markgaze! - Fixes a performance issue with JSON schema generation
#11242 e4fc2a0
Thanks @ematipico! - Fixes a case where the virtual module astro:container
wasn't resolved
#11236 39bc3a5
Thanks @ascorbic! - Fixes a case where symlinked content collection directories were not correctly resolved
#11258 d996db6
Thanks @ascorbic! - Adds a new error RewriteWithBodyUsed
that throws when Astro.rewrite
is used after the request body has already been read.
#11243 ba2b14c
Thanks @V3RON! - Fixes a prerendering issue for libraries in node_modules
when a folder with an underscore is in the path.
#11244 d07d2f7
Thanks @ematipico! - Improves the developer experience of the custom 500.astro
page in development mode.
Before, in development, an error thrown during the rendering phase would display the default error overlay, even when users had the 500.astro
page.
Now, the development server will display the 500.astro
and the original error is logged in the console.
#11240 2851b0a
Thanks @ascorbic! - Ignores query strings in module identifiers when matching ".astro" file extensions in Vite plugin
#11245 e22be22
Thanks @bluwy! - Refactors prerendering chunk handling to correctly remove unused code during the SSR runtime
Published by astrobot-houston 4 months ago
#11234 4385bf7
Thanks @ematipico! - Adds a new function called addServerRenderer
to the Container API. Use this function to manually store renderers inside the instance of your container.
This new function should be preferred when using the Container API in environments like on-demand pages:
import type { APIRoute } from 'astro';
import { experimental_AstroContainer } from 'astro/container';
import reactRenderer from '@astrojs/react/server.js';
import vueRenderer from '@astrojs/vue/server.js';
import ReactComponent from '../components/button.jsx';
import VueComponent from '../components/button.vue';
// MDX runtime is contained inside the Astro core
import mdxRenderer from 'astro/jsx/server.js';
// In case you need to import a custom renderer
import customRenderer from '../renderers/customRenderer.js';
export const GET: APIRoute = async (ctx) => {
const container = await experimental_AstroContainer.create();
container.addServerRenderer({ renderer: reactRenderer });
container.addServerRenderer({ renderer: vueRenderer });
container.addServerRenderer({ renderer: customRenderer });
// You can pass a custom name too
container.addServerRenderer({
name: 'customRenderer',
renderer: customRenderer,
});
const vueComponent = await container.renderToString(VueComponent);
return await container.renderToResponse(Component);
};
Published by astrobot-houston 4 months ago
#11234 4385bf7
Thanks @ematipico! - Adds a new function called addServerRenderer
to the Container API. Use this function to manually store renderers inside the instance of your container.
This new function should be preferred when using the Container API in environments like on-demand pages:
import type { APIRoute } from 'astro';
import { experimental_AstroContainer } from 'astro/container';
import reactRenderer from '@astrojs/react/server.js';
import vueRenderer from '@astrojs/vue/server.js';
import ReactComponent from '../components/button.jsx';
import VueComponent from '../components/button.vue';
// MDX runtime is contained inside the Astro core
import mdxRenderer from 'astro/jsx/server.js';
// In case you need to import a custom renderer
import customRenderer from '../renderers/customRenderer.js';
export const GET: APIRoute = async (ctx) => {
const container = await experimental_AstroContainer.create();
container.addServerRenderer({ renderer: reactRenderer });
container.addServerRenderer({ renderer: vueRenderer });
container.addServerRenderer({ renderer: customRenderer });
// You can pass a custom name too
container.addServerRenderer({
name: 'customRenderer',
renderer: customRenderer,
});
const vueComponent = await container.renderToString(VueComponent);
return await container.renderToResponse(Component);
};
Published by astrobot-houston 4 months ago
Published by astrobot-houston 4 months ago
#11234 4385bf7
Thanks @ematipico! - Adds a new function called addServerRenderer
to the Container API. Use this function to manually store renderers inside the instance of your container.
This new function should be preferred when using the Container API in environments like on-demand pages:
import type { APIRoute } from 'astro';
import { experimental_AstroContainer } from 'astro/container';
import reactRenderer from '@astrojs/react/server.js';
import vueRenderer from '@astrojs/vue/server.js';
import ReactComponent from '../components/button.jsx';
import VueComponent from '../components/button.vue';
// MDX runtime is contained inside the Astro core
import mdxRenderer from 'astro/jsx/server.js';
// In case you need to import a custom renderer
import customRenderer from '../renderers/customRenderer.js';
export const GET: APIRoute = async (ctx) => {
const container = await experimental_AstroContainer.create();
container.addServerRenderer({ renderer: reactRenderer });
container.addServerRenderer({ renderer: vueRenderer });
container.addServerRenderer({ renderer: customRenderer });
// You can pass a custom name too
container.addServerRenderer({
name: 'customRenderer',
renderer: customRenderer,
});
const vueComponent = await container.renderToString(VueComponent);
return await container.renderToResponse(Component);
};
Published by astrobot-houston 4 months ago
#11234 4385bf7
Thanks @ematipico! - Adds a new function called addServerRenderer
to the Container API. Use this function to manually store renderers inside the instance of your container.
This new function should be preferred when using the Container API in environments like on-demand pages:
import type { APIRoute } from 'astro';
import { experimental_AstroContainer } from 'astro/container';
import reactRenderer from '@astrojs/react/server.js';
import vueRenderer from '@astrojs/vue/server.js';
import ReactComponent from '../components/button.jsx';
import VueComponent from '../components/button.vue';
// MDX runtime is contained inside the Astro core
import mdxRenderer from 'astro/jsx/server.js';
// In case you need to import a custom renderer
import customRenderer from '../renderers/customRenderer.js';
export const GET: APIRoute = async (ctx) => {
const container = await experimental_AstroContainer.create();
container.addServerRenderer({ renderer: reactRenderer });
container.addServerRenderer({ renderer: vueRenderer });
container.addServerRenderer({ renderer: customRenderer });
// You can pass a custom name too
container.addServerRenderer({
name: 'customRenderer',
renderer: customRenderer,
});
const vueComponent = await container.renderToString(VueComponent);
return await container.renderToResponse(Component);
};
Published by astrobot-houston 4 months ago
#11234 4385bf7
Thanks @ematipico! - Adds a new function called addServerRenderer
to the Container API. Use this function to manually store renderers inside the instance of your container.
This new function should be preferred when using the Container API in environments like on-demand pages:
import type { APIRoute } from 'astro';
import { experimental_AstroContainer } from 'astro/container';
import reactRenderer from '@astrojs/react/server.js';
import vueRenderer from '@astrojs/vue/server.js';
import ReactComponent from '../components/button.jsx';
import VueComponent from '../components/button.vue';
// MDX runtime is contained inside the Astro core
import mdxRenderer from 'astro/jsx/server.js';
// In case you need to import a custom renderer
import customRenderer from '../renderers/customRenderer.js';
export const GET: APIRoute = async (ctx) => {
const container = await experimental_AstroContainer.create();
container.addServerRenderer({ renderer: reactRenderer });
container.addServerRenderer({ renderer: vueRenderer });
container.addServerRenderer({ renderer: customRenderer });
// You can pass a custom name too
container.addServerRenderer({
name: 'customRenderer',
renderer: customRenderer,
});
const vueComponent = await container.renderToString(VueComponent);
return await container.renderToResponse(Component);
};
Published by astrobot-houston 4 months ago
#11234 4385bf7
Thanks @ematipico! - Adds a new function called addServerRenderer
to the Container API. Use this function to manually store renderers inside the instance of your container.
This new function should be preferred when using the Container API in environments like on-demand pages:
import type { APIRoute } from 'astro';
import { experimental_AstroContainer } from 'astro/container';
import reactRenderer from '@astrojs/react/server.js';
import vueRenderer from '@astrojs/vue/server.js';
import ReactComponent from '../components/button.jsx';
import VueComponent from '../components/button.vue';
// MDX runtime is contained inside the Astro core
import mdxRenderer from 'astro/jsx/server.js';
// In case you need to import a custom renderer
import customRenderer from '../renderers/customRenderer.js';
export const GET: APIRoute = async (ctx) => {
const container = await experimental_AstroContainer.create();
container.addServerRenderer({ renderer: reactRenderer });
container.addServerRenderer({ renderer: vueRenderer });
container.addServerRenderer({ renderer: customRenderer });
// You can pass a custom name too
container.addServerRenderer({
name: 'customRenderer',
renderer: customRenderer,
});
const vueComponent = await container.renderToString(VueComponent);
return await container.renderToResponse(Component);
};
Published by astrobot-houston 4 months ago
Published by astrobot-houston 4 months ago
#11262 9b03023
Thanks @nezouse! - Import type Database
from correct file
Updated dependencies []:
Published by astrobot-houston 5 months ago
#11231 58d7dbb
Thanks @ematipico! - Fixes a regression for getViteConfig
, where the inline config wasn't merged in the final config.
#11228 1e293a1
Thanks @ascorbic! - Updates getCollection()
to always return a cloned array
#11207 7d9aac3
Thanks @ematipico! - Fixes an issue in the rewriting logic where old data was not purged during the rewrite flow. This caused some false positives when checking the validity of URL path names during the rendering phase.
#11189 75a8fe7
Thanks @ematipico! - Improve error message when using getLocaleByPath
on path that doesn't contain any locales.
#11195 0a6ab6f
Thanks @florian-lefebvre! - Adds support for enums to astro:env
You can now call envField.enum
:
import { defineConfig, envField } from 'astro/config';
export default defineConfig({
experimental: {
env: {
schema: {
API_VERSION: envField.enum({
context: 'server',
access: 'secret',
values: ['v1', 'v2'],
}),
},
},
},
});
#11210 66fc028
Thanks @matthewp! - Close the iterator only after rendering is complete
#11195 0a6ab6f
Thanks @florian-lefebvre! - Adds additional validation options to astro:env
astro:env
schema datatypes string
and number
now have new optional validation rules:
import { defineConfig, envField } from 'astro/config';
export default defineConfig({
experimental: {
env: {
schema: {
FOO: envField.string({
// ...
max: 32,
min: 3,
length: 12,
url: true,
includes: 'foo',
startsWith: 'bar',
endsWith: 'baz',
}),
BAR: envField.number({
// ...
gt: 2,
min: 3,
lt: 10,
max: 9,
int: true,
}),
},
},
},
});
#11211 97724da
Thanks @matthewp! - Let middleware handle the original request URL
#10607 7327c6a
Thanks @frankbits! - Fixes an issue where a leading slash created incorrect conflict resolution between pages generated from static routes and catch-all dynamic routes
Published by astrobot-houston 5 months ago
#11083 416c4ac
Thanks @V3RON! - Prevent Partytown from crashing when View Transitions are enabled
When View Transitions are turned on, Partytown executes on every transition.
It's not meant to be like that, and therefore it breaks the integration completely.
Starting from now, Partytown will be executed only once.
Published by astrobot-houston 5 months ago
2bdca27
Thanks @florian-lefebvre! - Adds support for experimental astro:env
released in Astro 4.10Published by astrobot-houston 5 months ago
2bdca27
Thanks @florian-lefebvre! - Adds support for experimental astro:env
released in Astro 4.10Published by astrobot-houston 5 months ago
#11216 29463df
Thanks @OliverSpeir! - Export type Database
from @astrojs/db/runtime
Updated dependencies []:
Published by astrobot-houston 5 months ago
#11198 8b9a499
Thanks @florian-lefebvre! - Fixes a case where astro:env
getSecret
would not retrieve environment variables properly in dev and build modes
#11206 734b98f
Thanks @florian-lefebvre! - BREAKING CHANGE to the experimental astro:env
feature only
Updates the adapter astro:env
entrypoint from astro:env/setup
to astro/env/setup
#11205 8c45391
Thanks @Nin3lee! - Fixes a typo in the config reference