stylesheetRegistration
What a stylesheet's module says as it loads in an app's build: the file it's served as, by its content (or the
stand-in it has instead), for the react library's <Stylesheet> (the stylesheet role) to link to. fromPage: the file is the one the page
names for asset (__TCM_STYLESHEET_FILES__, which the build writes into it), so the module doesn't change
when the stylesheet does.
export function stylesheetRegistration(id: string, asset: string, fromPage = false): string { const file = fromPage ? `(globalThis as { __TCM_STYLESHEET_FILES__?: Record<string, string> }).__TCM_STYLESHEET_FILES__?.[${JSON.stringify(asset)}] ?? ""` : JSON.stringify(asset); return `\n((globalThis as { __TCM_STYLESHEETS__?: Map<string, string> }).__TCM_STYLESHEETS__ ??= new Map()).set(${id}, ${file});\n`; }