- This reverts to using
before-hydrationfrom5.1.xreleases. Astro 6 has landedbefore-hydrationfix in 6.0.5, and this should be stable in older versions of Astro 5.
-
Inline hydration support as a blocking script instead of using Astro's
before-hydrationorpageinjection. While debugging SSR hydration issues we discovered two separate bugs:- Astro 6 doesn't emit the
before-hydrationchunk for the client build environment, causing a 404. We contributed a fix upstream which has been merged. - Even with the Astro fix,
before-hydrationloads as a module script which can race with other module scripts that import lit-element. If lit-element evaluates first,globalThis.litElementHydrateSupportisn't set yet and the hydration patches are never applied, causing intermittent duplicate rendering.
This release bundles the hydration support (~13KB) and inlines it via
head-inlineas a classic blocking script, guaranteeing it executes before any module scripts. - Astro 6 doesn't emit the
- Reverts 5.1.2 workaround back to
before-hydrationinjection. The underlying issue is an Astro 6 bug where the before-hydration chunk is not emitted for the client build. Use 5.1.0 if you are on Astro 5. If you are on Astro 6, this version requires the Astro fix from the linked PR — until that merges, pin to 5.1.2.
- Workaround for hydration support not loading in Astro 6 static builds due to a missing chunk in Astro's client build. Switches to
pagescript injection which fixes the 404 but does not guarantee execution order relative to island hydration, so components may occasionally re-render on first load. Use 5.1.3 once the Astro fix lands.
- Adds new independent build system for project, fixes issues is 5.0.1-2 related to build system failure conditions.
- These versions should not be used and have build errors related to the project fork
- Integration forked from official @astro/lit integration due to loss of first party support (see discussion here)
- Updated for compatibility with Astro 5.0. This version requires Astro 5.0 or later.
- Updated dependencies:
@lit-labs/ssrto ^3.3.1@lit-labs/ssr-dom-shimto ^1.3.0litto ^3.2.1parse5to ^7.2.1
- Updated peer dependency requirement for
litto ^3.2.0
Changelog below is from official Lit integration, to use one of these versions you will need to use a tagged version of Astro 4
-
#11234
4385bf7Thanks @ematipico! - Adds a new function calledaddServerRendererto 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); };
-
#11144
803dd80Thanks @ematipico! - The integration now exposes a function calledgetContainerRenderer, that can be used inside the Container APIs to load the relative renderer.import { experimental_AstroContainer as AstroContainer } from 'astro/container'; import ReactWrapper from '../src/components/ReactWrapper.astro'; import { loadRenderers } from 'astro:container'; import { getContainerRenderer } from '@astrojs/react'; test('ReactWrapper with react renderer', async () => { const renderers = await loadRenderers([getContainerRenderer()]); const container = await AstroContainer.create({ renderers, }); const result = await container.renderToString(ReactWrapper); expect(result).toContain('Counter'); expect(result).toContain('Count: <!-- -->5'); });
- #11164
cf9b2ffThanks @scottnath! - Removes deprecatedtemplateattribute and replaces deprecated domparser function
- #9479
1baf0b0d3cbd0564954c2366a7278794fad6726eThanks @sarah11918! - Updates README
- #8822
b0a71946fThanks @Geoffrey-Pliez! - Upgrade to Lit 3.0
- #9018
23c9a30adThanks @augustjk! - Fix hydration ordering of nested custom elements. Child components will now wait for their parents to hydrate before hydrating themselves.
- #8826
754c40f6eThanks @lilnasy! - Fixed an issue where an incompatible version of lit was installed.
- #8737
6f60da805Thanks @ematipico! - Add provenance statement when publishing the library from CI
-
#8188
d0679a666Thanks @ematipico! - Remove support for Node 16. The lowest supported version by Astro and all integrations is now v18.14.1. As a reminder, Node 16 will be deprecated on the 11th September 2023. -
#8179
6011d52d3Thanks @matthewp! - Astro 3.0 Release Candidate
1eae2e3f7Thanks @Princesseuh! - Remove support for Node 16. The lowest supported version by Astro and all integrations is now v18.14.1. As a reminder, Node 16 will be deprecated on the 11th September 2023.
- #6752
c7eb0d431Thanks @augustjk! - ProviderenderInfowhen rendering Lit components. Fixes issue with rendering nested components.
- #6681
4b077318fThanks @e111077! - Update to use@lit-labs/ssr@^3[BREAKING] DOM shim required for Lit SSR has been greatly reduced.window,document, and other objects are no longer available in global. Most SSR-ready component code should not be affected but, if so, they can be fixed with optional chaining or by using theisServerenvironment checker from thelitpackage. See [lit.dev docs on authoring components for SSR].(https://lit.dev/docs/ssr/authoring/#browser-only-code) [BREAKING] Adds compatibility with[email protected]hydration behavior. Do not update if you're using[email protected]or lower. Includes support for template[shadowrootmode] support.
- #6213
afbbc4d5bThanks @Princesseuh! - Updated compilation settings to disable downlevelling for Node 14
- #6351
26bf12ef3Thanks @hrmcdonald! - Render DSD attributes based onshadowRootOptions
- #6111
ec38a8921Thanks @e111077! - Implement client:only functionality in Lit and add lit to the client:only warning
-
#6080
0db220415Thanks @e111077! - Fixes Lit hydration not having the same reactive values as server (losing state upon hydration) -
#6055
2567aa48bThanks @e111077! - Add forwards compatibility for streaming Declarative Shadow DOM
-
#5782
1f92d64eaThanks @Princesseuh! - Only shim fetch if not already present
-
#5782
1f92d64eaThanks @Princesseuh! - Only shim fetch if not already present -
#5776
6a31433ed& #5791f7aa1ec25Thanks @ba55ie! - Fix Lit slotted content
See changes in 1.0.2-beta.0
-
04ad44563- > Astro v1.0 is out! Read the official announcement post.No breaking changes. This package is now officially stable and compatible with
[email protected]!
- #3854
b012ee55Thanks @bholmesdev! - [astro add] Support adapters and third party packages
-
#3652
7373d61cThanks @natemoo-re! - Adds support for passing named slots from.astro=> Lit components.All slots are treated as Light DOM content.
-
#3625
f5afaf24Thanks @matthewp! - Conform to Constructor based renderingThis changes
@astrojs/litto conform to the way rendering happens in all other frameworks. Instead of using the tag name<my-element client:load>you use the imported constructor function,<MyElement client:load>like you would do with any other framework.Support for
tag-namesyntax had to be removed due to the fact that it was a runtime feature that was not statically analyzable. To improve build performance, we have removed all runtime based component discovery. Using the imported Constructor name allows Astro to discover what components need to be built and bundled for production without ever running your file.
- #3511
2fedb974Thanks @natemoo-re! - Patch Lit's server shim to allow forsasscompatibility
- #3375
fe61e469Thanks @jdvivar! - Added tests and fix a small edge case for when you call render with no props/attrs
815d62f1Thanks @FredKSchott! - no changes.
- #2979
9d7a4b59Thanks @FredKSchott! - Welcome to the Astro v1.0.0 Beta! Read the official announcement for more details.
- #2885
6b004363Thanks @bholmesdev! - Add README across Astro built-in integrations
- #2847
3b621f7aThanks @tony-sull! - Adds keywords to the official integrations to support discoverability on Astro's Integrations site
- #2847
3b621f7aThanks @tony-sull! - Adds keywords to the official integrations to support discoverability on Astro's Integrations site