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

Function headTagInsertCheck

packages/vite/src/node/plugins/html.ts:1419–1441  ·  view source on GitHub ↗
(
  tags: HtmlTagDescriptor[],
  ctx: IndexHtmlTransformContext,
)

Source from the content-addressed store, hash-verified

1417])
1418
1419function headTagInsertCheck(
1420 tags: HtmlTagDescriptor[],
1421 ctx: IndexHtmlTransformContext,
1422) {
1423 if (!tags.length) return
1424 const { logger } = ctx.server?.config || {}
1425 const disallowedTags = tags.filter(
1426 (tagDescriptor) => !elementsAllowedInHead.has(tagDescriptor.tag),
1427 )
1428
1429 if (disallowedTags.length) {
1430 const dedupedTags = unique(
1431 disallowedTags.map((tagDescriptor) => `<${tagDescriptor.tag}>`),
1432 )
1433 logger?.warn(
1434 colors.yellow(
1435 colors.bold(
1436 `[${dedupedTags.join(',')}] can not be used inside the <head> Element, please check the 'injectTo' value`,
1437 ),
1438 ),
1439 )
1440 }
1441}
1442
1443export async function applyHtmlTransforms(
1444 html: string,

Callers 1

applyHtmlTransformsFunction · 0.85

Calls 3

uniqueFunction · 0.90
hasMethod · 0.80
warnMethod · 0.65

Tested by

no test coverage detected