MCPcopy
hub / github.com/vitejs/vite / serializeTag

Function serializeTag

packages/vite/src/node/plugins/html.ts:1614–1626  ·  view source on GitHub ↗
(
  { tag, attrs, children }: HtmlTagDescriptor,
  indent: string = '',
)

Source from the content-addressed store, hash-verified

1612const unaryTags = new Set(['link', 'meta', 'base'])
1613
1614function serializeTag(
1615 { tag, attrs, children }: HtmlTagDescriptor,
1616 indent: string = '',
1617): string {
1618 if (unaryTags.has(tag)) {
1619 return `<${tag}${serializeAttrs(attrs)}>`
1620 } else {
1621 return `<${tag}${serializeAttrs(attrs)}>${serializeTags(
1622 children,
1623 incrementIndent(indent),
1624 )}</${tag}>`
1625 }
1626}
1627
1628function serializeTags(
1629 tags: HtmlTagDescriptor['children'],

Callers 2

postImportMapHookFunction · 0.85
serializeTagsFunction · 0.85

Calls 4

serializeAttrsFunction · 0.85
serializeTagsFunction · 0.85
incrementIndentFunction · 0.85
hasMethod · 0.80

Tested by

no test coverage detected