MCPcopy
hub / github.com/1weiho/open-slide / parseSource

Function parseSource

packages/core/src/editing/babel-walk.ts:64–75  ·  view source on GitHub ↗
(source: string)

Source from the content-addressed store, hash-verified

62}
63
64export function parseSource(source: string): File | null {
65 try {
66 const ast = babelParse(source, {
67 sourceType: 'module',
68 plugins: ['typescript', 'jsx'],
69 errorRecovery: true,
70 }) as File & { errors?: unknown[] };
71 return ast.errors && ast.errors.length > 0 ? null : ast;
72 } catch {
73 return null;
74 }
75}

Callers 5

applyEditFunction · 0.90
findInsertionFunction · 0.90
findAssetUsagesFunction · 0.90
findReferencedAssetsFunction · 0.90
applyRevertAssetFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected