js-sql is a transpiler that allows you to embed SQL directly in JavaScript code using JSX-like template syntax (<sql>...</sql>). It supports variable interpolation, parameter placeholders ($1, $2...), and function calls inside SQL blocks. The current stable version is 0.0.3, and it appears to be in early development with no recent updates. It differentiates itself by offering compile-time SQL embedding without runtime string concatenation, but it is unmaintained and lacks type safety or modern tooling integration.
npm install js-sqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Transpile a .jss file containing SQL template tags into plain JavaScript using the jss CLI.
Use a modern SQL query builder like knex.js or sequelize.
Ensure all SQL statements are static within <sql> tags; use placeholders for parameters.
Always use placeholders for user input; avoid inserting variables directly with {}.Consider using a maintained alternative; do not use this package in production.
Run npm install in the package directory, or install js-sql with its dependencies: npm install js-sql esprima jstransform
Compile the .jss file first using: npx jss -x jss input.jss output.js, then run output.js
Install globally: npm install -g js-sql, or use npx: npx jss [options]