Skip to content
Compare
Choose a tag to compare
@astrobot-houston astrobot-houston released this 15 Feb 10:46
· 38 commits to main since this release
9b32c6a

Minor Changes

  • #2390 f493361 Thanks @delucis! - Moves route data to Astro.locals instead of passing it down via component props

    ⚠️ Breaking change:
    Previously, all of Starlight’s templating components, including user or plugin overrides, had access to a data object for the current route via Astro.props.
    This data is now available as Astro.locals.starlightRoute instead.

    To update, refactor any component overrides you have:

    • Remove imports of @astrojs/starlight/props, which is now deprecated.
    • Update code that accesses Astro.props to use Astro.locals.starlightRoute instead.
    • Remove any spreading of {...Astro.props} into child components, which is no longer required.

    In the following example, a custom override for Starlight’s LastUpdated component is updated for the new style:

    ---
    import Default from '@astrojs/starlight/components/LastUpdated.astro';
    - import type { Props } from '@astrojs/starlight/props';
    
    - const { lastUpdated } = Astro.props;
    + const { lastUpdated } = Astro.locals.starlightRoute;
    
    const updatedThisYear = lastUpdated?.getFullYear() === new Date().getFullYear();
    ---
    
    {updatedThisYear && (
    -   <Default {...Astro.props}><slot /></Default>
    +   <Default><slot /></Default>
    )}

    Community Starlight plugins may also need to be manually updated to work with Starlight 0.32. If you encounter any issues, please reach out to the plugin author to see if it is a known issue or if an updated version is being worked on.

  • #2578 f895f75 Thanks @HiDeoo! - Deprecates the Starlight plugin setup hook in favor of the new config:setup hook which provides the same functionality.

    ⚠️ BREAKING CHANGE:

    The Starlight plugin setup hook is now deprecated and will be removed in a future release. Please update your plugins to use the new config:setup hook instead.

    export default {
      name: 'plugin-with-translations',
      hooks: {
    -   'setup'({ config }) {
    +   'config:setup'({ config }) {
          // Your plugin configuration setup code
        },
      },
    };
  • #2578 f895f75 Thanks @HiDeoo! - Exposes the built-in localization system in the Starlight plugin config:setup hook.

    ⚠️ BREAKING CHANGE:

    This addition changes how Starlight plugins add or update translation strings used in Starlight’s localization APIs.
    Plugins previously using the injectTranslations() callback function from the plugin config:setup hook should now use the same function available in the i18n:setup hook.

    export default {
      name: 'plugin-with-translations',
      hooks: {
    -   'config:setup'({ injectTranslations }) {
    +   'i18n:setup'({ injectTranslations }) {
          injectTranslations({
            en: {
              'myPlugin.doThing': 'Do the thing',
            },
            fr: {
              'myPlugin.doThing': 'Faire le truc',
            },
          });
        },
      },
    };
  • #2858 2df9d05 Thanks @XREvo! - Adds support for Pagefind’s multisite search features

  • #2578 f895f75 Thanks @HiDeoo! - Adds a new HookParameters utility type to get the type of a plugin hook’s arguments.

  • #2578 f895f75 Thanks @HiDeoo! - Adds a new useTranslations() callback function to the Starlight plugin config:setup hook to generate a utility function to access UI strings for a given language.

  • #2578 f895f75 Thanks @HiDeoo! - Adds a new absolutePathToLang() callback function to the Starlight plugin config:setup to get the language for a given absolute file path.

Patch Changes