{"_id":"@boruto_vk7/better-sqlite3","_rev":"3-c3b3256623639e7a647374088cd1aca8","name":"@boruto_vk7/better-sqlite3","dist-tags":{"latest":"1.0.15"},"versions":{"1.0.13":{"name":"@boruto_vk7/better-sqlite3","version":"1.0.13","keywords":["sqlite3","better-sqlite3","termux","android","bot","database"],"author":{"name":"Borutovk7"},"license":"MIT","_id":"@boruto_vk7/better-sqlite3@1.0.13","maintainers":[{"name":"eduh_dev021","email":"kentakakura021028@gmail.com"}],"homepage":"https://www.npmjs.com/package/@boruto_vk7/better-sqlite3","bugs":{"url":"https://github.com/boruto_vk7/better-sqlite3/issues"},"dist":{"shasum":"0c4fb03c9bd760ac824e1db9966f65f115fbac45","tarball":"https://registry.npmjs.org/@boruto_vk7/better-sqlite3/-/better-sqlite3-1.0.13.tgz","fileCount":9,"integrity":"sha512-TfuLJ8cm/CHXn5Q6AZGd5/RL3AiwenUgVojL3f7tb1LV9Es6KjAjelMDyIjm7FB7OJuL3SG5kRaCGhDUXt5KLA==","signatures":[{"sig":"MEYCIQD7cYq7HUkJ6+SpCNuBWr/xCBU3lUh0Nli03DgGoUwOSQIhAOugZ7MDxbstYKsUIsLaECf3dOUJxDTueW0bQ71ZOvvt","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":43069},"main":"./dist/index.cjs","type":"module","types":"./types.d.cts","module":"./dist/index.mjs","engines":{"node":">=18.0.0"},"exports":{".":{"import":{"types":"./types.d.cts","default":"./dist/index.mjs"},"require":{"types":"./types.d.cts","default":"./dist/index.cjs"}}},"scripts":{"postinstall":"node ./dist/install.cjs"},"_npmUser":{"name":"eduh_dev021","email":"kentakakura021028@gmail.com"},"repository":{"url":"git+https://github.com/boruto_vk7/better-sqlite3.git","type":"git"},"_npmVersion":"10.8.2","description":"Drop-in better-sqlite3 wrapper that works on Termux (Android) and standard Linux — auto-compiles isolated engines.","directories":{},"sideEffects":false,"_nodeVersion":"20.20.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"optionalDependencies":{"better-sqlite3":"^12.9.0"},"_npmOperationalInternal":{"tmp":"tmp/better-sqlite3_1.0.13_1784949332099_0.017711386171956445","host":"s3://npm-registry-packages-npm-production"}},"1.0.14":{"name":"@boruto_vk7/better-sqlite3","version":"1.0.14","keywords":["sqlite3","better-sqlite3","termux","android","bot","database"],"author":{"name":"Borutovk7"},"license":"MIT","_id":"@boruto_vk7/better-sqlite3@1.0.14","maintainers":[{"name":"eduh_dev021","email":"kentakakura021028@gmail.com"}],"homepage":"https://www.npmjs.com/package/@boruto_vk7/better-sqlite3","bugs":{"url":"https://github.com/boruto_vk7/better-sqlite3/issues"},"dist":{"shasum":"aceed8cdb5351dfdfc139c2e973297e1a3eee366","tarball":"https://registry.npmjs.org/@boruto_vk7/better-sqlite3/-/better-sqlite3-1.0.14.tgz","fileCount":9,"integrity":"sha512-Wo1K/crlQsWq1qdGNWMzOK2phdh2ysr8kZ+70c9BX+DJ7lvL6WjOtYZ4C8hMoyX9EHeUQa9jfO/XXkUTwWUllA==","signatures":[{"sig":"MEYCIQDf7KCvVjO5H5NguZTkSpJ516D70dMDv6pzz5Tk9cI8ugIhAM5ofyLdzLOOpKT3TQTday+1IIvlSCVrsd8KuHWgJFZY","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":42766},"main":"./dist/index.cjs","type":"module","types":"./types.d.cts","module":"./dist/index.mjs","engines":{"node":">=18.0.0"},"exports":{".":{"import":{"types":"./types.d.cts","default":"./dist/index.mjs"},"require":{"types":"./types.d.cts","default":"./dist/index.cjs"}}},"scripts":{"postinstall":"node ./dist/install.cjs"},"_npmUser":{"name":"eduh_dev021","email":"kentakakura021028@gmail.com"},"repository":{"url":"git+https://github.com/boruto_vk7/better-sqlite3.git","type":"git"},"_npmVersion":"10.8.2","description":"Drop-in better-sqlite3 wrapper that works on Termux (Android) and standard Linux — auto-compiles isolated engines.","directories":{},"sideEffects":false,"_nodeVersion":"20.20.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"optionalDependencies":{"better-sqlite3":"^12.9.0"},"_npmOperationalInternal":{"tmp":"tmp/better-sqlite3_1.0.14_1784949384806_0.2718039725093413","host":"s3://npm-registry-packages-npm-production"}},"1.0.15":{"name":"@boruto_vk7/better-sqlite3","version":"1.0.15","description":"Drop-in better-sqlite3 wrapper that works on Termux (Android) and standard Linux — auto-compiles isolated engines.","license":"MIT","type":"module","sideEffects":true,"exports":{".":{"import":{"types":"./types.d.cts","default":"./dist/index.mjs"},"require":{"types":"./types.d.cts","default":"./dist/index.cjs"}}},"main":"./dist/index.cjs","module":"./dist/index.mjs","types":"./types.d.cts","scripts":{"postinstall":"node ./dist/install.cjs"},"optionalDependencies":{"better-sqlite3":"^12.9.0"},"engines":{"node":">=18.0.0"},"keywords":["sqlite3","better-sqlite3","termux","android","bot","database"],"author":{"name":"Borutovk7"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/boruto_vk7/better-sqlite3.git"},"homepage":"https://www.npmjs.com/package/@boruto_vk7/better-sqlite3","bugs":{"url":"https://github.com/boruto_vk7/better-sqlite3/issues"},"_id":"@boruto_vk7/better-sqlite3@1.0.15","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-1aCexon3v6CeQpR6XDPo4UhVMtGoEc+GQFrCAFLa04XW2vn39lmbv7ynKWkGHJsJ7mKl9HiuXjy2sUoeRd+jPQ==","shasum":"8deee139892da86d3249eef6ab629315f8097a7c","tarball":"https://registry.npmjs.org/@boruto_vk7/better-sqlite3/-/better-sqlite3-1.0.15.tgz","fileCount":8,"unpackedSize":49574,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDuKL8cXWtHE0a4KVbqZeMsE+/Jchurkb+0rH8S9W0LAAIgVw4SKoYJRYOZ7vZD2/DyVWooaL9pjVEqEowC63W9BuE="}]},"_npmUser":{"name":"eduh_dev021","email":"kentakakura021028@gmail.com"},"directories":{},"maintainers":[{"name":"eduh_dev021","email":"kentakakura021028@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/better-sqlite3_1.0.15_1785499779365_0.18827635882262328"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-25T03:15:31.916Z","modified":"2026-07-31T12:09:39.640Z","1.0.13":"2026-07-25T03:15:32.228Z","1.0.14":"2026-07-25T03:16:24.947Z","1.0.15":"2026-07-31T12:09:39.511Z"},"bugs":{"url":"https://github.com/boruto_vk7/better-sqlite3/issues"},"author":{"name":"Borutovk7"},"license":"MIT","homepage":"https://www.npmjs.com/package/@boruto_vk7/better-sqlite3","keywords":["sqlite3","better-sqlite3","termux","android","bot","database"],"repository":{"type":"git","url":"git+https://github.com/boruto_vk7/better-sqlite3.git"},"description":"Drop-in better-sqlite3 wrapper that works on Termux (Android) and standard Linux — auto-compiles isolated engines.","maintainers":[{"name":"eduh_dev021","email":"kentakakura021028@gmail.com"}],"readme":"# @boruto_vk7/better-sqlite3\n\n![npm](https://img.shields.io/npm/v/@boruto_vk7/better-sqlite3?style=flat-square)\n![node](https://img.shields.io/node/v/@boruto_vk7/better-sqlite3?style=flat-square)\n![license](https://img.shields.io/npm/l/@boruto_vk7/better-sqlite3?style=flat-square)\n![platform](https://img.shields.io/badge/platform-Termux%20%7C%20Linux-lightgrey?style=flat-square)\n\n**Drop-in replacement for [`better-sqlite3`](https://github.com/WiseLibs/better-sqlite3)** that actually works on **Termux (Android)** and standard Linux.\n\nSame API. ESM + CommonJS. Auto-compiles an isolated native engine when `node-gyp` would normally fail on phone storage.\n\n---\n\n## Why this package exists\n\nOn Termux / Android internal storage, classic `better-sqlite3` installs often break because:\n\n- FUSE/FAT paths under `/sdcard` hate symlinks and native builds  \n- `node-gyp` needs clang, python, headers, sqlite libs  \n- Moving a project from phone → VPS leaves the wrong binary ABI  \n\n`@boruto_vk7/better-sqlite3` detects the environment, installs system deps on Termux when needed, builds `better-sqlite3` into `~/.sqlite3_engines/<projectId>/`, and loads that engine at runtime.\n\n---\n\n## Install\n\n```bash\nnpm install @boruto_vk7/better-sqlite3\n```\n\n> On Termux the first install/import may take a few minutes while native code compiles.\n\n---\n\n## Usage\n\nIdentical to upstream `better-sqlite3` — only the import path changes.\n\n### CommonJS\n\n```js\nconst Database = require('@boruto_vk7/better-sqlite3');\n\nconst db = new Database('bot.db');\ndb.exec('CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT)');\n\nconst insert = db.prepare('INSERT INTO users (name) VALUES (?)');\ninsert.run('Boruto');\n\nconst row = db.prepare('SELECT * FROM users').get();\nconsole.log(row.name);\n```\n\n### ESM\n\n```js\nimport Database from '@boruto_vk7/better-sqlite3';\n\nconst db = new Database('bot.db');\n```\n\n---\n\n## Pin better-sqlite3 version\n\n### 1) `package.json` (recommended)\n\n```json\n{\n  \"dependencies\": {\n    \"@boruto_vk7/better-sqlite3\": \"^1.0.13\"\n  },\n  \"boruto\": {\n    \"sqliteVersion\": \"12.9.0\"\n  }\n}\n```\n\n(`irithell.sqliteVersion` is still accepted for compatibility.)\n\n### 2) Environment variable\n\n```bash\nSQLITE_VERSION=12.9.0 node app.js\n# or\nBETTER_SQLITE3_VERSION=12.9.0 npm install @boruto_vk7/better-sqlite3\n```\n\n### Force rebuild\n\n```bash\nnode ./node_modules/@boruto_vk7/better-sqlite3/dist/install.cjs\n```\n\n---\n\n## Engine management API\n\n```js\nconst {\n  listEngines,\n  getCurrentEngine,\n  deleteEngine,\n  clearAllEngines,\n  engineManager,\n} = require('@boruto_vk7/better-sqlite3');\n\nlistEngines();        // all engines in ~/.sqlite3_engines/\ngetCurrentEngine();   // this project\ndeleteEngine();       // delete current (or pass projectId)\nclearAllEngines();    // wipe all\n\n// helpers\nengineManager.list();\nengineManager.current();\nengineManager.delete();\nengineManager.clearAll();\n```\n\nCompiled engines live in:\n\n```bash\n~/.sqlite3_engines/\n```\n\n---\n\n## Features\n\n- **Termux-aware install** — installs `clang`, `make`, `python`, `pkg-config`, `libsqlite` when missing  \n- **Isolated engines per project** (MD5 of project path)  \n- **Runtime recovery** if `postinstall` was skipped (`--ignore-scripts`)  \n- **Cross-environment rebuild** when you move phone → VPS / Docker  \n- **Original better-sqlite3 types**  \n- **ESM + CJS**\n\n---\n\n## Requirements\n\n- Node.js **≥ 18**\n- Termux: ability to run `pkg install` (first build)\n- Linux/VPS: normal build tools if a native compile is needed\n\n---\n\n## Changelog\n\n### 1.0.13\n- Published as `@boruto_vk7/better-sqlite3`\n- Rebranded logs and docs\n- Support `boruto.sqliteVersion` config key\n- Ship clean empty `engine-config.json` (no machine-specific paths)\n\n### 1.0.11\n- Smart package pre-check on Termux (`dpkg-query`)\n- APT sandbox flags for Android permission quirks\n\n### 1.0.10\n- Runtime install if postinstall is blocked\n- `SQLITE_VERSION` / `BETTER_SQLITE3_VERSION`\n- Engine management API\n- English logs\n\n---\n\n## License\n\nMIT © Borutovk7  \nBased on the Termux isolation approach pioneered by the better-sqlite3-termux ecosystem.\n\n---\n\n## Using as a drop-in `better-sqlite3` alias (hosting panels, bots)\n\nIf your project (or panel) requires plain `better-sqlite3`, alias it in `package.json`:\n\n```json\n{\n  \"dependencies\": {\n    \"better-sqlite3\": \"npm:@boruto_vk7/better-sqlite3@^1.0.15\"\n  }\n}\n```\n\nYour code keeps using `require('better-sqlite3')` / `import Database from 'better-sqlite3'` — no changes needed.\n\n## Choosing the native engine version\n\nPriority order:\n\n1. Env vars: `BETTER_SQLITE3_VERSION` or `SQLITE_VERSION` (e.g. `BETTER_SQLITE3_VERSION=12.4.1`)\n2. `package.json` → `\"boruto\": { \"sqliteVersion\": \"12.4.1\" }`\n3. Your `dependencies` / `devDependencies` entry for the real `better-sqlite3` (if it's not an alias to this wrapper)\n4. Fallback: `latest`\n\nValues are validated (semver / ranges / tags only).\n\n## Engine management\n\n```js\nconst Database = require('@boruto_vk7/better-sqlite3');\n\nconsole.log(Database.listEngines());      // all cached engines in ~/.sqlite3_engines\nconsole.log(Database.getCurrentEngine()); // engine for this project\nDatabase.deleteEngine();                  // delete this project's engine\nDatabase.clearAllEngines();               // wipe everything\n```\n\n## Changelog\n\n### 1.0.15\n\n- **Fix (critical):** CommonJS entry crashed on load with `TypeError: Cannot assign to read only property 'default'` — a stray `Object.defineProperty(..., 'default', ...)` made the export readonly. `require('better-sqlite3')` works again (drop-in bots/panels).\n- **Fix:** engine version resolution no longer confuses the wrapper version (`1.0.x`) with the real `better-sqlite3` version, and self-aliases (`npm:@boruto_vk7/...`) are ignored.\n- **Fix:** Termux dependency check (`dpkg-query -f='${Status}'`) was inside a JS template literal and never ran.\n- **Fix:** `createRequire()` now receives a filename instead of a bare trailing-slash path.\n- **Security:** engine version strings are validated before reaching `npm install` (shell-injection hardening).\n- **Improvement:** postinstall skips the isolated engine when a working `better-sqlite3` is already installed alongside; load failures now include the underlying reason (`Last load attempt:`).\n- **Improvement:** `sideEffects: true` so bundlers don't tree-shake the auto-load; ESM entry now re-exports `SqliteError`; `types.d.cts` rewritten (real CJS typings).\n","readmeFilename":"README.md"}