Skip to content

fix: add NO_RAIQUB_SOURCEGENERATORS_POLYFILL flag to disable embedded polyfills#261

Merged
skarllot merged 1 commit intomainfrom
fix/disable-polyfill-flag
Mar 29, 2026
Merged

fix: add NO_RAIQUB_SOURCEGENERATORS_POLYFILL flag to disable embedded polyfills#261
skarllot merged 1 commit intomainfrom
fix/disable-polyfill-flag

Conversation

@skarllot
Copy link
Copy Markdown
Owner

@skarllot skarllot commented Mar 29, 2026

Summary

  • Guards the embedded InternalPolyfill types (SpanExtensions, SpanLineEnumerator, StringBuilderMemory) behind a #if !NO_RAIQUB_SOURCEGENERATORS_POLYFILL compile-time flag
  • Fixes duplicate type definition errors for projects that already provide these types (e.g. via the PolyFill library)
  • Documents the flag in both the root README.md and src/InterpolationCodeWriter.CSharp.Sources/README.md

Test plan

  • Verify the project builds normally (without the flag) — polyfill types should be compiled as before
  • Verify the project builds with NO_RAIQUB_SOURCEGENERATORS_POLYFILL defined — polyfill types should be excluded
  • Verify no regression in existing tests

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added configuration option to disable embedded polyfill types via compiler constant, preventing duplicate type definition errors when targeting older frameworks.
  • Documentation

    • Added "Advanced Configuration" and "Configuration" sections to README files with instructions for disabling built-in polyfills.

…d polyfills

Guards the InternalPolyfill types behind the flag so that projects already providing
equivalent types (e.g. via PolyFill) can opt out and avoid duplicate type definition
errors. Documents the flag in both the root README and the CSharp.Sources README.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.88%. Comparing base (768b7ab) to head (6ea8e8f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #261   +/-   ##
=======================================
  Coverage   88.88%   88.88%           
=======================================
  Files          19       19           
  Lines        1332     1332           
  Branches      101      101           
=======================================
  Hits         1184     1184           
  Misses        104      104           
  Partials       44       44           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@skarllot skarllot changed the title feat: add NO_RAIQUB_SOURCEGENERATORS_POLYFILL flag to disable embedded polyfills fix: add NO_RAIQUB_SOURCEGENERATORS_POLYFILL flag to disable embedded polyfills Mar 29, 2026
@skarllot skarllot merged commit 207120a into main Mar 29, 2026
7 checks passed
@skarllot skarllot deleted the fix/disable-polyfill-flag branch March 29, 2026 22:27
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 29, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 93ed83a5-0ae9-4ade-ba56-3aaee81cffb8

📥 Commits

Reviewing files that changed from the base of the PR and between 768b7ab and 6ea8e8f.

📒 Files selected for processing (5)
  • README.md
  • src/InternalPolyfill/SpanExtensions.cs
  • src/InternalPolyfill/SpanLineEnumerator.cs
  • src/InternalPolyfill/StringBuilderMemory.cs
  • src/InterpolationCodeWriter.CSharp.Sources/README.md

📝 Walkthrough

Walkthrough

This PR adds compile-time guards (NO_RAIQUB_SOURCEGENERATORS_POLYFILL) around three internal polyfill types to allow consuming projects to disable embedded polyfills. Documentation updates to two README files explain how to define this compiler constant to prevent duplicate type definition errors.

Changes

Cohort / File(s) Summary
Documentation Updates
README.md, src/InterpolationCodeWriter.CSharp.Sources/README.md
Added "Advanced Configuration" and "Configuration" sections documenting the NO_RAIQUB_SOURCEGENERATORS_POLYFILL compiler constant for disabling embedded polyfills.
Internal Polyfill Conditional Compilation
src/InternalPolyfill/SpanExtensions.cs, src/InternalPolyfill/SpanLineEnumerator.cs, src/InternalPolyfill/StringBuilderMemory.cs
Wrapped internal polyfill types with #if !NO_RAIQUB_SOURCEGENERATORS_POLYFILL / #endif directives to conditionally exclude them from compilation when the constant is defined.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • fgodoy-lepaho

Poem

🐰 With polyfills wrapped in guards so tight,
Consumers choose what fits just right,
A constant flips the switch with ease,
No duplicate types to displease,
The sources dance to a gentler beat! ✨

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/disable-polyfill-flag

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants