Repository navigation
build: move the build steps and their drivers into the engine packages - #68
Conversation
The Postgres engine describes through postgres.js and the MySQL engine through mysql2, pinned in the repository and no longer resolved from the project, so the type check needs no driver of the project's and has one path per database.
Each engine package carries the type check, the module the build steps write and the CLI as tooling.js, and the Postgres and MySQL packages their describer with its driver inside. reylo keeps the run time and an entry for each thing a project names, which loads that half from the project's engine on first use.
A module a build step writes imports checks beside defineQuery only when its statement has a typed JSON, structured or cast parameter, so an app with none bundles 42 KB of run time instead of 63 KB.
An import() of a computed URL, which tsc wraps in a helper of its own, made Turbopack warn that it could not resolve the module on every Next.js dev and build; a require of the resolved path is followed by no bundler.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
Important
Dropping the pg describer sends every Postgres project's type check through postgres.js. A DATABASE_URL that uses libpq's TLS file parameters (sslrootcert=<file>, sslcert, sslkey) could connect before this change through pg, and now fails to connect.
Reviewed changes
I reviewed the full diff: the split of reylo into a run time plus entry points, with the build-time half carried by the engine packages, and the drivers moving into those packages.
- Build-time half in the engine packages:
src/tooling.tsis bundled into each@reylosql/<database>/tooling.js. The entry points inreyloload it with arequireof the resolved path (src/engine-package.ts), and that load is version-checked. - Describers with their own drivers:
packages/postgres/describe.ts(postgres.js) andpackages/mysql/describe.ts(mysql2) are each bundled intodescribe.jsand loaded by dialect throughdescriber(). Thepgpath is gone, and so are the driver peers ofreylo. - Errors that cross bundles:
UnreachableandNotMysqlnow live insrc/connection.tsand are recognized by a mark in the global symbol registry. - Parameter checks only where needed:
checksis now exported fromreylo. A written module imports it only when a parameter has a schema, a cast or arowstype, andexecute.tsrefuses such a parameter when the query has nochecks. - CLI and content mapper split:
src/commands.tsandsrc/mapper-server.tshold the logic.src/cli.tsandsrc/mapper.tsare thin entries, and the mapper falls back to answering every file with the error when it cannot load the build-time half. - Setup, CI and docs: CI now installs in
packages/postgresan 8000 dpackages/mysql, and the links forlab/basicandlab/mysqlare dropped. The docs and example READMEs no longer ask projects to install a driver for the type check.
ℹ️ Comments that still name the removed describer files
Two comments outside the diff still point at files this PR removes. src/engine.ts:123, on enginePath, says the engine is found "as its drivers are found (src/describe.ts)". oracle/src/mysql.rs:3 says the host answers "as the loader's does (src/mysql-describe.ts, through mysql2)". They should now name src/engine.ts (describer) and packages/mysql/describe.ts.
claude-opus-5-5 | 𝕏
The site type-checks the engines' describe.ts files, whose drivers are installed in the package directories only on a developer's machine; the docs build has just the site's own install.
The fallback mapper answered every file with the missing-engine error until the TypeScript server restarted. Each call now looks for the engine again, opens the projects held meanwhile on it, and hands over. Also name the files that replaced the removed describers in two comments.
postgres.js sends a URL parameter it does not know to the server as a setting, which refuses sslrootcert, sslcert, sslkey and sslpassword. They now become the connection's TLS options, verified as sslmode asks.
|
Both inline comments are fixed on the branch. The two stale comments naming removed describer files now point at |
There was a problem hiding this comment.
Important
The new libpq TLS mapping doesn't verify the server's certificate for sslmode=require&sslrootcert=<file>. libpq checks the chain in that case, and so did pg before this PR.
Reviewed changes
I reviewed the two commits since the last review. Both prior threads are addressed and resolved, and so are the stale comments in src/engine.ts and oracle/src/mysql.rs.
- Content mapper takes over a newly installed engine:
src/mapper.tsnow triestooling()on every call. Once it loads, the mapper replaysopenProjectfor the projects the fallback held and hands over tomapperHandlers(), whichsrc/mapper-server.tsnow exports. - libpq TLS files as postgres.js TLS options:
forPostgresJsremovessslrootcert,sslcert,sslkeyandsslpasswordfrom the URL and builds atls.ConnectionOptionsfrom them, with tests intests/connect.test.ts.
claude-opus-5-5 | 𝕏
As libpq does, sslmode=require with an sslrootcert file checks the certificate chain, and sslrootcert=system with a client certificate checks the chain and the host name; the file is read only when one is named.
There was a problem hiding this comment.
✅ No new issues found. Both TLS threads from the last review are fixed, and I've resolved them.
Reviewed changes
I reviewed 6414c51, the only commit since the last review. It changes how forPostgresJs maps libpq's TLS parameters.
- The chain is verified when a root certificate file is given: with
sslmode=requireand ansslrootcertfile, the connection now checks the certificate chain but not the host name, asverify-cadoes. With onlysslcert/sslkey,requirestill checks nothing. sslrootcert=systemwith a client certificate:readnow opens only the keys infiles, so the valuesystemis never read as a file path. The connection checks the chain and the host name against Node's default roots, asverify-fulldoes.- Doc comment and tests: the rule is stated above
forPostgresJs, andtests/connect.test.tsasserts all three cases.
claude-opus-5-5 | 𝕏

reylois what an app installs as a regular dependency and bundles; the engine packages are development dependencies. This moves everything that runs only at build time out ofreyloand into the engine packages, gives each engine its own database driver for the type check, and keeps the parameter checks out of app bundles that don't use them.What moves where
tooling.js. It holds the analysis, the.reylo/cache, the project file, the content mapper, the module the build steps write, and the CLI, all bundled fromsrc/tooling.ts.reylokeeps the run time, plus a thin entry for each thing a project names:reylo/vite,/esbuild,/webpack,/turbopack,/next,/jest,/register, the content mapper'sexec, and thereylobin.tooling.jsfrom the project's engine on first use, then fromreylo's own install, and refuses one of another version (src/engine-package.ts).requireof the resolved path, which no bundler follows. A bundler fails on animport()of a package that isn't installed, and Turbopack warns about animport()of a computed URL once tsc wraps it in its helper. The build checks that eachtooling.jsloads with arequire.describe.js. Projects no longer needpg,postgresormysql2for the type check; those are no longer peers ofreylo, and thepgdescribe path is gone. The analysis loads each describer by dialect. Errors that cross bundles (Unreachable,NotMysql) are recognized by a mark in the global symbol registry (src/connection.ts).checks, exported fromreylo. A written module imports it besidedefineQueryonly when its statement has such a parameter, and the run time reads it from the query (src/checks.ts). A query defined by hand with such a parameter gets an error saying to pass it.Sizes
mainreylo, unpackedreylo, tarballtooling.js89 KB;describe.js40 KB (Postgres) and 618 KB (MySQL)Setup changes
packages/postgresandpackages/mysqleach have their own install now, for their driver; CI andAGENTS.mdadd it. The drivers live there rather than at the repository root because a root install links them into nub's global store, outside the repository, and Turbopack refuses such a link in a project whose root is the repository (lab/nextjs). The connection tests no longer read thelab/basicandlab/mysqllinks, so CI stops making them. The docs and the examples' READMEs no longer tell projects to install a driver for the type check.Verified
Run locally, all passing:
The Next.js builds print no warning from reylo. The built CLI and content mapper were also run in a project with no engine installed: each reports the missing engine with its install line, the content mapper as a diagnostic on the file.