Skip to content

Add polyfills for Undici and Canvas compatibility#36

Merged
jburnhams merged 1 commit intomainfrom
add-undici-canvas-polyfills
Nov 29, 2025
Merged

Add polyfills for Undici and Canvas compatibility#36
jburnhams merged 1 commit intomainfrom
add-undici-canvas-polyfills

Conversation

@google-labs-jules
Copy link
Contributor

Implemented polyfills for TextEncoder, TextDecoder, Blob.prototype.arrayBuffer, setTimeout.refresh, and Canvas event listeners to improve compatibility with Undici and Leaflet in Node.js/JSDOM environments. Verified with new and existing tests.


PR created automatically by Jules for task 17702599654667614791 started by @jburnhams

- Added TextEncoder/TextDecoder and Blob.prototype.arrayBuffer polyfills in `src/polyfills/undici.ts` using dynamic require to avoid issues in some test environments.
- Added `setTimeout(...).refresh()` polyfill.
- Added `ensureCanvasPolyfills` in `src/polyfills/canvas.ts` to patch `@napi-rs/canvas` instances with `addEventListener` and `removeEventListener` no-ops, ensuring Leaflet can interact with them safely.
- Applied canvas polyfills in `src/index.ts` initialization.
- Added `tests/polyfills.test.ts` to verify these polyfills.
- Skipped `L.DomEvent` patch as it caused instability in existing tests.
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

@jburnhams jburnhams marked this pull request as ready for review November 29, 2025 17:08
@jburnhams jburnhams merged commit f1f0c2c into main Nov 29, 2025
4 checks passed
@jburnhams jburnhams deleted the add-undici-canvas-polyfills branch November 29, 2025 17:08
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.

1 participant