Skip to content

Conversation

@tsaichien
Copy link
Contributor

Summary:
Add a new optional interface ISerialization to JSI. This interface
contains two APIs to copy objects from one runtime to another runtime.

Two methods are introduced in this interface:

serialize will take in some JS value (represented by jsi::Value) and
serialize the object into an opaque Serialize object. The lifetime of
the serialized object is independent from the original object.

deserialize will take in the serialized object and deserialize it into
the runtime, returning the created JS object.

Note that objects can only be copied into another runtime instance of
the same type. For example, a serialized object produced by the Hermes
runtime can only be deserialized by another Hermes runtime.

Differential Revision: D76547681

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 16, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76547681

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76547681

tsaichien added a commit to tsaichien/react-native that referenced this pull request Aug 5, 2025
Summary:

Changelog: [Internal]

Add a new optional interface `ISerialization` to JSI. This interface
contains two APIs to copy objects from one runtime to another runtime.

Two methods are introduced in this interface:

`serialize` will take in some JS value (represented by `jsi::Value`) and
serialize the object into an opaque `Serialize` object. The lifetime of
the serialized object is independent from the original object.

`deserialize` will take in the serialized object and deserialize it into
the runtime, returning the created JS object.

Note that objects can only be copied into another runtime instance of
the same type. For example, a serialized object produced by the Hermes
runtime can only be deserialized by another Hermes runtime.

Reviewed By: dannysu

Differential Revision: D76547681
tsaichien added a commit to tsaichien/react-native that referenced this pull request Aug 8, 2025
Summary:

Changelog: [Internal]

Add a new optional interface `ISerialization` to JSI. This interface
contains two APIs to copy objects from one runtime to another runtime.

Two methods are introduced in this interface:

`serialize` will take in some JS value (represented by `jsi::Value`) and
serialize the object into an opaque `Serialize` object. The lifetime of
the serialized object is independent from the original object.

`deserialize` will take in the serialized object and deserialize it into
the runtime, returning the created JS object.

Note that objects can only be copied into another runtime instance of
the same type. For example, a serialized object produced by the Hermes
runtime can only be deserialized by another Hermes runtime.

Reviewed By: dannysu

Differential Revision: D76547681
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76547681

tsaichien added a commit to tsaichien/react-native that referenced this pull request Aug 8, 2025
Summary:
Pull Request resolved: facebook#52624

Changelog: [Internal]

Add a new optional interface `ISerialization` to JSI. This interface
contains two APIs to copy objects from one runtime to another runtime.

Two methods are introduced in this interface:

`serialize` will take in some JS value (represented by `jsi::Value`) and
serialize the object into an opaque `Serialize` object. The lifetime of
the serialized object is independent from the original object.

`deserialize` will take in the serialized object and deserialize it into
the runtime, returning the created JS object.

Note that objects can only be copied into another runtime instance of
the same type. For example, a serialized object produced by the Hermes
runtime can only be deserialized by another Hermes runtime.

Reviewed By: dannysu

Differential Revision: D76547681
@tsaichien tsaichien force-pushed the export-D76547681 branch 2 times, most recently from f68955f to ce8550d Compare August 14, 2025 19:10
tsaichien added a commit to tsaichien/react-native that referenced this pull request Aug 14, 2025
Summary:

Changelog: [Internal]

Add a new optional interface `ISerialization` to JSI. This interface
contains two APIs to copy objects from one runtime to another runtime.

Two methods are introduced in this interface:

`serialize` will take in some JS value (represented by `jsi::Value`) and
serialize the object into an opaque `Serialize` object. The lifetime of
the serialized object is independent from the original object.

`deserialize` will take in the serialized object and deserialize it into
the runtime, returning the created JS object.

Note that objects can only be copied into another runtime instance of
the same type. For example, a serialized object produced by the Hermes
runtime can only be deserialized by another Hermes runtime.

Reviewed By: dannysu

Differential Revision: D76547681
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76547681

tsaichien added a commit to tsaichien/react-native that referenced this pull request Aug 14, 2025
Summary:
Pull Request resolved: facebook#52624

