Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
},
"dependencies": {
"@floating-ui/dom": "1.6.13",
"adopted-style-sheets": "1.1.9-rc.17",
"adopted-style-sheets": "1.1.9-rc.18",
"clsx": "2.1.1",
"color-convert": "2.0.1",
"color-rgba": "2.4.0",
Expand Down Expand Up @@ -136,7 +136,7 @@
"typescript": "5.8.2"
},
"peerDependencies": {
"adopted-style-sheets": "1.1.9-rc.17"
"adopted-style-sheets": "1.1.9-rc.18"
},
"files": [
"assets",
Expand Down
2 changes: 1 addition & 1 deletion packages/samples/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@angular/compiler-cli": "17.3.12",
"@types/jasmine": "5.1.8",
"@tailwindcss/postcss": "4.1.8",
"adopted-style-sheets": "1.1.9-rc.17",
"adopted-style-sheets": "1.1.9-rc.18",
"cpy-cli": "5.0.0",
"karma-jasmine": "5.1.0",
"karma-chrome-launcher": "3.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/samples/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@typescript-eslint/parser": "8.27.0",
"@unocss/preset-uno": "0.58.9",
"@unocss/webpack": "0.58.9",
"adopted-style-sheets": "1.1.9-rc.17",
"adopted-style-sheets": "1.1.9-rc.18",
"ajv": "8.17.1",
"chromedriver": "130.0.4",
"cpy-cli": "5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/tools/benchmark-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@playwright/test": "1.49.1",
"@public-ui/components": "workspace:*",
"@public-ui/theme-default": "workspace:*",
"adopted-style-sheets": "1.1.9-rc.17",
"adopted-style-sheets": "1.1.9-rc.18",
"cpy-cli": "5.0.0",
"knip": "5.46.0",
"npm-run-all2": "8.0.4",
Expand Down
10 changes: 5 additions & 5 deletions packages/tools/benchmark-tests/scripts/compare-benchmark.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { existsSync, readFileSync, writeFileSync } from 'node:fs';

const loadJson = (path) => (existsSync(path) ? JSON.parse(readFileSync(path, 'utf-8')) : []);

const current = loadJson('benchmark-result.json');
const baseline = loadJson('benchmark-baseline.json');
const current = loadJson(`benchmark-result.json`);
const baseline = loadJson(`benchmark-baseline.json`);

const rows = [];
let hasRegression = false;
Expand Down Expand Up @@ -59,10 +59,10 @@ markdown += `|-----------|---------|----------|-----|--------|\n`;
markdown += rest.map((r) => r.markdown).join('\n') + '\n';
markdown += `</details>\n`;

writeFileSync('benchmark-report.md', markdown);
writeFileSync(`benchmark-report.md`, markdown);

if (hasRegression) {
console.error('❌ Performance regression detected.');
console.warn(`❌ Performance regression detected.`);
} else {
console.log('✅ No significant regression.');
console.log(`✅ No significant regression.`);
}
51 changes: 31 additions & 20 deletions packages/tools/benchmark-tests/tests/benchmark.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,28 +65,35 @@ const TEST_TIMEOUT = parseInt(process.env.TEST_TIMEOUT || '5000', 10);

test.beforeEach(async ({ page }) => {
await page.goto('http://localhost:3000/test-page.html');
await page.waitForLoadState('networkidle');
});

for (const tag of TAGS) {
for (let idx = 0; idx < TEST_ITERATIONS; idx++) {
test(`${tag} hydration iteration ${idx + 1}`, async ({ page }) => {
await page.evaluate(() => window.gc?.());

const duration = await page.evaluate(
async ({ tag, timeout, idx }) => {
test(`${tag} hydration (${idx + 1})`, async ({ page }) => {
const { hydratedTime } = await page.evaluate(
async ({ tag, timeout }) => {
window.gc?.();
await customElements.whenDefined(tag);

const el = document.createElement(tag);
el.setAttribute('data-test', `hydration-${idx}`);
const start = performance.now();
document.body.appendChild(el);
const start = performance.now();
let hydratedTime: number | null = null;
let themedTime: number | null = null;

await new Promise<void>((resolve) => {
let cleaned = false;

const timeoutId = setTimeout(cleanup, timeout);

const observer = new MutationObserver(() => {
if (el.classList.contains('hydrated')) cleanup();
if (!hydratedTime && el.classList.contains('hydrated')) {
hydratedTime = performance.now() - start;
}
if (hydratedTime && el.hasAttribute('data-themed')) {
themedTime = performance.now() - hydratedTime;
cleanup();
}
});

function cleanup() {
Expand All @@ -100,24 +107,28 @@ for (const tag of TAGS) {

observer.observe(el, {
attributes: true,
attributeFilter: ['class'],
attributeFilter: ['class', 'data-themed'],
});
});

const end = performance.now();
return end - start;
return {
hydratedTime,
themedTime,
};
},
{ tag, timeout: TEST_TIMEOUT, idx },
{ tag, timeout: TEST_TIMEOUT },
);

if (!results.has(tag)) {
results.set(tag, {
name: tag,
values: [],
unit: 'ms',
});
if (hydratedTime !== null) {
if (!results.has(tag)) {
results.set(tag, {
name: tag,
values: [],
unit: 'ms',
});
}
results.get(tag)!.values.push(Math.round(hydratedTime));
}
results.get(tag)!.values.push(Math.round(duration));
});
}
}
Expand Down
22 changes: 11 additions & 11 deletions pnpm-lock.yaml

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

Loading