Skip to content

fix[serialize]: remove circular module dependencies - #2187

Merged
raon0211 merged 6 commits into
toss:mainfrom
MycroCosmo:fix/serialize-circular-dependencies
Nov 6, 2026
Merged

raon0211 merged 6 commits into
toss:mainfrom
MycroCosmo:fix/serialize-circular-dependencies

Conversation

@MycroCosmo

Copy link
Copy Markdown
Contributor

Summary

Fixes #2177. Importing orderBy from es-toolkit produces circular dependency warnings in Rollup.

Changes

  • Move the mutually recursive serialization helpers into one module without changing their behavior.
  • Add a regression test to check that importing orderBy does not produce circular dependency warnings.

@vercel

vercel Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
es-toolkit Ready Ready Preview Nov 6, 2026 1:58am UTC

Request Review

T3 Code Service User added 2 commits November 6, 2026 00:43
Move every serialize helper into src/util/serialize.ts and its tests into
src/util/serialize.spec.ts. The helpers are module-private, so the new
es-toolkit/util/serialize subpath only exposes serialize, and the tests
exercise them through serialize. Drop the now-unneeded util/serialize/*
null export.
# Conflicts:
#	src/util/serialize/compareValues.ts
#	src/util/serialize/serialize.ts
#	src/util/serialize/serializeObject.ts
#	src/util/serialize/serializePlainObject.ts
import/no-cycle in oxlint already forbids circular imports.
@raon0211
raon0211 merged commit 728a626 into toss:main Nov 6, 2026
12 of 13 checks passed
raon0211 added a commit that referenced this pull request Nov 6, 2026
#2192)

* test(browser-compat): harvest examples only from exported declarations

The case generator turned every JSDoc `@example` in a source file into a
browser test case, including those on module-private helpers. After #2187
merged the serialize helpers into src/util/serialize.ts, their examples
(serializeString, serializeNumber, ...) became cases that call functions
consumers cannot import, which broke the Browser Compat workflow on main.

Parse each file with the TypeScript compiler and collect only the JSDoc
attached to exported top-level declarations. This also drops the examples on
the non-exported RetryOptions and MapCache interfaces, so renumber the retry
skip entries, remove the orphaned memoize overrides, and give compat memoize
a runnable example of its own so it keeps a test case.

* test(compat/memoize): keep the example runnable on Node.js 6

Object.values is not available on Node.js 6, which es-toolkit/compat still
supports, so memoize(Object.values) threw 'Expected a function' there.
Memoize Object.keys instead.

---------

Co-authored-by: T3 Code <t3code@users.noreply.github.com>
@raon0211 raon0211 mentioned this pull request Nov 6, 2026

This branch was successfully deployed

1 active deployment
Preview — 474633af Deployed Nov 6, 2026 by vercel[bot]
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.

Circular dependencies with orderBy

2 participants