Changelog: [Internal]

Add a new optional interface `ISerialization` to JSI. This interface
contains two APIs to copy objects from one runtime to another runtime.

Two methods are introduced in this interface:

`serialize` will take in some JS value (represented by `jsi::Value`) and
serialize the object into an opaque `Serialize` object. The lifetime of
the serialized object is independent from the original object.

`deserialize` will take in the serialized object and deserialize it into
the runtime, returning the created JS object.

Note that objects can only be copied into another runtime instance of
the same type. For example, a serialized object produced by the Hermes
runtime can only be deserialized by another Hermes runtime.

Reviewed By: dannysu

Differential Revision: D76547681
tsaichien added a commit to tsaichien/react-native that referenced this pull request Aug 25, 2025
Summary:

Changelog: [Internal]

Add a new optional interface `ISerialization` to JSI. This interface
contains two APIs to copy objects from one runtime to another runtime.

Two methods are introduced in this interface:

`serialize` will take in some JS value (represented by `jsi::Value`) and
serialize the object into an opaque `Serialize` object. The lifetime of
the serialized object is independent from the original object.

`deserialize` will take in the serialized object and deserialize it into
the runtime, returning the created JS object.

Note that objects can only be copied into another runtime instance of
the same type. For example, a serialized object produced by the Hermes
runtime can only be deserialized by another Hermes runtime.

Reviewed By: dannysu

Differential Revision: D76547681
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76547681

tsaichien added a commit to tsaichien/react-native that referenced this pull request Aug 25, 2025
Summary:
Pull Request resolved: facebook#52624

Changelog: [Internal]

Add a new optional interface `ISerialization` to JSI. This interface
contains two APIs to copy objects from one runtime to another runtime.

Two methods are introduced in this interface:

`serialize` will take in some JS value (represented by `jsi::Value`) and
serialize the object into an opaque `Serialize` object. The lifetime of
the serialized object is independent from the original object.

`deserialize` will take in the serialized object and deserialize it into
the runtime, returning the created JS object.

Note that objects can only be copied into another runtime instance of
the same type. For example, a serialized object produced by the Hermes
runtime can only be deserialized by another Hermes runtime.

Reviewed By: dannysu

Differential Revision: D76547681
@tsaichien tsaichien force-pushed the export-D76547681 branch 2 times, most recently from 860b9cb to 1637df1 Compare August 26, 2025 18:16
tsaichien added a commit to tsaichien/react-native that referenced this pull request Aug 26, 2025
Summary:

Changelog: [Internal]

Add a new optional interface `ISerialization` to JSI. This interface
contains two APIs to copy objects from one runtime to another runtime.

Two methods are introduced in this interface:

`serialize` will take in some JS value (represented by `jsi::Value`) and
serialize the object into an opaque `Serialize` object. The lifetime of
the serialized object is independent from the original object.

`deserialize` will take in the serialized object and deserialize it into
the runtime, returning the created JS object.

Note that objects can only be copied into another runtime instance of
the same type. For example, a serialized object produced by the Hermes
runtime can only be deserialized by another Hermes runtime.

Reviewed By: dannysu

Differential Revision: D76547681
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76547681

tsaichien added a commit to tsaichien/react-native that referenced this pull request Aug 26, 2025
Summary:
Pull Request resolved: facebook#52624

Changelog: [Internal]

Add a new optional interface `ISerialization` to JSI. This interface
contains two APIs to copy objects from one runtime to another runtime.

Two methods are introduced in this interface:

`serialize` will take in some JS value (represented by `jsi::Value`) and
serialize the object into an opaque `Serialize` object. The lifetime of
the serialized object is independent from the original object.

`deserialize` will take in the serialized object and deserialize it into
the runtime, returning the created JS object.

Note that objects can only be copied into another runtime instance of
the same type. For example, a serialized object produced by the Hermes
runtime can only be deserialized by another Hermes runtime.

Reviewed By: dannysu

