Open History to see the last commit
1import type { Awaitable } from '@tanstack/router-core'
2β
3export type HandlerInlineCssOption =
4 | boolean
5 | ((ctx: { request: Request }) => Awaitable<boolean>)
6β
7export function getStaticHandlerInlineCssDefault(
8 handlerInlineCss: HandlerInlineCssOption | undefined,
9) {
10 if (typeof handlerInlineCss === 'function') {
11 return undefined
12 }
13β
14 return handlerInlineCss ?? true
15}
16β
17export async function resolveInlineCssForRequest(opts: {
18 request: Request
19 handlerInlineCss: HandlerInlineCssOption | undefined
20 requestInlineCss: boolean | undefined
21}) {
22 if (opts.requestInlineCss !== undefined) {
23 return opts.requestInlineCss
24 }
25β
26 if (typeof opts.handlerInlineCss === 'function') {
27 return await opts.handlerInlineCss({ request: opts.request })
28 }
29β
30 return opts.handlerInlineCss ?? true
31}