create-compiler.ts — vue Source File
Architecture documentation for create-compiler.ts, a typescript file in the vue codebase. 6 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR ff1da07c_8f38_b75f_ad5a_42883a44a3df["create-compiler.ts"] 082d4686_2778_e118_a80c_c4ffc89177dc["error-detector.ts"] ff1da07c_8f38_b75f_ad5a_42883a44a3df --> 082d4686_2778_e118_a80c_c4ffc89177dc e66ee5bd_47db_4014_39bb_43bc88cdcf05["detectErrors"] ff1da07c_8f38_b75f_ad5a_42883a44a3df --> e66ee5bd_47db_4014_39bb_43bc88cdcf05 fce21fb3_1100_1200_4d40_dbc0f8981911["to-function.ts"] ff1da07c_8f38_b75f_ad5a_42883a44a3df --> fce21fb3_1100_1200_4d40_dbc0f8981911 de1bc371_80db_723d_3fc8_276c93f033c1["createCompileToFunctionFn"] ff1da07c_8f38_b75f_ad5a_42883a44a3df --> de1bc371_80db_723d_3fc8_276c93f033c1 09aa5370_2caa_6b33_3f44_6ac5211bd11b["util"] ff1da07c_8f38_b75f_ad5a_42883a44a3df --> 09aa5370_2caa_6b33_3f44_6ac5211bd11b a80b8e3b_d720_9146_3bf6_594d4ee5dd77["compiler"] ff1da07c_8f38_b75f_ad5a_42883a44a3df --> a80b8e3b_d720_9146_3bf6_594d4ee5dd77 b5f71c2e_6baa_62e4_4167_0496c4d6e540["index.ts"] b5f71c2e_6baa_62e4_4167_0496c4d6e540 --> ff1da07c_8f38_b75f_ad5a_42883a44a3df style ff1da07c_8f38_b75f_ad5a_42883a44a3df fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { extend } from 'shared/util'
import { CompilerOptions, CompiledResult, WarningMessage } from 'types/compiler'
import { detectErrors } from './error-detector'
import { createCompileToFunctionFn } from './to-function'
export function createCompilerCreator(baseCompile: Function): Function {
return function createCompiler(baseOptions: CompilerOptions) {
function compile(
template: string,
options?: CompilerOptions
): CompiledResult {
const finalOptions = Object.create(baseOptions)
const errors: WarningMessage[] = []
const tips: WarningMessage[] = []
let warn = (
msg: WarningMessage,
range: { start: number; end: number },
tip: string
) => {
;(tip ? tips : errors).push(msg)
}
if (options) {
if (__DEV__ && options.outputSourceRange) {
// $flow-disable-line
const leadingSpaceLength = template.match(/^\s*/)![0].length
warn = (
msg: WarningMessage | string,
range: { start: number; end: number },
tip: string
) => {
const data: WarningMessage = typeof msg === 'string' ? { msg } : msg
if (range) {
if (range.start != null) {
data.start = range.start + leadingSpaceLength
}
if (range.end != null) {
data.end = range.end + leadingSpaceLength
}
}
;(tip ? tips : errors).push(data)
}
}
// merge custom modules
if (options.modules) {
finalOptions.modules = (baseOptions.modules || []).concat(
options.modules
)
}
// merge custom directives
if (options.directives) {
finalOptions.directives = extend(
Object.create(baseOptions.directives || null),
options.directives
)
}
// copy other options
for (const key in options) {
if (key !== 'modules' && key !== 'directives') {
finalOptions[key] = options[key as keyof CompilerOptions]
}
}
}
finalOptions.warn = warn
const compiled = baseCompile(template.trim(), finalOptions)
if (__DEV__) {
detectErrors(compiled.ast, warn)
}
compiled.errors = errors
compiled.tips = tips
return compiled
}
return {
compile,
compileToFunctions: createCompileToFunctionFn(compile)
}
}
}
Domain
Subdomains
Functions
Dependencies
Imported By
Source
Frequently Asked Questions
What does create-compiler.ts do?
create-compiler.ts is a source file in the vue codebase, written in typescript. It belongs to the VueCore domain, VDom subdomain.
What functions are defined in create-compiler.ts?
create-compiler.ts defines 1 function(s): createCompilerCreator.
What does create-compiler.ts depend on?
create-compiler.ts imports 6 module(s): compiler, createCompileToFunctionFn, detectErrors, error-detector.ts, to-function.ts, util.
What files import create-compiler.ts?
create-compiler.ts is imported by 1 file(s): index.ts.
Where is create-compiler.ts in the architecture?
create-compiler.ts is located at src/compiler/create-compiler.ts (domain: VueCore, subdomain: VDom, directory: src/compiler).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free