Differential Revision: D76547681
@tsaichien tsaichien force-pushed the export-D76547681 branch 2 times, most recently from c00656b to df2a36b Compare August 27, 2025 23:18
tsaichien added a commit to tsaichien/react-native that referenced this pull request Aug 27, 2025
Summary:

Changelog: [Internal]

Add a new optional interface `ISerialization` to JSI. This interface
contains two APIs to copy objects from one runtime to another runtime.

Two methods are introduced in this interface:

`serialize` will take in some JS value (represented by `jsi::Value`) and
serialize the object into an opaque `Serialize` object. The lifetime of
the serialized object is independent from the original object.

`deserialize` will take in the serialized object and deserialize it into
the runtime, returning the created JS object.

Note that objects can only be copied into another runtime instance of
the same type. For example, a serialized object produced by the Hermes
runtime can only be deserialized by another Hermes runtime.

Reviewed By: dannysu

Differential Revision: D76547681
@facebook-github-bot
Copy link
Contributor

@tsaichien has exported this pull request. If you are a Meta employee, you can view the originating diff in D76547681.

@facebook-github-bot
Copy link
Contributor

@tsaichien has exported this pull request. If you are a Meta employee, you can view the originating diff in D76547681.

tsaichien added a commit to tsaichien/react-native that referenced this pull request Sep 19, 2025
Summary:

Changelog: [Internal]

Add a new optional interface `ISerialization` to JSI. This interface
contains two APIs to copy objects from one runtime to another runtime.

Two methods are introduced in this interface:

`serialize` will take in some JS value (represented by `jsi::Value`) and
serialize the object into an opaque `Serialize` object. The lifetime of
the serialized object is independent from the original object.

`deserialize` will take in the serialized object and deserialize it into
the runtime, returning the created JS object.

Note that objects can only be copied into another runtime instance of
the same type. For example, a serialized object produced by the Hermes
runtime can only be deserialized by another Hermes runtime.

Reviewed By: dannysu

Differential Revision: D76547681
tsaichien added a commit to tsaichien/react-native that referenced this pull request Oct 1, 2025
Summary:

Changelog: [Internal]

Add a new optional interface `ISerialization` to JSI. This interface
contains two APIs to copy objects from one runtime to another runtime.

Two methods are introduced in this interface:

`serialize` will take in some JS value (represented by `jsi::Value`) and
serialize the object into an opaque `Serialize` object. The lifetime of
the serialized object is independent from the original object.

`deserialize` will take in the serialized object and deserialize it into
the runtime, returning the created JS object.

Note that objects can only be copied into another runtime instance of
the same type. For example, a serialized object produced by the Hermes
runtime can only be deserialized by another Hermes runtime.

Reviewed By: dannysu

Differential Revision: D76547681
@meta-codesync
Copy link

meta-codesync bot commented Oct 1, 2025

@tsaichien has exported this pull request. If you are a Meta employee, you can view the originating Diff in D76547681.

tsaichien added a commit to tsaichien/react-native that referenced this pull request Oct 31, 2025
Summary:

Changelog: [Internal]

Add a new optional interface `ISerialization` to JSI. This interface
contains two APIs to copy objects from one runtime to another runtime.

Two methods are introduced in this interface:

`serialize` will take in some JS value (represented by `jsi::Value`) and
serialize the object into an opaque `Serialize` object. The lifetime of
the serialized object is independent from the original object.

`deserialize` will take in the serialized object and deserialize it into
the runtime, returning the created JS object.

Note that objects can only be copied into another runtime instance of
the same type. For example, a serialized object produced by the Hermes
runtime can only be deserialized by another Hermes runtime.

Reviewed By: dannysu

Differential Revision: D76547681
tsaichien added a commit to tsaichien/react-native that referenced this pull request Nov 12, 2025
Summary:

Changelog: [Internal]

Add a new optional interface `ISerialization` to JSI. This interface
contains two APIs to copy objects from one runtime to another runtime.

Two methods are introduced in this interface:

`serialize` will take in some JS value (represented by `jsi::Value`) and
serialize the object into an opaque `Serialize` object. The lifetime of
the serialized object is independent from the original object.

