Surfaced trying the new Drizzle e2e program (`test-files/compat-e2e/drizzle/main.ts`, added under #804). Even before reaching MySQL, the package compile fails:
```
Compile package: drizzle-orm
Compile package: mysql2
...
Error: Failed to parse /node_modules/mysql2/lib/base/connection.js: Parse error: Error { error: (35073..35074, TS1109) }
```
Sub-bug 1 — parse-error offset is past EOF
`base/connection.js` is 34 096 bytes; the reported error position is `35073..35074` — 977 bytes past end-of-file.
mysql2 is CJS, so Perry's `cjs_wrap` pre-processes the source (wraps it in an IIFE with `module/exports/require` bindings before re-parsing). The error position points into the post-wrap source, but the error message reports it as if it were the original — without naming the rewrite. That makes the message practically un-actionable for users; the byte offset they see corresponds to nothing in the file they wrote.
Fix shape: when `cjs_wrap` re-parses, the parse error should be reported with either (a) the post-wrap source attached, (b) an offset translated back to the original CJS source, or (c) at minimum a clear "after CJS-to-ESM wrap" note in the error.
Sub-bug 2 — actual mysql2 incompatibility
Beyond the message ergonomics, the real underlying issue is that TS1109 "Expression expected" is firing somewhere in the post-wrap source. I haven't narrowed which specific construct yet; mysql2 `base/connection.js` uses fairly standard ES2017+ (`class extends EventEmitter`, `async`, `static` methods, `...spread`, template literals) — no decorators, no private fields, no `using`. The wrap step must be producing something the re-parser doesn't like.
A minimal-extract repro would need:
- The actual post-wrap source — currently not surfaced to users.
- Or: a hook that lets us inspect what `cjs_wrap` produced before re-parse fails.
This is blocking #804 (Drizzle e2e), #489 (Drizzle + MySQL via @perry/mysql), and any compile-as-package use of mysql2.
Part of #793 + #804. Surfaced by the #804 Drizzle e2e scaffold.
Surfaced trying the new Drizzle e2e program (`test-files/compat-e2e/drizzle/main.ts`, added under #804). Even before reaching MySQL, the package compile fails:
```
Compile package: drizzle-orm
Compile package: mysql2
...
Error: Failed to parse /node_modules/mysql2/lib/base/connection.js: Parse error: Error { error: (35073..35074, TS1109) }
```
Sub-bug 1 — parse-error offset is past EOF
`base/connection.js` is 34 096 bytes; the reported error position is `35073..35074` — 977 bytes past end-of-file.
mysql2 is CJS, so Perry's `cjs_wrap` pre-processes the source (wraps it in an IIFE with `module/exports/require` bindings before re-parsing). The error position points into the post-wrap source, but the error message reports it as if it were the original — without naming the rewrite. That makes the message practically un-actionable for users; the byte offset they see corresponds to nothing in the file they wrote.
Fix shape: when `cjs_wrap` re-parses, the parse error should be reported with either (a) the post-wrap source attached, (b) an offset translated back to the original CJS source, or (c) at minimum a clear "after CJS-to-ESM wrap" note in the error.
Sub-bug 2 — actual mysql2 incompatibility
Beyond the message ergonomics, the real underlying issue is that TS1109 "Expression expected" is firing somewhere in the post-wrap source. I haven't narrowed which specific construct yet; mysql2 `base/connection.js` uses fairly standard ES2017+ (`class extends EventEmitter`, `async`, `static` methods, `...spread`, template literals) — no decorators, no private fields, no `using`. The wrap step must be producing something the re-parser doesn't like.
A minimal-extract repro would need:
This is blocking #804 (Drizzle e2e), #489 (Drizzle + MySQL via @perry/mysql), and any compile-as-package use of mysql2.
Part of #793 + #804. Surfaced by the #804 Drizzle e2e scaffold.