chore: type shim for csv-parse/lib/sync (TS7 compat) - #41314
Conversation
|
|
Looks like this PR is ready to merge! 🎉 |
WalkthroughAdds an ambient TypeScript module declaration that maps ChangesCSV parser type bridge
Estimated code review effort: 1 (Trivial) | ~2 minutes Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
/jira ARCH-2200 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #41314 +/- ##
===========================================
+ Coverage 68.59% 68.61% +0.01%
===========================================
Files 4134 4134
Lines 160802 160802
Branches 29274 29218 -56
===========================================
+ Hits 110301 110329 +28
+ Misses 45390 45365 -25
+ Partials 5111 5108 -3
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
5797a73 to
711a314
Compare
The Meteor bundler resolves npm requires by physical path and doesn't support package exports subpaths — switching the imports to 'csv-parse/sync' crashes the production bundle at boot (MODULE_NOT_FOUND). Keep the runtime specifier 'csv-parse/lib/sync' and bridge only the types: an ambient declaration re-exporting from the exports-declared 'csv-parse/sync' entry, which TS7's resolution accepts. Verified on TS5 and TS7; zero runtime changes.
711a314 to
ae59c99
Compare
|
/jira ARCH-2200 |
Summary
Type-only shim so the CSV importers typecheck under TypeScript 7 — reworked after CI caught a runtime crash in the first approach.
What happened
The original PR switched the imports from
csv-parse/lib/syncto the exports-declaredcsv-parse/sync. Typecheck and plain-node resolution were green, but the production Meteor bundle crashed at boot (Error: Cannot find module 'csv-parse/sync', run 29833170912) — the Meteor bundler resolves npm requires by physical path and doesn't support packageexportssubpaths. The legacycsv-parse/lib/syncspecifier exists precisely because of that.Fix
Keep the runtime specifier untouched and bridge only the types, following the existing
definition/externalspattern:csv-parse/lib/syncisn't in the package's exports map (which TS7's resolution enforces), whilecsv-parse/synccarries a propertypescondition — so the ambient declaration satisfies TS7 without changing what the bundler loads.Verification
csv-parse/lib/sync+ shim → 0 errorsPart of the TS7-readiness set. Also supersedes the old branch content (the importer files moved to
server/lib/import/in the backend restructure; branch rebuilt on current develop).Summary by CodeRabbit
Task: ARCH-2286