`deserialize` will take in the serialized object and deserialize it into
the runtime, returning the created JS object.

Note that objects can only be copied into another runtime instance of
the same type. For example, a serialized object produced by the Hermes
runtime can only be deserialized by another Hermes runtime.

Reviewed By: dannysu

Differential Revision: D76547681
tsaichien added a commit to tsaichien/react-native that referenced this pull request Nov 19, 2025
Summary:

Changelog: [Internal]

Add a new optional interface `ISerialization` to JSI. This interface
contains two APIs to copy objects from one runtime to another runtime.

Two methods are introduced in this interface:

`serialize` will take in some JS value (represented by `jsi::Value`) and
serialize the object into an opaque `Serialize` object. The lifetime of
the serialized object is independent from the original object.

`deserialize` will take in the serialized object and deserialize it into
the runtime, returning the created JS object.

Note that objects can only be copied into another runtime instance of
the same type. For example, a serialized object produced by the Hermes
runtime can only be deserialized by another Hermes runtime.

Reviewed By: dannysu

Differential Revision: D76547681
tsaichien added a commit to tsaichien/react-native that referenced this pull request Dec 1, 2025
Summary:

Changelog: [Internal]

Add a new optional interface `ISerialization` to JSI. This interface
contains two APIs to copy objects from one runtime to another runtime.

Two methods are introduced in this interface:

`serialize` will take in some JS value (represented by `jsi::Value`) and
serialize the object into an opaque `Serialize` object. The lifetime of
the serialized object is independent from the original object.

`deserialize` will take in the serialized object and deserialize it into
the runtime, returning the created JS object.

Note that objects can only be copied into another runtime instance of
the same type. For example, a serialized object produced by the Hermes
runtime can only be deserialized by another Hermes runtime.

Reviewed By: dannysu, fbmal7

Differential Revision: D76547681
tsaichien added a commit to tsaichien/react-native that referenced this pull request Dec 1, 2025
Summary:

Changelog: [Internal]

Add a new optional interface `ISerialization` to JSI. This interface
contains four APIs to clone objects from one runtime to another runtime.

Four methods are introduced in this interface:
* `serialize`: Takes in a JS value (represented by `jsi::Value`) and
serialize the value into an opaque `Serialized` object.

* `deserialize`: Takes in the `Serialized` object created by `serialize`
and deserialize it into the runtime, returning the created JS value.

* `serializeWithTransfer`: Takes in a JS value (represented by
`jsi::Value`) and a `transferList` (a `jsi::Array` of `jsi::Value`s).
This will serialize the `value` into an opaque `Serialize` object and
transfer the ownership of everything in `transferList` into the
`Serialized` object. If any non-transferable values is passed into the
transferList, this will throw. This `Serialized` object must only be
deserialized once.

* `deserializeWithTransfer`: Takes in the `Serialized` object created by
`serializeWithTransfer`. It will deserialize the object into the runtime
and  any value owned by the `Serialized` object will now be owned by the
current runtime. It will return an `jsi::Array` where the first value is
the deserialized value passed into `serializeWithTransfer`, followed by
all transferred values.

The lifetime of the `Serialized` object created from the APIs is
independent of the original object and runtime.

Note that objects can only be copied into another runtime instance of
the same type. For example, a serialized object produced by the Hermes
runtime can only be deserialized by another Hermes runtime.

Reviewed By: dannysu, fbmal7

Differential Revision: D76547681
Summary:

Changelog: [Internal]

Add a new optional interface `ISerialization` to JSI. This interface
contains four APIs to clone objects from one runtime to another runtime.

Four methods are introduced in this interface:
* `serialize`: Takes in a JS value (represented by `jsi::Value`) and
serialize the value into an opaque `Serialized` object.

* `deserialize`: Takes in the `Serialized` object created by `serialize`
and deserialize it into the runtime, returning the created JS value.

