astro@7.1.0
📦 astroView on GitHub →
✨ 6 features🐛 3 fixes🔧 6 symbols
Summary
This release introduces several new features for content loading, storage, and security, including deferred rendering for content collections and experimental chunked storage. It also enhances the `paginate` utility and the `astro dev` command with new options for greater flexibility.
Migration Steps
- To use the new `deferRender` option for `glob()` content loader, update your `src/content.config.ts` to include `deferRender: true` within the `glob()` call if desired.
- To enable chunked storage for content collections, update your `astro.config.mjs` to include `experimental: { collectionStorage: 'chunked' }`.
- To use more specific CSP directives, update your `astro.config.mjs` or runtime CSP calls to include the `kind` option (e.g., `'element'`, `'attribute'`, `'default'`) for resources and hashes.
- To customize pagination URL formats, update your `getStaticPaths` function in Astro pages to include the `format` option within the `paginate` utility.
- To run a development server without lock file interaction, use the `astro dev --ignore-lock` command.
- To configure the logger with a URL entrypoint, update your `astro.config.mjs` to use `logger: { entrypoint: new URL('./logger.js', import.meta.url) }`.
✨ New Features
- Adds a new `deferRender` option to the `glob()` content loader. When set to `true`, renderable entries (such as Markdown) are not rendered during content sync, deferring rendering until the entry is actually rendered in a page. This reduces memory usage during `astro build` for large collections.
- Adds a new experimental `collectionStorage` option for controlling how the content layer persists its data store. Setting `experimental.collectionStorage: 'chunked'` splits the data store across many smaller, content-addressed files, which can help with very large content collections that might hit platform file-size limits.
- Adds support for more specific CSP directives (`script-src-elem`, `script-src-attr`, `style-src-elem`, `style-src-attr`) through a new `kind` option in the `security.csp` configuration and the runtime CSP API. This allows for finer-grained control over Content Security Policy.
- Adds a new `format()` option to the `paginate` utility, which is a function that accepts the current URL of the page and returns a new URL. This is useful for customizing generated pagination URLs, such as adding an `.html` extension.
- Adds a `--ignore-lock` flag to `astro dev` for starting a dev server without checking or writing the lock file, allowing it to run alongside an already-running dev server for the same project.
- Allows passing URL entrypoints when configuring the logger, similar to other APIs like session drivers or font providers.
🐛 Bug Fixes
- Fixes the JSON logger crashing with `process is not defined` in non-Node runtimes like Cloudflare's workerd by using `console.log`/`console.error` instead of `process.stdout`/`process.stderr`.
- Fixes a case where an integration could not update the logger with `updateConfig()`.
- Fixes element-specific CSP directives to preserve the existing behavior of configuration.