MCPcopy Create free account
hub / github.com/formkit/formkit / extractThemeData

Function extractThemeData

packages/cli/src/theme.ts:615–637  ·  view source on GitHub ↗
(
  theme: string
)

Source from the content-addressed store, hash-verified

613}
614
615export function extractThemeData(
616 theme: string
617): [string, string, string] | never {
618 const checksumStart = theme.indexOf('@checksum -')
619 const variablesStart = theme.indexOf('@variables -')
620 const themeStart = theme.indexOf('@theme -')
621 if (checksumStart === -1 || variablesStart === -1 || themeStart === -1) {
622 throw new Error('Unable to find checksum in theme file.')
623 }
624 const checksum = theme.substring(
625 checksumStart + 12,
626 theme.indexOf('\n', checksumStart)
627 ) as string
628 const variables = theme.substring(
629 variablesStart + 13,
630 theme.indexOf('\n', variablesStart)
631 ) as string
632 const themeName = theme.substring(
633 themeStart + 9,
634 theme.indexOf('\n', themeStart)
635 ) as string
636 return [checksum, variables, themeName]
637}
638
639async function apiTheme(
640 themeName: string,

Callers 2

cli.spec.tsFile · 0.90
buildThemeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected