babel-plugin-annotate-sql-tag
v1.0.0
Published
Annotates Slonik's sql.type() calls with the file path and function name.
Readme
Babel Plugin to Annotate SQL Tags
Turns 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
`
);
};Motivation
It makes it easier to discover the origin of the SQL query.
Compatible with sqlcommenter.
