MCPcopy
hub / github.com/vuejs/core / parseWithSlots

Function parseWithSlots

packages/compiler-core/__tests__/transforms/vSlot.spec.ts:33–66  ·  view source on GitHub ↗
(
  template: string,
  options: CompilerOptions & { transformText?: boolean } = {},
)

Source from the content-addressed store, hash-verified

31import { transformText } from '../../src/transforms/transformText'
32
33function parseWithSlots(
34 template: string,
35 options: CompilerOptions & { transformText?: boolean } = {},
36) {
37 const ast = parse(template, {
38 whitespace: options.whitespace,
39 })
40 transform(ast, {
41 nodeTransforms: [
42 transformIf,
43 transformFor,
44 ...(options.prefixIdentifiers
45 ? [trackVForSlotScopes, transformExpression]
46 : []),
47 transformSlotOutlet,
48 transformElement,
49 trackSlotScopes,
50 ...(options.transformText ? [transformText] : []),
51 ],
52 directiveTransforms: {
53 on: transformOn,
54 bind: transformBind,
55 },
56 ...options,
57 })
58 return {
59 root: ast,
60 slots:
61 ast.children[0].type === NodeTypes.ELEMENT
62 ? ((ast.children[0].codegenNode as VNodeCall)
63 .children as SlotsExpression)
64 : null,
65 }
66}
67
68function createSlotMatcher(obj: Record<string, any>, isDynamic = false) {
69 return {

Callers 2

vSlot.spec.tsFile · 0.70
assertDynamicSlotsFunction · 0.70

Calls 2

transformFunction · 0.90
parseFunction · 0.50

Tested by

no test coverage detected