Skip to content

refactor: make structuredClone pure without globalThis - #2

Merged
antfu merged 1 commit into
mainfrom
antfu/pure-structured-clone
Mar 12, 2026
Merged

antfu merged 1 commit into
mainfrom
antfu/pure-structured-clone

Conversation

@antfu

@antfu antfu commented Mar 12, 2026

Copy link
Copy Markdown
Member

Make the exported structuredClone function pure by removing its dependency on globalThis.structuredClone. It now always uses the serialize/deserialize implementation path.

  • Simplify structuredClone export to a pure function
  • Remove globalThis checks and native delegation
  • Update documentation to reflect pure implementation
  • Remove global polyfill example (no longer delegates to native)

All tests pass.

@antfu
antfu merged commit 83be4c6 into main Mar 12, 2026
4 checks passed
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