// @requirements REQ-PRODUCT-BUNDLE-BUDGET
// An explicit maintainer build: synthetic inputs and local package bundles only.
import {mkdir,writeFile,copyFile} from 'node:fs/promises';
import {build} from 'esbuild';
import {fileURLToPath} from 'node:url';
import {performanceInventories} from './performance-inventories.mjs';
const output=new URL('../.local/consent-performance-fixture/',import.meta.url);
await mkdir(output,{recursive:true});
await writeFile(new URL('inventories.json',output),JSON.stringify(await performanceInventories()));
await copyFile(new URL('consent-performance.mjs',import.meta.url),new URL('measure.mjs',output));
await copyFile(new URL('../packages/notabenda/dist/consent.css',import.meta.url),new URL('consent.css',output));
for(const [name,entry,factory] of [['compiled-local','@notabenda/core/consent','createConsentRuntime'],['compatibility','@notabenda/core/consent/compat','createCompatibilityConsent']])await build({stdin:{contents:`export {${factory} as create} from '${entry}';export {mountControls} from '@notabenda/core';`,resolveDir:fileURLToPath(new URL('../',import.meta.url))},bundle:true,minify:true,platform:'browser',format:'esm',target:'es2022',outfile:fileURLToPath(new URL(name+'.mjs',output)),logLevel:'silent'});
await copyFile(new URL('performance-browser-app.mjs',import.meta.url),new URL('app.mjs',output));
await writeFile(new URL('index.html',output),`
Consent performance · Notabenda
Maintainer tools / Local measurement
Consent performance
Compare fresh and returning controller setup, granted snapshot reads and synchronous choice calls at three inventory sizes. The mounted runs use the actual native controls. All service starts and storage are synthetic; nothing is sent to a provider.
Ready. No measurements run yet.
Results
Median milliseconds. Expand the raw report for sample distributions, p95 values and limits. No timing pass/fail threshold is applied.
Local-only profiles · each service belongs to one of the declared purposes
Profile / purposes / services
Fresh setup
Returning setup
Snapshot
Reject call
Grant call
Mount once
Mounted controls
The measurement surface is contained here. This measures synchronous DOM work, not paint, input delay or INP. Module loading and build-time compilation are excluded.
Raw report
No report yet.
`);
console.log('Built .local/consent-performance-fixture. Run npm run perf:serve for local browser measurements.');