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 9fa4763f_e2cf_bb11_a018_df048a4dc205["create-compiler.ts"] 2d4ea1fb_ca3b_f5fc_5e5f_57270428b446["error-detector.ts"] 9fa4763f_e2cf_bb11_a018_df048a4dc205 --> 2d4ea1fb_ca3b_f5fc_5e5f_57270428b446 6fa7ff94_417c_2300_a2f6_c0074055f6ed["detectErrors"] 9fa4763f_e2cf_bb11_a018_df048a4dc205 --> 6fa7ff94_417c_2300_a2f6_c0074055f6ed cf353af6_04db_f570_4b3b_5a4df92dabc9["to-function.ts"] 9fa4763f_e2cf_bb11_a018_df048a4dc205 --> cf353af6_04db_f570_4b3b_5a4df92dabc9 8c37c3f7_6d20_45b0_566b_5aa0cdfb7284["createCompileToFunctionFn"] 9fa4763f_e2cf_bb11_a018_df048a4dc205 --> 8c37c3f7_6d20_45b0_566b_5aa0cdfb7284 156bf2e1_8a13_f22d_5437_54f14bcef8fa["util"] 9fa4763f_e2cf_bb11_a018_df048a4dc205 --> 156bf2e1_8a13_f22d_5437_54f14bcef8fa 47ae9f26_59d1_fab2_349f_966f5d15495a["compiler"] 9fa4763f_e2cf_bb11_a018_df048a4dc205 --> 47ae9f26_59d1_fab2_349f_966f5d15495a 444dc0ac_813b_2552_2920_d8cccb96280b["index.ts"] 444dc0ac_813b_2552_2920_d8cccb96280b --> 9fa4763f_e2cf_bb11_a018_df048a4dc205 style 9fa4763f_e2cf_bb11_a018_df048a4dc205 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 CompilerSFC domain, TemplateTransformer 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: CompilerSFC, subdomain: TemplateTransformer, directory: src/compiler).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free