parse() — vue Function Reference
Architecture documentation for the parse() function in index.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD e259ff52_42a6_4f54_59b8_e6bf86822027["parse()"] 320ee0f4_351d_a6b2_1c1c_f0f6f42fb987["index.ts"] e259ff52_42a6_4f54_59b8_e6bf86822027 -->|defined in| 320ee0f4_351d_a6b2_1c1c_f0f6f42fb987 ce8f29ab_2e8d_1891_6184_d7dbc32fae79["createCompiler()"] ce8f29ab_2e8d_1891_6184_d7dbc32fae79 -->|calls| e259ff52_42a6_4f54_59b8_e6bf86822027 3797286c_ee34_d7d3_7d84_b3bd41e06eaf["pluckModuleFunction()"] e259ff52_42a6_4f54_59b8_e6bf86822027 -->|calls| 3797286c_ee34_d7d3_7d84_b3bd41e06eaf d580ca1c_dbf7_89f2_e0e4_6199ea988b51["processElement()"] e259ff52_42a6_4f54_59b8_e6bf86822027 -->|calls| d580ca1c_dbf7_89f2_e0e4_6199ea988b51 b65ea7e3_9ebe_bd4b_239f_5933a2978e29["addIfCondition()"] e259ff52_42a6_4f54_59b8_e6bf86822027 -->|calls| b65ea7e3_9ebe_bd4b_239f_5933a2978e29 c4a8d310_d6a7_9547_ac2d_d9c02e047c9f["processIfConditions()"] e259ff52_42a6_4f54_59b8_e6bf86822027 -->|calls| c4a8d310_d6a7_9547_ac2d_d9c02e047c9f eb4d93e9_e98e_e100_79fc_397c66cc84c1["parseHTML()"] e259ff52_42a6_4f54_59b8_e6bf86822027 -->|calls| eb4d93e9_e98e_e100_79fc_397c66cc84c1 dcfbf83c_5d79_a37c_0351_f5bb6b630a44["guardIESVGBug()"] e259ff52_42a6_4f54_59b8_e6bf86822027 -->|calls| dcfbf83c_5d79_a37c_0351_f5bb6b630a44 fc56981f_9001_955c_5e6d_6ea55122787e["createASTElement()"] e259ff52_42a6_4f54_59b8_e6bf86822027 -->|calls| fc56981f_9001_955c_5e6d_6ea55122787e 18adb44d_648b_d513_56c9_2d61b8e35613["isForbiddenTag()"] e259ff52_42a6_4f54_59b8_e6bf86822027 -->|calls| 18adb44d_648b_d513_56c9_2d61b8e35613 0e5568de_5e18_4188_9e2e_0dddf2031e4a["processPre()"] e259ff52_42a6_4f54_59b8_e6bf86822027 -->|calls| 0e5568de_5e18_4188_9e2e_0dddf2031e4a 4d46d682_a9d9_8463_d226_e677b0213b53["processRawAttrs()"] e259ff52_42a6_4f54_59b8_e6bf86822027 -->|calls| 4d46d682_a9d9_8463_d226_e677b0213b53 bf06702a_d674_3a95_d692_cb135366576f["processFor()"] e259ff52_42a6_4f54_59b8_e6bf86822027 -->|calls| bf06702a_d674_3a95_d692_cb135366576f 4f6c2ee8_2eba_72b6_6eac_1da03cd06187["processIf()"] e259ff52_42a6_4f54_59b8_e6bf86822027 -->|calls| 4f6c2ee8_2eba_72b6_6eac_1da03cd06187 style e259ff52_42a6_4f54_59b8_e6bf86822027 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/compiler/parser/index.ts lines 86–422
export function parse(template: string, options: CompilerOptions): ASTElement {
warn = options.warn || baseWarn
platformIsPreTag = options.isPreTag || no
platformMustUseProp = options.mustUseProp || no
platformGetTagNamespace = options.getTagNamespace || no
const isReservedTag = options.isReservedTag || no
maybeComponent = (el: ASTElement) =>
!!(
el.component ||
el.attrsMap[':is'] ||
el.attrsMap['v-bind:is'] ||
!(el.attrsMap.is ? isReservedTag(el.attrsMap.is) : isReservedTag(el.tag))
)
transforms = pluckModuleFunction(options.modules, 'transformNode')
preTransforms = pluckModuleFunction(options.modules, 'preTransformNode')
postTransforms = pluckModuleFunction(options.modules, 'postTransformNode')
delimiters = options.delimiters
const stack: any[] = []
const preserveWhitespace = options.preserveWhitespace !== false
const whitespaceOption = options.whitespace
let root
let currentParent
let inVPre = false
let inPre = false
let warned = false
function warnOnce(msg, range) {
if (!warned) {
warned = true
warn(msg, range)
}
}
function closeElement(element) {
trimEndingWhitespace(element)
if (!inVPre && !element.processed) {
element = processElement(element, options)
}
// tree management
if (!stack.length && element !== root) {
// allow root elements with v-if, v-else-if and v-else
if (root.if && (element.elseif || element.else)) {
if (__DEV__) {
checkRootConstraints(element)
}
addIfCondition(root, {
exp: element.elseif,
block: element
})
} else if (__DEV__) {
warnOnce(
`Component template should contain exactly one root element. ` +
`If you are using v-if on multiple elements, ` +
`use v-else-if to chain them instead.`,
{ start: element.start }
)
}
}
if (currentParent && !element.forbidden) {
if (element.elseif || element.else) {
processIfConditions(element, currentParent)
} else {
if (element.slotScope) {
// scoped slot
// keep it in the children list so that v-else(-if) conditions can
// find it as the prev node.
const name = element.slotTarget || '"default"'
;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[
name
] = element
}
currentParent.children.push(element)
element.parent = currentParent
}
}
// final children cleanup
// filter out scoped slots
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does parse() do?
parse() is a function in the vue codebase, defined in src/compiler/parser/index.ts.
Where is parse() defined?
parse() is defined in src/compiler/parser/index.ts at line 86.
What does parse() call?
parse() calls 15 function(s): addIfCondition, createASTElement, guardIESVGBug, isForbiddenTag, isTextTag, parseHTML, parseText, pluckModuleFunction, and 7 more.
What calls parse()?
parse() is called by 1 function(s): createCompiler.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free