Skip to content

refactor: convert the serialization pipeline to async - #1

Merged
yousif-khalil-abdulkarim merged 10 commits into
mainfrom
enhancement/converting-to-async-funcs
Oct 7, 2026
Merged

yousif-khalil-abdulkarim merged 10 commits into
mainfrom
enhancement/converting-to-async-funcs

Conversation

@yousif-khalil-abdulkarim

Copy link
Copy Markdown
Contributor

What

Converts the serialization pipeline to async so transformers can be asynchronous.

  • util.find / forEach / findArr now await their callbacks (also removes the Array#find shortcut in find, which returned the first entry whenever the predicate was async)
  • accessDeep.setDeep awaits its mapper
  • composite rules (class, symbol, custom, typed-array) are async in every phase, and transformValue awaits both the transformed value and the annotation
  • custom-transformer-registry accepts async isApplicable / serialize / deserialize
  • plainer awaits walker, traverse and the annotation-application passes
  • SuperJSON.serialize / deserialize / stringify / parse return promises
  • tsconfig options split into tsconfig.base.json + tsconfig.check.json (npm run check)

Breaking change

serialize, deserialize, stringify and parse now return promises and must be awaited. The package is also renamed to @eridu-tech/superjson.

Verification

npm run test -> 7 test files passed, 86 passed | 1 skipped | 1 todo

yousif-khalil-abdulkarim and others added 10 commits October 8, 2026 00:51
- move compilerOptions out of tsconfig.json into tsconfig.base.json and have
  tsconfig.json extend it
- add tsconfig.check.json plus an "npm run check" script that typechecks the
  whole of src, including test files

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Await the callbacks so callers can pass async predicates/visitors, and drop
the `find` shortcut through Array#find, which returned the first entry
unconditionally once the predicate became async.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Await the mapper so callers can transform values asynchronously, and update
its tests to await the (now async) call.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
CustomTransfomer.isApplicable/serialize/deserialize may now return promises,
and findApplicable resolves the first applicable transformer asynchronously.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Make the composite rules (class, symbol, custom, typed-array) async in every
phase and await both the transformed value and the annotation in
transformValue, so serialized output no longer contains unresolved promises.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
walker, traverse, applyValueAnnotations and applyReferentialEqualityAnnotations
now await their recursive and mapper work, so async transformers and
untransformers are properly resolved before their results are assigned.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
serialize, deserialize, stringify and parse now return promises, and the test
suite is updated to await them.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Rename the package to @eridu-tech/superjson and keep the lockfile's root
name in sync.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Benchmark.js only awaits an asynchronous test when it is registered with
{ defer: true } and the callback resolves the deferred. Without it the harness
measured just the synchronous prefix of the test, firing thousands of
unresolved serialize/deserialize pipelines per second until the heap was
exhausted (FATAL ERROR: Ineffective mark-compacts near heap limit).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
github-action-benchmark unconditionally fetches the gh-pages branch to read
previous results, but this repository has no gh-pages branch, so the step
failed every job with "fatal: couldn't find remote ref gh-pages". With no
stored baseline there was nothing to compare against anyway.

Also drops the now-unused `tee output.txt` (it only existed to feed the
action's output-file-path, and the pipeline's exit code came from tee, which
masked benchmark failures).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@yousif-khalil-abdulkarim
yousif-khalil-abdulkarim merged commit 6a5edde into main Oct 7, 2026
4 checks passed
@yousif-khalil-abdulkarim
yousif-khalil-abdulkarim deleted the enhancement/converting-to-async-funcs branch October 7, 2026 23:36
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