@gluonjs/compiler / packages/compiler/src / parseGluonSfc
Function: parseGluonSfc()
parseGluonSfc(
source,filename):GluonSfcParseResult
The parser boundary shared by compilation and language tooling.
Parameters
source
string
filename
string
Returns
Example
Parse one presentational component through the same typed boundary used by the editor:
import { parseGluonSfc } from '@gluonjs/compiler';
const result = parseGluonSfc('<template component="Card" layer="atom"><p /></template>', 'Card.gluon');
const template = result.blocks.find((block) => block.type === 'template');
console.log(template?.range, result.errors);