chore(usercontent): drop the unused theme stylesheet route and helper
Why
injectStylesheetLink and the /_superset/theme.css route it was written for have no callers. #7312 landed page theming by inlining the CSS with injectStyleTag instead, and nothing has linked the stylesheet since. The route served bytes no page ever asked for, and the helper carried ~20 tests for a code path that never ran.
Checked before removing: nothing in apps/ or packages/ references either symbol, and the path isn't documented anywhere for page authors.
The tests are retargeted, not deleted
injectStylesheetLink's suite was the only real coverage of injectIntoHead — head with attributes, a > inside a quoted attribute, a head inside a comment, a script or a style, <header> false positives, doctype fallbacks, a 2000-script-block document. injectStyleTag shares that helper and uses it to put the theme on every published page, so deleting the suite would have dropped regression cover for code that still runs — including the case 6859ee629 was written to fix.
They now exercise injectStyleTag, and the two thinner injectStyleTag cases are folded in. One assertion needed a real change: "stays ahead of the page's own styles" compared against indexOf("<style>"), which now matches the injected tag, so it targets the page's own CSS instead.
Verification
bun test src/usercontent/inject.test.ts— 18 pass, 0 failtypecheckclean forapps/usercontent,lintclean at root- No behaviour change: no page links the stylesheet, so nothing 404s
https://claude.ai/code/session_01Ho5jMfrUs1e65svM8M2Hc6
Summary by cubic
Removes the unused theme stylesheet route and injectStylesheetLink helper; no page ever requested the CSS since theming was inlined via injectStyleTag, so the route and helper served no purpose. The tests previously covering injectStylesheetLink now exercise injectStyleTag's shared injectIntoHead logic, so regression coverage is preserved without any behavior change.
Summary by CodeRabbit
- Changes
- Removed the dedicated theme stylesheet endpoint.
- Removed automatic external stylesheet link injection.
- Inline style injection remains available for supported content.
- Tests
- Expanded coverage for inline style insertion across varied document structures, including comments, scripts, attributes, headers, doctypes, and documents with multiple script blocks.