$ npm install babel-plugin-annotate-sql-tagTurns this:
const foo = async () => {
await pool.query(
sql.type(
z.object({
bar: z.text(),
})
)`
SELECT 1
`
);
};
Into this:
const foo = async () => {
await pool.query(
sql.type(
z.object({
bar: z.text(),
})
)`
/*route='path/to/file.ts'*/
SELECT 1
`
);
};
It makes it easier to discover the origin of the SQL query.
Compatible with sqlcommenter.