MCPcopy Create free account
hub / github.com/donghaxkim/react-rewrite / parseSource

Function parseSource

packages/cli/src/transform.ts:19–25  ·  view source on GitHub ↗
(source: string, filePath: string)

Source from the content-addressed store, hash-verified

17 * Pure function — no file I/O.
18 */
19export function parseSource(source: string, filePath: string) {
20 const parser = getParser(filePath);
21 const j = jscodeshift.withParser(parser);
22 const root = j(source);
23 const quoteStyle = detectQuoteStyle(source);
24 return { j, root, quoteStyle };
25}
26
27/**
28 * Find a JSXElement at a given line:col in the AST.

Callers 5

executeBatchFunction · 0.85
reorderComponentFunction · 0.85
updateClassNameFunction · 0.85
updateTextContentFunction · 0.85
parseFunction · 0.85

Calls 2

getParserFunction · 0.85
detectQuoteStyleFunction · 0.85

Tested by 1

parseFunction · 0.68