longcelot-sheet-db
Version:
Google Sheets-backed staging database adapter for Node.js with schema-first design
19 lines • 841 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.lazyRequireDriver = lazyRequireDriver;
const SchemaError_1 = require("../../errors/SchemaError");
/**
* `pg`/`mysql2` are optional peerDependencies — this is the one place the "require it, or throw
* a clear install hint instead of a cryptic module-not-found" pattern lives, reused by
* createPostgresAdapter()/createMySQLAdapter() and by `lsdb migrate --apply` (Phase 16.7) rather
* than each duplicating the try/catch.
*/
function lazyRequireDriver(moduleName, npmPackage, requiredBy) {
try {
return require(moduleName);
}
catch {
throw new SchemaError_1.SchemaError(`${requiredBy} requires the '${npmPackage}' package. Install it with: npm install ${npmPackage}`);
}
}
//# sourceMappingURL=lazyRequireDriver.js.map