babelUtils.ts — vue Source File
Architecture documentation for babelUtils.ts, a typescript file in the vue codebase. 2 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR 946e0fa6_6c05_b820_0bd7_980d6d869192["babelUtils.ts"] d3d97353_4222_a6a9_92c9_5df9bca481d4["types"] 946e0fa6_6c05_b820_0bd7_980d6d869192 --> d3d97353_4222_a6a9_92c9_5df9bca481d4 8f191406_14ff_9b29_a0c6_235496cdfa16["estree-walker"] 946e0fa6_6c05_b820_0bd7_980d6d869192 --> 8f191406_14ff_9b29_a0c6_235496cdfa16 b9f12a63_b611_1b00_0717_3ff21d7ce156["compileScript.ts"] b9f12a63_b611_1b00_0717_3ff21d7ce156 --> 946e0fa6_6c05_b820_0bd7_980d6d869192 799ac4a1_7d08_dd24_f075_2bfd21b8092b["prefixIdentifiers.ts"] 799ac4a1_7d08_dd24_f075_2bfd21b8092b --> 946e0fa6_6c05_b820_0bd7_980d6d869192 style 946e0fa6_6c05_b820_0bd7_980d6d869192 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
// https://github.com/vuejs/core/blob/main/packages/compiler-core/src/babelUtils.ts
// should only use types from @babel/types
// do not import runtime methods
import type {
Identifier,
Node,
Function,
ObjectProperty,
BlockStatement,
Program
} from '@babel/types'
import { walk } from 'estree-walker'
export function walkIdentifiers(
root: Node,
onIdentifier: (
node: Identifier,
parent: Node,
parentStack: Node[],
isReference: boolean,
isLocal: boolean
) => void,
onNode?: (node: Node) => void
) {
const includeAll = false
const parentStack: Node[] = []
const knownIds: Record<string, number> = Object.create(null)
const rootExp =
root.type === 'Program' &&
root.body[0].type === 'ExpressionStatement' &&
root.body[0].expression
;(walk as any)(root, {
enter(node: Node & { scopeIds?: Set<string> }, parent: Node | undefined) {
parent && parentStack.push(parent)
if (
parent &&
parent.type.startsWith('TS') &&
parent.type !== 'TSAsExpression' &&
parent.type !== 'TSNonNullExpression' &&
parent.type !== 'TSTypeAssertion'
) {
return this.skip()
}
if (onNode) onNode(node)
if (node.type === 'Identifier') {
const isLocal = !!knownIds[node.name]
const isRefed = isReferencedIdentifier(node, parent!, parentStack)
if (includeAll || (isRefed && !isLocal)) {
onIdentifier(node, parent!, parentStack, isRefed, isLocal)
}
} else if (
node.type === 'ObjectProperty' &&
parent!.type === 'ObjectPattern'
) {
// mark property in destructure pattern
// ... (364 more lines)
Domain
Subdomains
Functions
Dependencies
- estree-walker
- types
Imported By
Source
Frequently Asked Questions
What does babelUtils.ts do?
babelUtils.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 babelUtils.ts?
babelUtils.ts defines 11 function(s): extractIdentifiers, isFunctionType, isInDestructureAssignment, isReferenced, isReferencedIdentifier, isStaticProperty, isStaticPropertyKey, markScopeIdentifier, walkBlockDeclarations, walkFunctionParams, and 1 more.
What does babelUtils.ts depend on?
babelUtils.ts imports 2 module(s): estree-walker, types.
What files import babelUtils.ts?
babelUtils.ts is imported by 2 file(s): compileScript.ts, prefixIdentifiers.ts.
Where is babelUtils.ts in the architecture?
babelUtils.ts is located at packages/compiler-sfc/src/babelUtils.ts (domain: CompilerSFC, subdomain: StyleProcessor, directory: packages/compiler-sfc/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free