npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

babel-plugin-annotate-sql-tag

1.0.0

@gajus

npmHomeRepoSnykSocket
Downloads:3058
$ npm install babel-plugin-annotate-sql-tag
DailyWeeklyMonthlyYearly

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.