fix: avoid node globals in debug logger - #474
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe React Native and Expo debug utilities now read development-mode settings through typed optional ChangesDevelopment mode access
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~5 minutes Change: Bug fix 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #474 +/- ##
==========================================
+ Coverage 76.42% 76.44% +0.01%
==========================================
Files 157 157
Lines 16714 16711 -3
Branches 4814 4811 -3
==========================================
+ Hits 12773 12774 +1
+ Misses 3941 3937 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
expo-iap carries the same pattern as react-native-iap: a bare `process` and a cast global in the debug logger. It does not fail a consumer build today, because the package exposes only `build/` and its `.d.ts` — react-native-iap is the one whose `react-native` export condition points at `src/index.ts`, so its source is what a consumer type-checks. Reading both through a typed `globalThis` matches the fix next door and keeps the file compiling on its own, so a future source export cannot reintroduce it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused changes resolve the reported type errors without altering intended logging behavior.
Review effort: Balanced
Findings: None
What changed in this PR
Removes Node-global type dependencies from debug loggers while preserving opt-in logging behavior.
Changes:
- Accesses environment flags safely through typed
globalThis. - Prevents consumer TypeScript failures when Node types are unavailable.
| File | Description |
|---|---|
libraries/react-native-iap/src/utils/debug.ts |
Makes debug detection independent of Node typings. |
libraries/expo-iap/src/utils/debug.ts |
Applies the same safe global access pattern. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
hyochan
left a comment
There was a problem hiding this comment.
Verified the missing-Node-types regression, both logging switches, and warning/error behavior. All relevant local tests and CI checks pass.
|
Shipped in react-native-iap 16.6.2 and expo-iap 5.6.3 🚀 |
React Native consumers type-check the library source through the
react-nativeexport condition. Without Node typings, the debug loggers fail on bareprocessandglobalreferences.Read both development flags through typed
globalThisin React Native and Expo. Opt-in logging stays the same, and a missingprocessorprocess.envis safe.Verified: both original loggers reproduce the missing-Node-types error; both updated loggers compile with
types: []. All 16 isolated runtime cases pass, including disabled logging, both opt-in switches, and unconditional warnings/errors. Lint, TypeScript, and 1,320 React Native/Expo library, plugin, and Expo example tests pass.Preview: no visual surface; the checks above exercise the TypeScript failure and logger behavior directly.