Skip to content

AstroEco is Contributing…

Display your GitHub pull requests using astro-loader-github-prs

withastro/starlight

Description

  • This PR reverts the changes made in #3281

  • In #3281 we initially agreed to add a class name to every link in the sidebar. After approving and merging, I realised I hadn’t considered all the implications.

  • Sidebars are one of the heftier parts of Starlight’s HTML output. Especially for larger sites. For example, Astro’s docs currently include 215 links in its sidebar. This means any changes to sidebar entry markup can quickly accumulate given they can be reproduced 100s of time on every page (in the uncached HTML). Using the Astro docs example, this adds up to multiple kilobytes per page.

  • Given this, we discussed it a bit with the team and decided adding a class name like this is not justified. It is already feasible to target these links with CSS:

    .sidebar-content a { /* styles */ }

    Adding a dedicated class name doesn’t provide any new functionality that is not currently available, and adds bloat to the HTML output, which may prove significant for content-heavy sites.

withastro/astro

Changes

Testing

  • tests should still pass
  • now new test is needed

Docs

  • not needed bugfix
withastro/astro

Related PR : #12731
Related Discussion: channels

Motivation

TypeScript ≥ 4.1 no longer needs compilerOptions.baseUrl when using paths; the compiler implicitly anchors look-ups at the folder that contains the tsconfig.json. The TypeScript handbook now discourages setting baseUrl outside AMD-loader scenarios. Astro still throws an error when paths is present but baseUrl is absent, forcing every new TS project to add boilerplate that is neither required nor recommended.

Changes

  • If compilerOptions.baseUrl is undefined, we now default to "." (project root) before resolving aliases.

Testing

New fixture alias-tsconfig-no-baseurl (identical to existing alias fixture but without baseUrl).

  • Added Vitest covering dev/build alias resolution without baseUrl.

Docs

No external dependencies and no public API changes.

withastro/astro

Changes

The allows domains in imagesConfig to be undefined. Previously, if it was not defined, you would get an error that it is not iterable. Leaving it undefined allows for using remotePatterns to create patterns to essentially optimize any image from any website.

Testing

Docs

withastro/starlight

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

@astrojs/starlight@0.34.5

Patch Changes

  • #3282 7680e87 Thanks @alvinometric! - Moves padding of <main> element to a --sl-main-pad CSS custom property to simplify setting custom values

  • #3288 131371e Thanks @HiDeoo! - Fixes a potential configuration issue for multilingual sites with a default language including a regional subtag.

withastro/astro

Changes

Added a simple declare module definition to get rid of TypeScript errors for Vite's '...?no-inline' import feature.
The typing is currently only defined for '...?url&no-inline' imports, but not for '...?no-inline' imports, for some reason.

Before

Screenshot of an IDE with an import error

After

Screenshot of an IDE with no errors

Note: The two errors reported on client.d.ts are from lines 182 and 189 - pretty unrelated to my change.

Testing

Manually modified the minimal example from /examples/minimal to import the SVG favicon with '...?no-inline'. Then checked the output of astro check before and after my change.

No unit tests or other forms of scripted tests were added, since I didn't find any for the already existing module declarations. Let me know in case I should add tests and how.

Docs

Since the current module declarations don't have specific docs either, except for maybe references to Vite's docs, I don't think we need to add any.

withastro/starlight

Added the --sl-main-pad custom prop so I could get rid of the pesky bottom padding on StarlightPage

I would rather get rid of it altogether, but this works for now

withastro/starlight

Description

  • Closes #3264
  • Added a new 'sl-sidebar-link' class to sidebar links.
  • Exported the SidebarEntry type
withastro/astro

This PR contains the following updates:

Package Change Age Confidence
pretty-bytes ^6.1.1 -> ^7.0.0 age confidence

Release Notes

sindresorhus/pretty-bytes (pretty-bytes)

v7.0.0

Compare Source

Breaking
Improvements


Configuration

