runtime-with-compiler.ts — vue Source File
Architecture documentation for runtime-with-compiler.ts, a typescript file in the vue codebase. 10 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR 04498845_3cc1_e86f_9070_0c7b23b88f7c["runtime-with-compiler.ts"] 741f07d4_91fb_0d2e_19fb_525f8624bea6["index.ts"] 04498845_3cc1_e86f_9070_0c7b23b88f7c --> 741f07d4_91fb_0d2e_19fb_525f8624bea6 568fc8c2_8a29_0e8e_a20a_4478e7270dd9["index.ts"] 04498845_3cc1_e86f_9070_0c7b23b88f7c --> 568fc8c2_8a29_0e8e_a20a_4478e7270dd9 994de652_da67_08a8_e9e9_9557640163bd["query"] 04498845_3cc1_e86f_9070_0c7b23b88f7c --> 994de652_da67_08a8_e9e9_9557640163bd 83b54a97_3eec_287c_ac2b_9c9d7158daca["index.ts"] 04498845_3cc1_e86f_9070_0c7b23b88f7c --> 83b54a97_3eec_287c_ac2b_9c9d7158daca 9fd6b02d_5cf9_77f2_70a2_65f3e9ed4399["compat.ts"] 04498845_3cc1_e86f_9070_0c7b23b88f7c --> 9fd6b02d_5cf9_77f2_70a2_65f3e9ed4399 a9349ba5_bc74_f03e_b748_41eb2dcc87a9["config"] 04498845_3cc1_e86f_9070_0c7b23b88f7c --> a9349ba5_bc74_f03e_b748_41eb2dcc87a9 90a2398a_1498_3263_c62e_0c064dd2c9b3["index"] 04498845_3cc1_e86f_9070_0c7b23b88f7c --> 90a2398a_1498_3263_c62e_0c064dd2c9b3 eb79c621_fd92_faee_8a07_bb0bd657e7fb["perf"] 04498845_3cc1_e86f_9070_0c7b23b88f7c --> eb79c621_fd92_faee_8a07_bb0bd657e7fb 64c87498_c46a_6944_ab9d_8e45519852a8["component"] 04498845_3cc1_e86f_9070_0c7b23b88f7c --> 64c87498_c46a_6944_ab9d_8e45519852a8 e113c728_56e1_b7c8_935f_f89af3e6c5fc["global-api"] 04498845_3cc1_e86f_9070_0c7b23b88f7c --> e113c728_56e1_b7c8_935f_f89af3e6c5fc b26c17f3_8547_1731_ce79_2f4d6ec8917d["entry-runtime-with-compiler-esm.ts"] b26c17f3_8547_1731_ce79_2f4d6ec8917d --> 04498845_3cc1_e86f_9070_0c7b23b88f7c 139b6fed_11e8_7cc9_500e_166cbf1b1202["entry-runtime-with-compiler.ts"] 139b6fed_11e8_7cc9_500e_166cbf1b1202 --> 04498845_3cc1_e86f_9070_0c7b23b88f7c style 04498845_3cc1_e86f_9070_0c7b23b88f7c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import config from 'core/config'
import { warn, cached } from 'core/util/index'
import { mark, measure } from 'core/util/perf'
import Vue from './runtime/index'
import { query } from './util/index'
import { compileToFunctions } from './compiler/index'
import {
shouldDecodeNewlines,
shouldDecodeNewlinesForHref
} from './util/compat'
import type { Component } from 'types/component'
import type { GlobalAPI } from 'types/global-api'
const idToTemplate = cached(id => {
const el = query(id)
return el && el.innerHTML
})
const mount = Vue.prototype.$mount
Vue.prototype.$mount = function (
el?: string | Element,
hydrating?: boolean
): Component {
el = el && query(el)
/* istanbul ignore if */
if (el === document.body || el === document.documentElement) {
__DEV__ &&
warn(
`Do not mount Vue to <html> or <body> - mount to normal elements instead.`
)
return this
}
const options = this.$options
// resolve template/el and convert to render function
if (!options.render) {
let template = options.template
if (template) {
if (typeof template === 'string') {
if (template.charAt(0) === '#') {
template = idToTemplate(template)
/* istanbul ignore if */
if (__DEV__ && !template) {
warn(
`Template element not found or is empty: ${options.template}`,
this
)
}
}
} else if (template.nodeType) {
template = template.innerHTML
} else {
if (__DEV__) {
warn('invalid template option:' + template, this)
}
return this
}
} else if (el) {
// @ts-expect-error
template = getOuterHTML(el)
}
if (template) {
/* istanbul ignore if */
if (__DEV__ && config.performance && mark) {
mark('compile')
}
const { render, staticRenderFns } = compileToFunctions(
template,
{
outputSourceRange: __DEV__,
shouldDecodeNewlines,
shouldDecodeNewlinesForHref,
delimiters: options.delimiters,
comments: options.comments
},
this
)
options.render = render
options.staticRenderFns = staticRenderFns
/* istanbul ignore if */
if (__DEV__ && config.performance && mark) {
mark('compile end')
measure(`vue ${this._name} compile`, 'compile', 'compile end')
}
}
}
return mount.call(this, el, hydrating)
}
/**
* Get outerHTML of elements, taking care
* of SVG elements in IE as well.
*/
function getOuterHTML(el: Element): string {
if (el.outerHTML) {
return el.outerHTML
} else {
const container = document.createElement('div')
container.appendChild(el.cloneNode(true))
return container.innerHTML
}
}
Vue.compile = compileToFunctions
export default Vue as GlobalAPI
Domain
Subdomains
Functions
Imported By
Source
Frequently Asked Questions
What does runtime-with-compiler.ts do?
runtime-with-compiler.ts is a source file in the vue codebase, written in typescript. It belongs to the WebPlatform domain, WebCompiler subdomain.
What functions are defined in runtime-with-compiler.ts?
runtime-with-compiler.ts defines 3 function(s): $mount, getOuterHTML, idToTemplate.
What does runtime-with-compiler.ts depend on?
runtime-with-compiler.ts imports 10 module(s): compat.ts, component, config, global-api, index, index.ts, index.ts, index.ts, and 2 more.
What files import runtime-with-compiler.ts?
runtime-with-compiler.ts is imported by 2 file(s): entry-runtime-with-compiler-esm.ts, entry-runtime-with-compiler.ts.
Where is runtime-with-compiler.ts in the architecture?
runtime-with-compiler.ts is located at src/platforms/web/runtime-with-compiler.ts (domain: WebPlatform, subdomain: WebCompiler, directory: src/platforms/web).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free