Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
32 changes: 32 additions & 0 deletions .changeset/async-public-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
"@eridu-tech/superjson": major
---

The public API is now asynchronous: `stringify`, `parse`, `serialize` and `deserialize` return Promises, and custom transformers may perform async work.

### Breaking changes

`SuperJSON.stringify`, `SuperJSON.parse`, `SuperJSON.serialize` and `SuperJSON.deserialize` — together with the named exports `stringify`, `parse`, `serialize`, `deserialize` — are now `async`:

- `stringify(object)` returns `Promise<string>`
- `parse<T>(string)` returns `Promise<T>`
- `serialize(object)` returns `Promise<SuperJSONResult>`
- `deserialize<T>(payload)` returns `Promise<T>`

Callers must now `await` these methods. The registration methods (`registerClass`, `registerSymbol`, `registerCustom`, `allowErrorProps`) remain synchronous.

### Custom transformers

The `CustomTransfomer` hooks (`isApplicable`, `serialize`, `deserialize`) may now return either a value or a `Promise`, so custom transformers can perform asynchronous work (for example, lazily loading a class before serializing it).

### Migration

```ts
// before
const json = superjson.stringify(object);
const parsed = superjson.parse(json);

// after
const json = await superjson.stringify(object);
const parsed = await superjson.parse(json);
```
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.1.4/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Release

on:
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
release:
name: Release
runs-on: ubuntu-latest

permissions:
contents: write
id-token: write
pull-requests: write

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'

- name: Update npm
run: npm install -g npm

- name: Clear node-gyp cache
run: rm -rf ~/.cache/node-gyp

- name: Install dependencies
run: npm ci

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: npm run release
env:
# Use a PAT (not the default GITHUB_TOKEN) so the release it creates
# propagates the `release` event to other workflows.
# Falls back to GITHUB_TOKEN if the secret is not configured yet.
GITHUB_TOKEN: ${{ secrets.CHANGESETS_PAT || secrets.GITHUB_TOKEN }}
Loading
Loading