Skip to content

Commit

Permalink
refactor(preact): Drop preact-ssr-prepass in favor of `renderToStri…
Browse files Browse the repository at this point in the history
…ngAsync` (#11464)
  • Loading branch information
rschristian authored Jul 17, 2024
1 parent 3f4735e commit 2cdb685
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 38 deletions.
5 changes: 5 additions & 0 deletions .changeset/few-candles-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/preact': patch
---

Swap out `preact-ssr-prepass` for `renderToStringAsync` from `preact-render-to-string`
3 changes: 1 addition & 2 deletions packages/integrations/preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
"@preact/preset-vite": "2.8.2",
"@preact/signals": "^1.3.0",
"babel-plugin-transform-hook-names": "^1.0.2",
"preact-render-to-string": "~6.3.1",
"preact-ssr-prepass": "^1.2.2"
"preact-render-to-string": "^6.5.5"
},
"devDependencies": {
"astro": "workspace:*",
Expand Down
6 changes: 2 additions & 4 deletions packages/integrations/preact/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { AstroComponentMetadata, NamedSSRLoadedRendererValue } from 'astro';
import { Component as BaseComponent, type VNode, h } from 'preact';
import { render } from 'preact-render-to-string';
import prepass from 'preact-ssr-prepass';
import { renderToStringAsync } from 'preact-render-to-string';
import { getContext } from './context.js';
import { restoreSignalsOnProps, serializeSignals } from './signals.js';
import StaticHtml from './static-html.js';
Expand Down Expand Up @@ -89,8 +88,7 @@ async function renderToStaticMarkup(
: children
);

await prepass(vNode);
const html = render(vNode);
const html = await renderToStringAsync(vNode);
return { attrs, html };
}

Expand Down
37 changes: 5 additions & 32 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2cdb685

Please sign in to comment.