MCPcopy Create free account
hub / github.com/ecomfe/tempad-dev / stringifyComponent

Function stringifyComponent

packages/extension/utils/component.ts:171–188  ·  view source on GitHub ↗
(
  component: DevComponent,
  optionsOrLang: SupportedLang | StringifyOptions
)

Source from the content-addressed store, hash-verified

169}
170
171export function stringifyComponent(
172 component: DevComponent,
173 optionsOrLang: SupportedLang | StringifyOptions
174): string {
175 const options: StringifyOptions =
176 typeof optionsOrLang === 'string' ? { lang: optionsOrLang } : optionsOrLang
177
178 switch (options.lang) {
179 case 'vue': {
180 return stringifyVueComponent(component, 0, options.isInline)
181 }
182 case 'jsx':
183 case 'tsx':
184 default: {
185 return stringifyJSXComponent(component, 0, options.isInline)
186 }
187 }
188}
189
190const INDENT_UNIT = ' '
191

Callers 7

component.test.tsFile · 0.90
svg.test.tsFile · 0.90
shell.test.tsFile · 0.90
normalizeRootStringFunction · 0.90
stringifyComponentTreeFunction · 0.90
worker.tsFile · 0.90
serializeComponentFunction · 0.85

Calls 2

stringifyVueComponentFunction · 0.85
stringifyJSXComponentFunction · 0.85

Tested by

no test coverage detected