Skip to content

Commit 3206cb1

Browse files
authored
chore(Worklets): remove experimental label from Bundle Mode (#9584)
## Summary Let's ## Test plan go!!!
1 parent 6ecae81 commit 3206cb1

19 files changed

Lines changed: 114 additions & 32 deletions

File tree

apps/common-app/src/apps/reanimated/examples/AboutExample.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ import {
1212
getStaticFeatureFlag as getStaticFeatureFlagReanimated,
1313
setDynamicFeatureFlag as setDynamicFeatureFlagReanimated,
1414
} from 'react-native-reanimated';
15-
import { getStaticFeatureFlag as getStaticFeatureFlagWorklets } from 'react-native-worklets';
15+
import {
16+
getStaticFeatureFlag as getStaticFeatureFlagWorklets,
17+
isBundleModeEnabled,
18+
} from 'react-native-worklets';
1619

1720
function isWeb() {
1821
return Platform.OS === 'web';
@@ -61,10 +64,6 @@ function getReactNativeVersion() {
6164
return `${major}.${minor}.${patch}${prerelease ? `-${prerelease}` : ''}`;
6265
}
6366

64-
function isBundleModeEnabled() {
65-
return !!globalThis._WORKLETS_BUNDLE_MODE_ENABLED;
66-
}
67-
6867
const staticFlagsReanimated = [
6968
'DISABLE_COMMIT_PAUSING_MECHANISM',
7069
'ANDROID_SYNCHRONOUSLY_UPDATE_UI_PROPS',

apps/fabric-example/ios/Podfile.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/tvos-example/ios/Podfile.lock

Lines changed: 29 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/docs-worklets/docs/bundleMode/overview.mdx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,14 @@ dark: useBaseUrl('/img/bundleMode-dark.png'),
1717

1818
# Overview
1919

20-
Bundle Mode is an experimental feature that gives worklets access to your whole JavaScript bundle - meaning that any code that's present in the bundle can be executed in any worklet and on any runtime. This means that third party libraries can be used in worklets without the need to patch them. It's also a performance improvement as worklets' code can benefit from all the optimizations that pre-compiled bytecode offers.
20+
Bundle Mode is a feature that gives worklets access to your whole JavaScript bundle - meaning that any code that's present in the bundle can be executed in any worklet and on any runtime. This means that third party libraries can be used in worklets without the need to patch them. It's also a performance improvement as worklets' code can benefit from all the optimizations that pre-compiled bytecode offers.
2121

22-
**We envision the Bundle Mode to be the default way of using worklets in the future.**
22+
**Bundle Mode is considered stable as of version 0.10.0.**
23+
24+
**Bundle Mode will be the default way of using worklets in the future.**
2325

2426
Instructions on how to enable it can be found [here](/docs/bundleMode/setup).
27+
28+
## Legacy Eval Mode
29+
30+
The former way of using worklets - where each worklet is serialized as a string and evaluated individually on the Worklet Runtime - is referred to as **Legacy Eval Mode**. It's still the default mode of running worklets, but we strongly recommend opting out of it with the Bundle Mode.

docs/docs-worklets/docs/guides/call-tables.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Call tables are quick references that show **where a given scheduling function c
99

1010
### Why does Bundle Mode matter?
1111

12-
Without Bundle Mode, Worklet Runtimes only have a subset of functionalities of the RN Runtime, due to limitations of serialization of worklets. With Bundle Mode enabled, every runtime has access to the full JavaScript bundle, so most threading APIs become available on all runtimes.
12+
In [Legacy Eval Mode](/docs/bundleMode#legacy-eval-mode), Worklet Runtimes only have a subset of functionalities of the RN Runtime, due to limitations of serialization of worklets. With Bundle Mode enabled, every runtime has access to the full JavaScript bundle, so most threading APIs become available on all runtimes.
1313

1414
### How to read a call table
1515

docs/docs-worklets/docs/memory/createSerializable.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,4 @@ object.a = 10; // <-- Warning: You can't mutate the object after serializing it
7575
- This function is rarely used as in almost all cases Worklets handle the creation of Serializables for you.
7676
- This function includes cycle detection to prevent infinite recursion.
7777
- `jsi::NativeState` of a passed value is preserved during serialization.
78-
- Outside of [Bundle Mode](/docs/bundleMode/), `createSerializable` can be called only on the [RN Runtime](/docs/fundamentals/runtimeKinds#rn-runtime). In Bundle Mode, it can be called from any Runtime. If you need to create a Serializable on a [Worklet Runtime](/docs/fundamentals/runtimeKinds#worklet-runtime) outside of Bundle Mode, use deprecated [makeShareableCloneOnUIRecursive](/docs/memory/makeShareableCloneOnUIRecursive) instead.
78+
- In [Legacy Eval Mode](/docs/bundleMode#legacy-eval-mode), `createSerializable` can be called only on the [RN Runtime](/docs/fundamentals/runtimeKinds#rn-runtime). In Bundle Mode, it can be called from any Runtime. If you need to create a Serializable on a [Worklet Runtime](/docs/fundamentals/runtimeKinds#worklet-runtime) in Legacy Eval Mode, use deprecated [makeShareableCloneOnUIRecursive](/docs/memory/makeShareableCloneOnUIRecursive) instead.

docs/docs-worklets/docs/memory/createSynchronizable.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ The initial value to be held by the created Synchronizable. As it has to be seri
3535

3636
## Remarks
3737

38-
- Outside of [Bundle Mode](/docs/bundleMode/), `createSynchronizable` can be called only on the [RN Runtime](/docs/fundamentals/runtimeKinds#rn-runtime). In Bundle Mode, it can be called from any Runtime.
38+
- In [Legacy Eval Mode](/docs/bundleMode#legacy-eval-mode), `createSynchronizable` can be called only on the [RN Runtime](/docs/fundamentals/runtimeKinds#rn-runtime). In Bundle Mode, it can be called on any Runtime.

docs/docs-worklets/src/components/CallTable/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ function renderCellValue(value: boolean) {
2727
export function CallTable({ bundleMode, noBundleMode }: CallTableProps) {
2828
const rows = [
2929
{
30-
label: 'Enabled',
30+
label: 'Bundle Mode',
3131
data: bundleMode,
3232
className: styles.bundleEnabled,
3333
},
3434
{
35-
label: 'Disabled',
35+
label: 'Legacy Eval Mode',
3636
data: noBundleMode,
3737
className: styles.bundleDisabled,
3838
},
@@ -43,7 +43,7 @@ export function CallTable({ bundleMode, noBundleMode }: CallTableProps) {
4343
<table className={styles.table}>
4444
<thead>
4545
<tr>
46-
<th scope="col">Bundle Mode</th>
46+
<th scope="col">Mode</th>
4747
<th scope="col">RN Runtime</th>
4848
<th scope="col">UI Runtime</th>
4949
<th scope="col">Worker Runtime</th>

docs/docs-worklets/src/theme/DocSidebar/index.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ export default function DocSidebarWrapper(props) {
1414
};
1515

1616
const newItems = [];
17-
const experimentalItems = [
18-
'bundleMode/overview',
19-
'bundleMode/setup',
20-
'bundleMode/usage',
21-
];
17+
const experimentalItems = [];
2218
const unreleasedItems = [];
2319
const deprecatedItems = [
2420
'threading/callMicrotasks',

docs/docs-worklets/versioned_docs/version-0.10/bundleMode/overview.mdx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@ dark: useBaseUrl('/img/bundleMode-dark.png'),
1717

1818
# Overview
1919

20-
Bundle Mode is an experimental feature that gives worklets access to your whole JavaScript bundle - meaning that any code that's present in the bundle can be executed in any worklet and on any runtime. This means that third party libraries can be used in worklets without the need to patch them. It's also a performance improvement as worklets' code can benefit from all the optimizations that pre-compiled bytecode offers.
20+
Bundle Mode is a feature that gives worklets access to your whole JavaScript bundle - meaning that any code that's present in the bundle can be executed in any worklet and on any runtime. This means that third party libraries can be used in worklets without the need to patch them. It's also a performance improvement as worklets' code can benefit from all the optimizations that pre-compiled bytecode offers.
2121

22-
**We envision the Bundle Mode to be the default way of using worklets in the future.**
22+
**Bundle Mode will be the default way of using worklets in the future.**
2323

2424
Instructions on how to enable it can be found [here](/docs/bundleMode/setup).
25+
26+
## Legacy Eval Mode
27+
28+
The former way of using worklets - where each worklet is serialized as a string and evaluated individually on the Worklet Runtime - is referred to as **Legacy Eval Mode**. It's still the default mode of running worklets, but we strongly recommend opting out of it with the Bundle Mode.

0 commit comments

Comments
 (0)