error-detector.ts — vue Source File
Architecture documentation for error-detector.ts, a typescript file in the vue codebase. 2 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 2d4ea1fb_ca3b_f5fc_5e5f_57270428b446["error-detector.ts"] 320ee0f4_351d_a6b2_1c1c_f0f6f42fb987["index.ts"] 2d4ea1fb_ca3b_f5fc_5e5f_57270428b446 --> 320ee0f4_351d_a6b2_1c1c_f0f6f42fb987 47ae9f26_59d1_fab2_349f_966f5d15495a["compiler"] 2d4ea1fb_ca3b_f5fc_5e5f_57270428b446 --> 47ae9f26_59d1_fab2_349f_966f5d15495a 9fa4763f_e2cf_bb11_a018_df048a4dc205["create-compiler.ts"] 9fa4763f_e2cf_bb11_a018_df048a4dc205 --> 2d4ea1fb_ca3b_f5fc_5e5f_57270428b446 style 2d4ea1fb_ca3b_f5fc_5e5f_57270428b446 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { ASTElement, ASTNode } from 'types/compiler'
import { dirRE, onRE } from './parser/index'
type Range = { start?: number; end?: number }
// these keywords should not appear inside expressions, but operators like
// typeof, instanceof and in are allowed
const prohibitedKeywordRE = new RegExp(
'\\b' +
(
'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
'super,throw,while,yield,delete,export,import,return,switch,default,' +
'extends,finally,continue,debugger,function,arguments'
)
.split(',')
.join('\\b|\\b') +
'\\b'
)
// these unary operators should not be used as property/method names
const unaryOperatorsRE = new RegExp(
'\\b' +
'delete,typeof,void'.split(',').join('\\s*\\([^\\)]*\\)|\\b') +
'\\s*\\([^\\)]*\\)'
)
// strip strings in expressions
const stripStringRE =
/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g
// detect problematic expressions in a template
export function detectErrors(ast: ASTNode | undefined, warn: Function) {
if (ast) {
checkNode(ast, warn)
}
}
function checkNode(node: ASTNode, warn: Function) {
if (node.type === 1) {
for (const name in node.attrsMap) {
if (dirRE.test(name)) {
const value = node.attrsMap[name]
if (value) {
const range = node.rawAttrsMap[name]
if (name === 'v-for') {
checkFor(node, `v-for="${value}"`, warn, range)
} else if (name === 'v-slot' || name[0] === '#') {
checkFunctionParameterExpression(
value,
`${name}="${value}"`,
warn,
range
)
} else if (onRE.test(name)) {
checkEvent(value, `${name}="${value}"`, warn, range)
} else {
checkExpression(value, `${name}="${value}"`, warn, range)
}
}
}
// ... (99 more lines)
Domain
Subdomains
Functions
Types
Dependencies
- compiler
- index.ts
Imported By
Source
Frequently Asked Questions
What does error-detector.ts do?
error-detector.ts is a source file in the vue codebase, written in typescript. It belongs to the CompilerSFC domain, StyleProcessor subdomain.
What functions are defined in error-detector.ts?
error-detector.ts defines 7 function(s): checkEvent, checkExpression, checkFor, checkFunctionParameterExpression, checkIdentifier, checkNode, detectErrors.
What does error-detector.ts depend on?
error-detector.ts imports 2 module(s): compiler, index.ts.
What files import error-detector.ts?
error-detector.ts is imported by 1 file(s): create-compiler.ts.
Where is error-detector.ts in the architecture?
error-detector.ts is located at src/compiler/error-detector.ts (domain: CompilerSFC, subdomain: StyleProcessor, directory: src/compiler).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free