Files
analytics/rollup.recorder.config.js
zeekay 04314dabdc Serve every route under /v1
The route tree moves from src/app/api to src/app/v1, and every caller
moves with it: the dashboard's useApi base, the tracker and recorder
collect paths, the Next headers and rewrites, the container middleware,
the compose healthchecks and the Cypress API tests. The /v1/analytics
alias is gone; /v1 is the one prefix. The build-time telemetry post to
an upstream endpoint nothing serves is deleted.

v1-surface.test.ts fails if src/app/api returns or any first-party file
names an /api/ path.

Claude-Session: https://claude.ai/code/session_011i2AG9nwpiKUCVxAdDzYuU
2026-09-29 18:41:04 -07:00

31 lines
1.1 KiB
JavaScript

import 'dotenv/config';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import replace from '@rollup/plugin-replace';
import terser from '@rollup/plugin-terser';
export default {
input: 'src/recorder/index.js',
output: {
file: 'public/recorder.js',
format: 'iife',
},
plugins: [
resolve({ browser: true }),
commonjs(),
replace({
__COLLECT_API_HOST__: process.env.COLLECT_API_HOST || '',
// Replay rides the SAME collector as the tracker with type:'record'. A chunk is
// keyed to the session and visit, and the cache-token resolution that produces
// them lives in /v1/send.
// A separate collector would need its own copy of that, plus the website lookup
// and the disabled check, and any drift between the two copies would silently
// orphan replays from the sessions they belong to.
__COLLECT_REPLAY_ENDPOINT__: process.env.COLLECT_REPLAY_ENDPOINT || '/v1/send',
delimiters: ['', ''],
preventAssignment: true,
}),
terser({ compress: { evaluate: false } }),
],
};