MCPcopy Index your code
hub / github.com/formatjs/formatjs / parseFile

Function parseFile

packages/cli-lib/vue_extractor.ts:94–118  ·  view source on GitHub ↗
(
  source: string,
  filename: string,
  parseScriptFn: ScriptParseFn
)

Source from the content-addressed store, hash-verified

92}
93
94export function parseFile(
95 source: string,
96 filename: string,
97 parseScriptFn: ScriptParseFn
98): void {
99 const {descriptor, errors} = parse(source, {
100 filename,
101 })
102 if (errors.length) {
103 throw errors[0]
104 }
105 const {script, scriptSetup, template} = descriptor
106
107 if (template) {
108 walk(template.ast, templateSimpleExpressionNodeVisitor(parseScriptFn))
109 }
110
111 if (script) {
112 parseScriptFn(script.content)
113 }
114
115 if (scriptSetup) {
116 parseScriptFn(scriptSetup.content)
117 }
118}

Callers 1

Calls 3

walkFunction · 0.85
parseFunction · 0.50

Tested by

no test coverage detected