* `serializeWithTransfer`: Takes in a JS value (represented by
`jsi::Value`) and a `transferList` (a `jsi::Array` of `jsi::Value`s).
This will serialize the `value` into an opaque `Serialize` object and
transfer the ownership of everything in `transferList` into the
`Serialized` object. If any non-transferable values is passed into the
transferList, this will throw. This `Serialized` object must only be
deserialized once.

* `deserializeWithTransfer`: Takes in the `Serialized` object created by
`serializeWithTransfer`. It will deserialize the object into the runtime
and  any value owned by the `Serialized` object will now be owned by the
current runtime. It will return an `jsi::Array` where the first value is
the deserialized value passed into `serializeWithTransfer`, followed by
all transferred values.

The lifetime of the `Serialized` object created from the APIs is
independent of the original object and runtime.

Note that objects can only be copied into another runtime instance of
the same type. For example, a serialized object produced by the Hermes
runtime can only be deserialized by another Hermes runtime.

Reviewed By: dannysu, fbmal7

Differential Revision: D76547681
@meta-codesync meta-codesync bot closed this in 257f036 Dec 2, 2025
@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Dec 2, 2025
@meta-codesync
Copy link

meta-codesync bot commented Dec 2, 2025

This pull request has been merged in 257f036.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @tsaichien in 257f036

When will my fix make it into a release? | How to file a pick request?

meta-codesync bot pushed a commit to facebook/hermes that referenced this pull request Dec 2, 2025
Summary:
X-link: facebook/react-native#52624

Add a new optional interface `ISerialization` to JSI. This interface
contains four APIs to clone objects from one runtime to another runtime.

Four methods are introduced in this interface:
* `serialize`: Takes in a JS value (represented by `jsi::Value`) and
serialize the value into an opaque `Serialized` object.

* `deserialize`: Takes in the `Serialized` object created by `serialize`
and deserialize it into the runtime, returning the created JS value.

* `serializeWithTransfer`: Takes in a JS value (represented by
`jsi::Value`) and a `transferList` (a `jsi::Array` of `jsi::Value`s).
This will serialize the `value` into an opaque `Serialize` object and
transfer the ownership of everything in `transferList` into the
`Serialized` object. If any non-transferable values is passed into the
transferList, this will throw. This `Serialized` object must only be
deserialized once.

* `deserializeWithTransfer`: Takes in the `Serialized` object created by
`serializeWithTransfer`. It will deserialize the object into the runtime
and  any value owned by the `Serialized` object will now be owned by the
current runtime. It will return an `jsi::Array` where the first value is
the deserialized value passed into `serializeWithTransfer`, followed by
all transferred values.

The lifetime of the `Serialized` object created from the APIs is
independent of the original object and runtime.

Note that objects can only be copied into another runtime instance of
the same type. For example, a serialized object produced by the Hermes
runtime can only be deserialized by another Hermes runtime.

Changelog: [Internal]

Reviewed By: dannysu, fbmal7

Differential Revision: D76547681

fbshipit-source-id: 0c774f3f469c26d3894cac179f4ce5e32cf5ad7f
meta-codesync bot pushed a commit to facebook/hermes that referenced this pull request Dec 2, 2025
Summary:
X-link: facebook/react-native#52624

Add a new optional interface `ISerialization` to JSI. This interface
contains four APIs to clone objects from one runtime to another runtime.

Four methods are introduced in this interface:
* `serialize`: Takes in a JS value (represented by `jsi::Value`) and
serialize the value into an opaque `Serialized` object.

* `deserialize`: Takes in the `Serialized` object created by `serialize`
and deserialize it into the runtime, returning the created JS value.

* `serializeWithTransfer`: Takes in a JS value (represented by
`jsi::Value`) and a `transferList` (a `jsi::Array` of `jsi::Value`s).
This will serialize the `value` into an opaque `Serialize` object and
transfer the ownership of everything in `transferList` into the
`Serialized` object. If any non-transferable values is passed into the
transferList, this will throw. This `Serialized` object must only be
deserialized once.

* `deserializeWithTransfer`: Takes in the `Serialized` object created by
`serializeWithTransfer`. It will deserialize the object into the runtime
and  any value owned by the `Serialized` object will now be owned by the
current runtime. It will return an `jsi::Array` where the first value is
the deserialized value passed into `serializeWithTransfer`, followed by
all transferred values.

