{"id":42911,"library":"js-sql","title":"js-sql","description":"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.","status":"abandoned","version":"0.0.3","language":"javascript","source_language":"en","source_url":"git://github.com/lalitkapoor/js-sql","tags":["javascript","sql","jss","js-sql","jssql","esprima","jstransform","transpiler"],"install":[{"cmd":"npm install js-sql","lang":"bash","label":"npm"},{"cmd":"yarn add js-sql","lang":"bash","label":"yarn"},{"cmd":"pnpm add js-sql","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"JavaScript parsing for transpilation","package":"esprima","optional":false},{"reason":"AST transformation to replace SQL tags with JavaScript","package":"jstransform","optional":false}],"imports":[{"note":"js-sql is a command-line tool, not a runtime library. Use the CLI directly.","wrong":"require('js-sql') or import from 'js-sql'","symbol":"jss","correct":"npx jss -x jss src/ build/"},{"note":"The package compiles .jss files, not standard .js files.","wrong":"Using .js file extension without compilation","symbol":".jss files","correct":"Use .jss file extension and compile with jss"}],"quickstart":{"code":"// Create a file example.jss\nfunction getUser(id) {\n  var sql = <sql>\n    SELECT * FROM users\n    WHERE id = $1\n  </sql>;\n  return sql;\n}\n\n// Transpile: npx jss -x jss . out/\n// Output example.js will contain:\n// function getUser(id) {\n//   var sql = \"SELECT * FROM users WHERE id = \" + id;\n//   return sql;\n// }","lang":"javascript","description":"Transpile a .jss file containing SQL template tags into plain JavaScript using the jss CLI."},"warnings":[{"fix":"Use a modern SQL query builder like knex.js or sequelize.","message":"Package is unmaintained and no longer compatible with modern Node.js versions.","severity":"deprecated","affected_versions":">=0.0.3"},{"fix":"Ensure all SQL statements are static within <sql> tags; use placeholders for parameters.","message":"The <sql> tags are transpiled at build time, not runtime. Dynamic SQL strings are not supported.","severity":"gotcha","affected_versions":"*"},{"fix":"Always use placeholders for user input; avoid inserting variables directly with {}.","message":"Placeholder indexes ($1, $2) are not validated and may lead to SQL injection if user input is interpolated directly.","severity":"gotcha","affected_versions":"*"},{"fix":"Consider using a maintained alternative; do not use this package in production.","message":"The package depends on outdated esprima and jstransform packages which have known security vulnerabilities.","severity":"breaking","affected_versions":"*"}],"env_vars":null,"search_vec":"'0.0.3':45 '1':32 '2':33 'allow':11 'appear':48 'block':39 'call':36 'code':19 'compil':64 'compile-tim':63 'concaten':71 'current':41 'develop':53 'differenti':59 'direct':16 'earli':52 'emb':14 'embed':67 'esprima':91 'function':35 'insid':37 'integr':83 'interpol':29 'javascript':18,84 'js':2,5,88 'js-sql':1,4,87 'jss':86 'jssql':90 'jstransform':92 'jsx':22 'jsx-like':21 'lack':77 'like':23 'modern':81 'offer':62 'paramet':30 'placehold':31 'recent':56 'runtim':69 'safeti':79 'sql':3,6,15,38,66,85,89 'stabl':42 'string':70 'support':27 'syntax':25 'templat':24 'time':65 'tool':82 'transpil':9,93 'type':78 'unmaintain':75 'updat':57 'use':20 'variabl':28 'version':43 'without':68","created_at":"2026-06-05T16:57:15.888974+00:00","updated_at":"2026-06-05T16:57:15.888974+00:00","problems":[{"fix":"Run npm install in the package directory, or install js-sql with its dependencies: npm install js-sql esprima jstransform","cause":"Missing dependency, or npm install failed to install peer dependencies.","error":"Error: Cannot find module 'jstransform'"},{"fix":"Compile the .jss file first using: npx jss -x jss input.jss output.js, then run output.js","cause":"Attempting to run a .jss file directly with Node.js without transpilation.","error":"SyntaxError: Unexpected token <"},{"fix":"Install globally: npm install -g js-sql, or use npx: npx jss [options]","cause":"js-sql is not installed globally or npx is not available.","error":"jss: command not found"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/lalitkapoor/js-sql","github":"git://github.com/lalitkapoor/js-sql","docs":null,"changelog":null,"pypi":null,"npm":"js-sql","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}