Skip to content

Commit

Permalink
Merge 4806f12 into e1f9d66
Browse files Browse the repository at this point in the history
  • Loading branch information
bennypowers authored Oct 9, 2024
2 parents e1f9d66 + 4806f12 commit e4d73d6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 35 deletions.
6 changes: 6 additions & 0 deletions .changeset/few-pumpkins-sit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@patternfly/pfe-tools": patch
"@patternfly/pfe-core": patch
---

SSR: add shim for `ResizeObserver`
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
- name: Configure node version
uses: actions/setup-node@v4
with:
node-version: '20'
node-version-file: '.nvmrc'
cache: npm

- name: Install dependencies
Expand All @@ -100,7 +100,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
node-version-file: '.nvmrc'
cache: npm
- run: npm ci --prefer-offline
- run: npm run build
Expand All @@ -110,7 +110,7 @@ jobs:
env:
HOME: /root

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ env.PLAYWRIGHT_REPORT_DIR }}
Expand All @@ -130,7 +130,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Download zipped HTML report
uses: actions/download-artifact@v4.1.7
uses: actions/download-artifact@v4
with:
name: ${{ env.PLAYWRIGHT_REPORT_DIR }}
path: ${{ env.PLAYWRIGHT_REPORT_DIR }}/
Expand Down
2 changes: 2 additions & 0 deletions core/pfe-core/ssr-shims.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ globalThis.IntersectionObserver ??= ObserverShim;
// @ts-expect-error: this runs in node
globalThis.MutationObserver ??= ObserverShim;
// @ts-expect-error: this runs in node
globalThis.ResizeObserver ??= ObserverShim;
// @ts-expect-error: this runs in node
globalThis.getComputedStyle ??= function() {
return {
getPropertyPriority() {
Expand Down
3 changes: 2 additions & 1 deletion tools/pfe-tools/ssr/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export async function renderGlobal(
html: string,
importSpecifiers: string[],
): Promise<string> {
await import('./shims.js');
// avoid tsconfig problems
await import(['@patternfly', 'pfe-core', 'ssr-shims.js'].join('/'));
const { ssr } = await import('./ssr.js');
await Promise.all(importSpecifiers.map(x => import(x)));
return ssr(html);
Expand Down
30 changes: 0 additions & 30 deletions tools/pfe-tools/ssr/shims.ts

This file was deleted.

0 comments on commit e4d73d6

Please sign in to comment.