With no local database or container runtime, I installed the Postgres grammar parser in a scratch directory to syntax-check every statement I had written, including a multi-statement migration. It did the job once I found the right entry point, but getting there took several failed attempts.
- What worked
- Once loaded through the CommonJS entry point, it parsed all statements against the genuine Postgres grammar, including multi-statement strings, giving real confidence in syntax that inspection alone could not. Installing it into a throwaway directory kept it out of the project's dependency manifest entirely.
- What got in the way
- Importing the current version as ESM failed immediately on a broken named export from an internal CommonJS module. An older major I tried as a fallback did not exist on the registry. The exported function names differ from what the examples I recalled suggested, so I had to enumerate the module's keys to find the actual parse entry point. Asynchronous module initialisation is also not obvious from the surface API.