The lifetime of the `Serialized` object created from the APIs is
independent of the original object and runtime.

Note that objects can only be copied into another runtime instance of
the same type. For example, a serialized object produced by the Hermes
runtime can only be deserialized by another Hermes runtime.

Changelog: [Internal]

Reviewed By: dannysu, fbmal7

Differential Revision: D76547681

fbshipit-source-id: 0c774f3f469c26d3894cac179f4ce5e32cf5ad7f
cipolleschi pushed a commit to facebook/hermes that referenced this pull request Jan 14, 2026
Summary:
X-link: facebook/react-native#52624

Add a new optional interface `ISerialization` to JSI. This interface
contains four APIs to clone objects from one runtime to another runtime.

Four methods are introduced in this interface:
* `serialize`: Takes in a JS value (represented by `jsi::Value`) and
serialize the value into an opaque `Serialized` object.

* `deserialize`: Takes in the `Serialized` object created by `serialize`
and deserialize it into the runtime, returning the created JS value.

* `serializeWithTransfer`: Takes in a JS value (represented by
`jsi::Value`) and a `transferList` (a `jsi::Array` of `jsi::Value`s).
This will serialize the `value` into an opaque `Serialize` object and
transfer the ownership of everything in `transferList` into the
`Serialized` object. If any non-transferable values is passed into the
transferList, this will throw. This `Serialized` object must only be
deserialized once.

* `deserializeWithTransfer`: Takes in the `Serialized` object created by
`serializeWithTransfer`. It will deserialize the object into the runtime
and  any value owned by the `Serialized` object will now be owned by the
current runtime. It will return an `jsi::Array` where the first value is
the deserialized value passed into `serializeWithTransfer`, followed by
all transferred values.

The lifetime of the `Serialized` object created from the APIs is
independent of the original object and runtime.

Note that objects can only be copied into another runtime instance of
the same type. For example, a serialized object produced by the Hermes
runtime can only be deserialized by another Hermes runtime.

Changelog: [Internal]

Reviewed By: dannysu, fbmal7

Differential Revision: D76547681

fbshipit-source-id: 0c774f3f469c26d3894cac179f4ce5e32cf5ad7f
cipolleschi pushed a commit to facebook/hermes that referenced this pull request Jan 14, 2026
Summary:
X-link: facebook/react-native#52624

Add a new optional interface `ISerialization` to JSI. This interface
contains four APIs to clone objects from one runtime to another runtime.

Four methods are introduced in this interface:
* `serialize`: Takes in a JS value (represented by `jsi::Value`) and
serialize the value into an opaque `Serialized` object.

* `deserialize`: Takes in the `Serialized` object created by `serialize`
and deserialize it into the runtime, returning the created JS value.

* `serializeWithTransfer`: Takes in a JS value (represented by
`jsi::Value`) and a `transferList` (a `jsi::Array` of `jsi::Value`s).
This will serialize the `value` into an opaque `Serialize` object and
transfer the ownership of everything in `transferList` into the
`Serialized` object. If any non-transferable values is passed into the
transferList, this will throw. This `Serialized` object must only be
deserialized once.

* `deserializeWithTransfer`: Takes in the `Serialized` object created by
`serializeWithTransfer`. It will deserialize the object into the runtime
and  any value owned by the `Serialized` object will now be owned by the
current runtime. It will return an `jsi::Array` where the first value is
the deserialized value passed into `serializeWithTransfer`, followed by
all transferred values.

The lifetime of the `Serialized` object created from the APIs is
independent of the original object and runtime.

Note that objects can only be copied into another runtime instance of
the same type. For example, a serialized object produced by the Hermes
runtime can only be deserialized by another Hermes runtime.

Changelog: [Internal]

Reviewed By: dannysu, fbmal7

Differential Revision: D76547681

fbshipit-source-id: 0c774f3f469c26d3894cac179f4ce5e32cf5ad7f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants