I think you need to change "TB" to "TD"
try editing this line from:
const graphDefinition = 'graph TB\na-->b';
To:
const graphDefinition = ` flowchart TD a --> b `;