parse.ts — vue Source File
Architecture documentation for parse.ts, a typescript file in the vue codebase. 14 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR a74639a8_41f7_d409_723a_4c6194e0c72d["parse.ts"] 1a27e6b3_7515_332e_8d02_d958c72a568c["types.ts"] a74639a8_41f7_d409_723a_4c6194e0c72d --> 1a27e6b3_7515_332e_8d02_d958c72a568c a9f9b30f_bda1_1f21_7614_3a5f474a5c6f["RawSourceMap"] a74639a8_41f7_d409_723a_4c6194e0c72d --> a9f9b30f_bda1_1f21_7614_3a5f474a5c6f cd9cc973_3348_e3ed_e239_630aac19b477["TemplateCompiler"] a74639a8_41f7_d409_723a_4c6194e0c72d --> cd9cc973_3348_e3ed_e239_630aac19b477 0efbfda6_f2a2_633c_6405_ea7a32c8a88d["parseComponent.ts"] a74639a8_41f7_d409_723a_4c6194e0c72d --> 0efbfda6_f2a2_633c_6405_ea7a32c8a88d fcce9d76_9068_3c88_145d_3d973c3e1547["parseComponent"] a74639a8_41f7_d409_723a_4c6194e0c72d --> fcce9d76_9068_3c88_145d_3d973c3e1547 e78627e7_56ea_02a3_3f09_996207b26a06["VueTemplateCompilerParseOptions"] a74639a8_41f7_d409_723a_4c6194e0c72d --> e78627e7_56ea_02a3_3f09_996207b26a06 12e2cd32_caec_3647_52d2_fbf5316b83b2["SFCDescriptor"] a74639a8_41f7_d409_723a_4c6194e0c72d --> 12e2cd32_caec_3647_52d2_fbf5316b83b2 c9346cac_54e3_f6ca_68a7_03c6e82c9609["compileScript.ts"] a74639a8_41f7_d409_723a_4c6194e0c72d --> c9346cac_54e3_f6ca_68a7_03c6e82c9609 4963bb7f_aa8f_8391_a726_4dfb648391e3["hmrShouldReload"] a74639a8_41f7_d409_723a_4c6194e0c72d --> 4963bb7f_aa8f_8391_a726_4dfb648391e3 445bc304_0400_2ae2_a33b_eaa1d5e1788a["cssVars.ts"] a74639a8_41f7_d409_723a_4c6194e0c72d --> 445bc304_0400_2ae2_a33b_eaa1d5e1788a 9bf0fc0d_be28_66be_0264_6ad60cd848e2["parseCssVars"] a74639a8_41f7_d409_723a_4c6194e0c72d --> 9bf0fc0d_be28_66be_0264_6ad60cd848e2 537f7054_6a5b_8943_060c_d8a93e82f44c["source-map"] a74639a8_41f7_d409_723a_4c6194e0c72d --> 537f7054_6a5b_8943_060c_d8a93e82f44c fc941c56_f02c_3273_7345_35c4fdf47a8a["hash-sum"] a74639a8_41f7_d409_723a_4c6194e0c72d --> fc941c56_f02c_3273_7345_35c4fdf47a8a d73a8f5d_6229_eafc_3050_fd091b1e7b74["lru-cache"] a74639a8_41f7_d409_723a_4c6194e0c72d --> d73a8f5d_6229_eafc_3050_fd091b1e7b74 style a74639a8_41f7_d409_723a_4c6194e0c72d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { SourceMapGenerator } from 'source-map'
import { RawSourceMap, TemplateCompiler } from './types'
import {
parseComponent,
VueTemplateCompilerParseOptions,
SFCDescriptor,
DEFAULT_FILENAME
} from './parseComponent'
import hash from 'hash-sum'
import LRU from 'lru-cache'
import { hmrShouldReload } from './compileScript'
import { parseCssVars } from './cssVars'
const cache = new LRU<string, SFCDescriptor>(100)
const splitRE = /\r?\n/g
const emptyRE = /^(?:\/\/)?\s*$/
export interface SFCParseOptions {
source: string
filename?: string
compiler?: TemplateCompiler
compilerParseOptions?: VueTemplateCompilerParseOptions
sourceRoot?: string
sourceMap?: boolean
/**
* @deprecated use `sourceMap` instead.
*/
needMap?: boolean
}
export function parse(options: SFCParseOptions): SFCDescriptor {
const {
source,
filename = DEFAULT_FILENAME,
compiler,
compilerParseOptions = { pad: false } as VueTemplateCompilerParseOptions,
sourceRoot = '',
needMap = true,
sourceMap = needMap
} = options
const cacheKey = hash(
filename + source + JSON.stringify(compilerParseOptions)
)
let output = cache.get(cacheKey)
if (output) {
return output
}
if (compiler) {
// user-provided compiler
output = compiler.parseComponent(source, compilerParseOptions)
} else {
// use built-in compiler
output = parseComponent(source, compilerParseOptions)
}
output.filename = filename
// ... (70 more lines)
Domain
Subdomains
Functions
Types
Dependencies
Imported By
Source
Frequently Asked Questions
What does parse.ts do?
parse.ts is a source file in the vue codebase, written in typescript. It belongs to the SfcCompiler domain, ScriptCompiler subdomain.
What functions are defined in parse.ts?
parse.ts defines 2 function(s): generateSourceMap, parse.
What does parse.ts depend on?
parse.ts imports 14 module(s): RawSourceMap, SFCDescriptor, TemplateCompiler, VueTemplateCompilerParseOptions, compileScript.ts, cssVars.ts, hash-sum, hmrShouldReload, and 6 more.
What files import parse.ts?
parse.ts is imported by 2 file(s): compileStyle.spec.ts, compileTemplate.spec.ts.
Where is parse.ts in the architecture?
parse.ts is located at packages/compiler-sfc/src/parse.ts (domain: SfcCompiler, subdomain: ScriptCompiler, 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