📅 Schedule: Branch creation - Between 12:00 AM and 03:59 AM, only on Monday ( * 0-3 * * 1 ) (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

withastro/starlight

Description

This PR contains an addition of a link to a new community plugin.

withastro/astro

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

@astrojs/netlify@6.5.0

Minor Changes

  • #13768 faa0eff Thanks @eduardoboucas! - Updates the adapter to use Netlify's Vite plugin in development.

    This is an implementation update that does not require any change to your project code, but means that astro dev will run with an environment closer to a production deploy on Netlify. This brings several benefits you'll now notice working in dev mode!

    For example, your project running in development mode will now use local versions of the Netlify Image CDN for images, and a local Blobs server for sessions. It will also will populate your environment with the variables from your linked Netlify site.

    While not required for fully static, prerendered web sites, you may still wish to add this for the additional benefits of now working in a dev environment closer to your Netlify production deploy, as well as to take advantage of Netlify-exclusive features such as the Netlify Image CDN.

Patch Changes

  • Updated dependencies []:
    • @astrojs/underscore-redirects@1.0.0

astro@5.11.1

Patch Changes

  • #14045 3276b79 Thanks @ghubo! - Fixes a problem where importing animated .avif files returns a NoImageMetadata error.

  • #14041 0c4d5f8 Thanks @dixslyf! - Fixes a <ClientRouter /> bug where the fallback view transition animations when exiting a page
    ran too early for browsers that do not support the View Transition API.
    This bug prevented event.viewTransition?.skipTransition() from skipping the page exit animation
    when used in an astro:before-swap event hook.

@astrojs/vercel@8.2.2

Patch Changes

  • #14063 de5a253 Thanks @RobbieTheWagner! - Allow setting domains to undefined in imagesConfig so that remotePatterns can be better utilized for images from a variety of domains.
withastro/astro

Changes

  • add avis brand for animated avif file

Testing

Manually tested using animated avif file

Docs

/cc @withastro/maintainers-docs for feedback!

withastro/astro

Changes

  • Add support for async customPages function in sitemap integration
  • customPages option now accepts either an array of URLs or an async function that returns URLs
  • Updated schema validation to support both array and function types
  • Function receives the site URL as parameter for dynamic URL generation

Testing

  • Added test case to verify async customPages function works in SSR mode
  • Created new test fixture page /solutions/[...solution].astro for catch-all route
  • Updated SSR test config to use async function that generates solution URLs
  • Verified generated sitemap includes custom pages from async function

Docs

/cc @withastro/maintainers-docs for feedback!

withastro/starlight

Description

  • Closes #3267
  • Partially addresses the issue raised in #3267 where a banner’s content would end up indexed by Pagefind and displayed in search results by excluding the default Banner.astro component from indexing.
  • #3271 will address the styling issues more fully for cases where this still occurs, but I think it makes sense for us to exclude banner content nonetheless as it’s often unexpected for this content to show up in search results, especially for sites where people set banners to show up on all pages for example.
withastro/astro

Changes

Fallback view transition animations for browsers that do not support the View Transition API were running too early when using ClientRouter. Specifically, the exit animation for the current page during navigation would run before the astro:before-swap event, even though it should run after it (but before the actual swap).

This bug only affects browsers that do not support the View Transition API and was first discovered in #14034 (the original issue was about navigating to self, but discussion led to finding this bug). The consequence of the bug is that calling .skipTransition() in the astro:before-swap event would only skip the enter animation of the new page, but not the exit animation of the current page — this is inconsistent with browsers that do support native view transitions, where both animations would be skipped. E.g.:

document.addEventListener("astro:before-swap", (e) => {
  e.viewTransition?.skipTransition();
});

The fix is quite simple: we just need to move the code for the fallback exit animation so that it's after dispatch of the astro:before-swap event (so that hooks can run), but before the actual swap occurs.

Closes #14034.

Testing

2 E2E tests added by @martrapp (thanks!):

  • skipTransition() should skip transition animations when called in astro:before-swap event hook (Firefox only)
  • Transition animations should run when not skipped (Firefox only)

Docs

I don't think this requires changes to the documentation since it's just a bug fix.

withastro/astro

Changes

Closes #13996

The information regarding the headers were saved in the wrong place. This PR fixes that by putting the information in the routes field: https://github.com/vercel/examples/blob/main/build-output-api/routes/.vercel/output/config.json

Testing

Updated the tests

Docs

N/A

withastro/starlight

Description

This PR builds on top of #3241 where I cherry-picked and co-auhored the initial fix preventing errors when using the Astro renderMarkdown() content loader API.

This PR also:

  • Refactor such fix to make it easier to check if we should transform a file or not using remark and rehype plugins.
  • Apply such check to other Starlight remark and rehype plugins like #3181 initially did for heading anchor links, e.g. at the moment, Starlight asides are rendered in non-Starlight pages.
withastro/starlight

Closes #3227

This PR makes it possible to pass generateId to Starlight’s docsLoader().

Currently, using generateId to customize content slugs is only possible by ejecting back up to Astro’s generic glob() loader, but this requires figuring out the pattern and base Starlight uses if you want to mirror the docsLoader() behaviour, e.g.:

-   loader: docsLoader(),
+   loader: glob({
+     pattern: "**/[^_]*.{md,mdx}",
+     base: "./src/content/docs",
+     generateId: customMethod
+   }),

After this PR you can keep using docsLoader(), and just add your ID method:

-   loader: docsLoader(),
+   loader: docsLoader({ generateId: customMethod }),

I did not also add an equivalent method to the i18nLoader as customizing slugs for languages seems much less common, and it would be more liable to break given how we load translation files in non-content collection contexts.

A big part of this PR was also figuring out how best to document this, as we currently only document our loaders in passing. This PR adds a “Configuring content collections” section to the config reference which documents all our loaders and schemas. I kept this minimal for now and linked out to existing relevant docs rather than duplicating or moving things around, but I’d welcome feedback on this new section.


It’s perhaps worth noting that there is some risk in supporting custom generateId methods. Especially for multilingual sites.

There are a few code paths running outside of the Astro/Vite context where Starlight uses raw file paths directly rather than the content collection ID. This is notably the case for remark/rehype plugins. For example, we use the file path to work out the current language for remark plugins. This means it won’t be possible to use generateId for entirely novel structures like storing localized content in sub-directories or something.

For example, moving the locale from a file name to the front of the ID like this wouldn’t work for our remark plugins:

// Example input: { entry: 'tutorials/intro/en.md' }
generateId: ({ entry }) => {
  const extensionlessPath = entry.split('.').slice(0, -1).join('.'); // "tutorials/intro/en"
  const segments = extensionlessPath.split('/');                     // ["tutorials", "intro", "en"]
  return [segments.at(-1), ...segments.slice(0, -1)].join('/');      // "en/tutorials/intro"
},

But for common scenarios like preserving uppercase characters or special characters like . inside IDs, it should work pretty OK although it is likely to break compatibility with plugins like https://github.com/HiDeoo/starlight-links-validator that rely on being able to predict the ID format based on the filepath.

withastro/astro

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

astro@5.11.0

Minor Changes

  • #13972 db8f8be Thanks @ematipico! - Updates the NodeApp.match() function in the Adapter API to accept a second, optional parameter to allow adapter authors to add headers to static, prerendered pages.

    NodeApp.match(request) currently checks whether there is a route that matches the given Request. If there is a prerendered route, the function returns undefined, because static routes are already rendered and their headers cannot be updated.

    When the new, optional boolean parameter is passed (e.g. NodeApp.match(request, true)), Astro will return the first matched route, even when it's a prerendered route. This allows your adapter to now access static routes and provides the opportunity to set headers for these pages, for example, to implement a Content Security Policy (CSP).

Patch Changes

  • #14029 42562f9 Thanks @ematipico! - Fixes a bug where server islands wouldn't be correctly rendered when they are rendered inside fragments.

    Now the following examples work as expected:

    ---
    import { Cart } from '../components/Cart.astro';
    ---
    
    <>
      <Cart server:defer />
    </>
    
    <Fragment slot="rest">
      <Cart server:defer>
        <div slot="fallback">Not working</div>
      </Cart>
    </Fragment>
  • #14017 8d238bc Thanks @dmgawel! - Fixes a bug where i18n fallback rewrites didn't work in dynamic pages.

@astrojs/node@9.3.0

Minor Changes

  • #14012 a125a14 Thanks @florian-lefebvre! - Adds a new experimental configuration option experimentalDisableStreaming to allow you to opt out of Astro's default HTML streaming for pages rendered on demand.

    HTML streaming helps with performance and generally provides a better visitor experience. In most cases, disabling streaming is not recommended.

    However, when you need to disable HTML streaming (e.g. your host only supports non-streamed HTML caching at the CDN level), you can now opt out of the default behavior:

    import { defineConfig } from 'astro/config';
    import node from '@astrojs/node';
    
    export default defineConfig({
      adapter: node({
        mode: 'standalone',
    +    experimentalDisableStreaming: true,
      }),
    });
  • #13972 db8f8be Thanks @ematipico! - Adds support for the experimental static headers Astro feature.

    When the feature is enabled via the option experimentalStaticHeaders, and experimental Content Security Policy is enabled, the adapter will generate Response headers for static pages, which allows support for CSP directives that are not supported inside a <meta> tag (e.g. frame-ancestors).

    import { defineConfig } from 'astro/config';
    import node from '@astrojs/node';
    
    export default defineConfig({
      adapter: node({
        mode: 'standalone',
        experimentalStaticHeaders: true,
      }),
      experimental: {
        cps: true,
      },
    });

@astrojs/netlify@6.4.1

Patch Changes

  • #13972 db8f8be Thanks @ematipico! - Fixes the internal implementation of the new feature experimentalStaticHeaders, where dynamic routes
    were mapped to use always the same header.
  • Updated dependencies []:
    • @astrojs/underscore-redirects@1.0.0

@astrojs/vercel@8.2.1

Patch Changes

  • #13972 db8f8be Thanks @ematipico! - Fixes the internal implementation of the new feature experimentalStaticHeaders, where dynamic routes
    were mapped to use always the same header.
withastro/starlight

Description

  • Closes #3268
  • What does this PR change? Give us a brief description.
    This PR fixes a typo in the Chinese authoring guide: the <TabItem> label was incorrectly written as "Markdown/MDX" and is corrected to "Markdoc".
  • Did you change something visual? A before/after screenshot can be helpful.
    image
    image
withastro/starlight

Description

This PR adds support for custom HTML attributes on autogenerated sidebar links using the autogenerate.attrs option.

  • The autogenerate.attrs is used rather than just attrs as attrs is only supported for links and not groups at the moment. This could be confusing to support attrs on autogenerated groups but not on manually defined groups, so autogenerate.attrs is used to clarify that this is only for links in an autogenerated groups.
  • Using attrs on sidebar groups now results in a type error on top of the existing runtime error. I added some type tests to ensure this is the case.
  • Individual pages can override custom attributes using the sidebar.attrs frontmatter field.
withastro/astro

Closes #13910

This PR implements content-based deduplication for SVG assets during the build process, addressing deployment compatibility issues with platforms like GitHub Pages that reject hard links in uploaded artifacts.

Changes

  • re-use the first emitFile() handle when the content hash matches.
  • works in both emitESMImage() and emitImageMetadata().
  • removes the hard/symlink workaround

Testing

  • asset-hash-deduplication.test.js ensures emitFile() is called once per unique hash.
  • verifies that only two SVGs are written to dist/_astro/ when three source files contain two unique byte sequences.

Docs

No documentation changes required
this optimization is automatically applied during builds and is transparent to users.

Related PR: #13968

withastro/astro

Changes

Closes #13969

This is a "weird" fix. When rendering the server island inside a fragment, the init function (where we calculate content and hostId, the undefined info of the issue) is called after the render function. So put the generation of hostId and islandContent inside a shared function, and saved it inside the class.

Here's the weird part: when calling render, the props are correctly present and evaluated. However, and init is called, the props aren't there anymore. I'm not sure if this is a bug coming from somewhere else, or that's the expected behaviour.

As a workaround, I created two new functions where we save these props inside the class. Doing so fixes the bug and the rest of the tests keep passing. Still, it's weird

Testing

Added two new tests:

  • simple fragment
  • fragment with slots

Docs

N/A


Last fetched:  |  Scheduled refresh: Every Saturday

See Customizing GitHub Activity Pages to configure your own

Inspired by prs.atinux.com