@lynx-js/react 0.111.0 → 0.111.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +58 -0
- package/components/lib/DeferredListItem.d.ts +3 -1
- package/components/lib/DeferredListItem.jsx +4 -2
- package/components/lib/DeferredListItem.jsx.map +1 -1
- package/components/src/DeferredListItem.tsx +5 -3
- package/package.json +6 -1
- package/refresh/.turbo/turbo-build.log +7 -3
- package/refresh/dist/index.js +223 -284
- package/refresh/package.json +3 -4
- package/refresh/rslib.config.ts +24 -0
- package/runtime/debug/index.cjs +8 -0
- package/runtime/debug/index.d.ts +4 -0
- package/runtime/debug/index.js +5 -0
- package/runtime/lib/alog/index.d.ts +1 -0
- package/runtime/lib/alog/index.js +8 -0
- package/runtime/lib/alog/index.js.map +1 -0
- package/runtime/lib/alog/render.d.ts +1 -0
- package/runtime/lib/alog/render.js +19 -0
- package/runtime/lib/alog/render.js.map +1 -0
- package/runtime/lib/backgroundSnapshot.d.ts +1 -0
- package/runtime/lib/backgroundSnapshot.js +31 -17
- package/runtime/lib/backgroundSnapshot.js.map +1 -1
- package/runtime/lib/debug/component-stack.d.ts +33 -0
- package/runtime/lib/debug/component-stack.js +145 -0
- package/runtime/lib/debug/component-stack.js.map +1 -0
- package/runtime/lib/debug/formatPatch.d.ts +2 -0
- package/runtime/lib/debug/formatPatch.js +27 -0
- package/runtime/lib/debug/formatPatch.js.map +1 -0
- package/runtime/lib/debug/printSnapshot.d.ts +1 -1
- package/runtime/lib/debug/printSnapshot.js +0 -4
- package/runtime/lib/debug/printSnapshot.js.map +1 -1
- package/runtime/lib/debug/profile.js +1 -3
- package/runtime/lib/debug/profile.js.map +1 -1
- package/runtime/lib/hydrate.js +11 -7
- package/runtime/lib/hydrate.js.map +1 -1
- package/runtime/lib/lifecycle/patch/commit.js +1 -1
- package/runtime/lib/lifecycle/patch/commit.js.map +1 -1
- package/runtime/lib/lifecycle/patch/snapshotPatch.d.ts +4 -0
- package/runtime/lib/lifecycle/patch/snapshotPatch.js +28 -0
- package/runtime/lib/lifecycle/patch/snapshotPatch.js.map +1 -1
- package/runtime/lib/lynx.js +9 -0
- package/runtime/lib/lynx.js.map +1 -1
- package/runtime/lib/pendingListUpdates.d.ts +2 -1
- package/runtime/lib/pendingListUpdates.js +16 -4
- package/runtime/lib/pendingListUpdates.js.map +1 -1
- package/runtime/lib/renderToOpcodes/constants.d.ts +2 -0
- package/runtime/lib/renderToOpcodes/constants.js +2 -0
- package/runtime/lib/renderToOpcodes/constants.js.map +1 -1
- package/runtime/lib/root.d.ts +6 -0
- package/runtime/lib/root.js +4 -0
- package/runtime/lib/root.js.map +1 -1
- package/runtime/lib/snapshot/platformInfo.js +5 -3
- package/runtime/lib/snapshot/platformInfo.js.map +1 -1
- package/runtime/lib/snapshot/ref.d.ts +2 -2
- package/runtime/lib/snapshot/spread.js +3 -1
- package/runtime/lib/snapshot/spread.js.map +1 -1
- package/runtime/lib/snapshot.js +13 -7
- package/runtime/lib/snapshot.js.map +1 -1
- package/runtime/lib/utils.d.ts +2 -0
- package/runtime/lib/utils.js +23 -2
- package/runtime/lib/utils.js.map +1 -1
- package/testing-library/dist/env/vitest.js +18 -7
- package/testing-library/dist/pure.js +3 -1
- package/testing-library/dist/vitest-global-setup.js +2 -2
- package/transform/dist/wasm.cjs +1 -1
- package/types/react.d.ts +13 -1
- package/worklet-runtime/dist/dev.js +403 -506
- package/worklet-runtime/dist/main.js +1 -517
- package/worklet-runtime/lib/workletRuntime.js +5 -5
- package/worklet-runtime/lib/workletRuntime.js.map +1 -1
- package/runtime/src/backgroundSnapshot.ts +0 -501
- package/runtime/src/compat/componentIs.ts +0 -30
- package/runtime/src/compat/initData.ts +0 -150
- package/runtime/src/compat/lynxComponent.ts +0 -79
- package/runtime/src/debug/debug.ts +0 -9
- package/runtime/src/debug/printSnapshot.ts +0 -28
- package/runtime/src/debug/profile.ts +0 -55
- package/runtime/src/document.ts +0 -84
- package/runtime/src/gesture/processGesture.ts +0 -89
- package/runtime/src/gesture/processGestureBagkround.ts +0 -19
- package/runtime/src/gesture/types.ts +0 -44
- package/runtime/src/hooks/react.ts +0 -62
- package/runtime/src/hooks/useLynxGlobalEventListener.ts +0 -59
- package/runtime/src/hydrate.ts +0 -368
- package/runtime/src/index.ts +0 -94
- package/runtime/src/internal.ts +0 -63
- package/runtime/src/legacy-react-runtime/index.ts +0 -42
- package/runtime/src/lifecycle/destroy.ts +0 -34
- package/runtime/src/lifecycle/event/delayEvents.ts +0 -11
- package/runtime/src/lifecycle/event/delayLifecycleEvents.ts +0 -15
- package/runtime/src/lifecycle/event/jsReady.ts +0 -34
- package/runtime/src/lifecycle/pass.ts +0 -14
- package/runtime/src/lifecycle/patch/commit.ts +0 -214
- package/runtime/src/lifecycle/patch/error.ts +0 -61
- package/runtime/src/lifecycle/patch/isMainThreadHydrationFinished.ts +0 -13
- package/runtime/src/lifecycle/patch/snapshotPatch.ts +0 -65
- package/runtime/src/lifecycle/patch/snapshotPatchApply.ts +0 -145
- package/runtime/src/lifecycle/patch/updateMainThread.ts +0 -64
- package/runtime/src/lifecycle/ref/delay.ts +0 -99
- package/runtime/src/lifecycle/reload.ts +0 -97
- package/runtime/src/lifecycle/render.ts +0 -54
- package/runtime/src/lifecycleConstant.ts +0 -21
- package/runtime/src/list.ts +0 -307
- package/runtime/src/listUpdateInfo.ts +0 -221
- package/runtime/src/lynx/calledByNative.ts +0 -160
- package/runtime/src/lynx/component.ts +0 -113
- package/runtime/src/lynx/dynamic-js.ts +0 -36
- package/runtime/src/lynx/env.ts +0 -109
- package/runtime/src/lynx/injectLepusMethods.ts +0 -53
- package/runtime/src/lynx/lazy-bundle.ts +0 -175
- package/runtime/src/lynx/performance.ts +0 -148
- package/runtime/src/lynx/runWithForce.ts +0 -67
- package/runtime/src/lynx/tt.ts +0 -215
- package/runtime/src/lynx-api.ts +0 -455
- package/runtime/src/lynx.ts +0 -58
- package/runtime/src/opcodes.ts +0 -155
- package/runtime/src/pendingListUpdates.ts +0 -18
- package/runtime/src/renderToOpcodes/constants.ts +0 -24
- package/runtime/src/renderToOpcodes/index.ts +0 -306
- package/runtime/src/root.ts +0 -23
- package/runtime/src/snapshot/dynamicPartType.ts +0 -16
- package/runtime/src/snapshot/event.ts +0 -33
- package/runtime/src/snapshot/gesture.ts +0 -30
- package/runtime/src/snapshot/list.ts +0 -36
- package/runtime/src/snapshot/platformInfo.ts +0 -62
- package/runtime/src/snapshot/ref.ts +0 -139
- package/runtime/src/snapshot/spread.ts +0 -330
- package/runtime/src/snapshot/workletEvent.ts +0 -35
- package/runtime/src/snapshot/workletRef.ts +0 -88
- package/runtime/src/snapshot.ts +0 -634
- package/runtime/src/snapshotInstanceHydrationMap.ts +0 -17
- package/runtime/src/utils.ts +0 -44
- package/runtime/src/worklet/ctx.ts +0 -22
- package/runtime/src/worklet/destroy.ts +0 -16
- package/runtime/src/worklet/execMap.ts +0 -51
- package/runtime/src/worklet/functionCall.ts +0 -42
- package/runtime/src/worklet/functionality.ts +0 -29
- package/runtime/src/worklet/hmr.ts +0 -34
- package/runtime/src/worklet/indexMap.ts +0 -23
- package/runtime/src/worklet/runOnBackground.ts +0 -147
- package/runtime/src/worklet/runOnMainThread.ts +0 -50
- package/runtime/src/worklet/transformToWorklet.ts +0 -26
- package/runtime/src/worklet/workletRef.ts +0 -231
- package/runtime/src/worklet/workletRefPool.ts +0 -29
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,63 @@
|
|
|
1
1
|
# @lynx-js/react
|
|
2
2
|
|
|
3
|
+
## 0.111.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Optimize `componentAtIndex` by a few hundreds microseconds: avoiding manipulate `__pendingListUpdates` unless SnapshotInstance tree is changed ([#1201](https://github.com/lynx-family/lynx-stack/pull/1201))
|
|
8
|
+
|
|
9
|
+
- Support alog of component rendering on production for better error reporting. Enable it by using `REACT_ALOG=true rspeedy dev/build` or defining `__ALOG__` to `true` in `lynx.config.js`: ([#1164](https://github.com/lynx-family/lynx-stack/pull/1164))
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
export default defineConfig({
|
|
13
|
+
// ...
|
|
14
|
+
source: {
|
|
15
|
+
define: {
|
|
16
|
+
__ALOG__: true,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- Make `preact/debug` work with `@lynx-js/react`. ([#1222](https://github.com/lynx-family/lynx-stack/pull/1222))
|
|
23
|
+
|
|
24
|
+
- Introduce `@lynx-js/react/debug` which would include debugging warnings and error messages for common mistakes found. ([#1250](https://github.com/lynx-family/lynx-stack/pull/1250))
|
|
25
|
+
|
|
26
|
+
Add the import to `@lynx-js/react/debug` at the first line of the entry:
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
import '@lynx-js/react/debug';
|
|
30
|
+
import { root } from '@lynx-js/react';
|
|
31
|
+
|
|
32
|
+
import { App } from './App.jsx';
|
|
33
|
+
|
|
34
|
+
root.render(<App />);
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
- `<list-item/>` deferred now accepts an object with `unmountRecycled` property to control unmounting behavior when the item is recycled. ([#1302](https://github.com/lynx-family/lynx-stack/pull/1302))
|
|
38
|
+
|
|
39
|
+
For example, you can use it like this:
|
|
40
|
+
|
|
41
|
+
```jsx
|
|
42
|
+
<list-item defer={{ unmountRecycled: true }} item-key='1'>
|
|
43
|
+
<WillBeUnmountIfRecycled />
|
|
44
|
+
</list-item>;
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Now the component will be unmounted when it is recycled, which can help with performance in certain scenarios.
|
|
48
|
+
|
|
49
|
+
- Avoid some unexpected `__SetAttribute` in hydrate when `undefined` is passed as an attribute value to intrinsic elements, for example: ([#1318](https://github.com/lynx-family/lynx-stack/pull/1318))
|
|
50
|
+
|
|
51
|
+
```jsx
|
|
52
|
+
<image async-mode={undefined} />;
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## 0.111.1
|
|
56
|
+
|
|
57
|
+
### Patch Changes
|
|
58
|
+
|
|
59
|
+
- Wrap the main thread `renderPage` in preact `act` to ensure that the effects are flushed. ([#1170](https://github.com/lynx-family/lynx-stack/pull/1170))
|
|
60
|
+
|
|
3
61
|
## 0.111.0
|
|
4
62
|
|
|
5
63
|
### Minor Changes
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { FC, ReactNode } from 'react';
|
|
2
2
|
export interface DeferredListItemProps {
|
|
3
|
-
defer?: boolean
|
|
3
|
+
defer?: boolean | {
|
|
4
|
+
unmountRecycled?: boolean;
|
|
5
|
+
};
|
|
4
6
|
renderListItem: (children: ReactNode | undefined) => JSX.Element;
|
|
5
7
|
renderChildren: () => ReactNode;
|
|
6
8
|
}
|
|
@@ -16,8 +16,10 @@ export const DeferredListItem = ({ defer, renderListItem, renderChildren }) => {
|
|
|
16
16
|
setIsReady(true);
|
|
17
17
|
};
|
|
18
18
|
ctx.__extraProps['onRecycleComponent'] = () => {
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
if (defer && typeof defer === 'object' && defer.unmountRecycled) {
|
|
20
|
+
// unmount the component when recycled
|
|
21
|
+
setIsReady(false);
|
|
22
|
+
}
|
|
21
23
|
};
|
|
22
24
|
return () => {
|
|
23
25
|
delete ctx.__extraProps['onComponentAtIndex'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeferredListItem.jsx","sourceRoot":"","sources":["../src/DeferredListItem.tsx"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAI1D,OAAO,EAAE,YAAY,IAAI,aAAa,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE9F,OAAO,EAAE,YAAY,IAAI,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAQ/E,MAAM,CAAC,MAAM,gBAAgB,GAA8B,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,CAAC,CAAC,cAAc,CAAC,cAAc,EAAE,CAAC,CAAC;AACvC,CAAC,CAAC"}
|
|
@@ -9,7 +9,7 @@ import type { SnapshotInstance } from '@lynx-js/react/internal';
|
|
|
9
9
|
import { cloneElement as _cloneElementMainThread } from '@lynx-js/react/lepus';
|
|
10
10
|
|
|
11
11
|
export interface DeferredListItemProps {
|
|
12
|
-
defer?: boolean;
|
|
12
|
+
defer?: boolean | { unmountRecycled?: boolean };
|
|
13
13
|
renderListItem: (children: ReactNode | undefined) => JSX.Element;
|
|
14
14
|
renderChildren: () => ReactNode;
|
|
15
15
|
}
|
|
@@ -30,8 +30,10 @@ export const DeferredListItem: FC<DeferredListItemProps> = ({ defer, renderListI
|
|
|
30
30
|
setIsReady(true);
|
|
31
31
|
};
|
|
32
32
|
ctx!.__extraProps['onRecycleComponent'] = () => {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
if (defer && typeof defer === 'object' && defer.unmountRecycled) {
|
|
34
|
+
// unmount the component when recycled
|
|
35
|
+
setIsReady(false);
|
|
36
|
+
}
|
|
35
37
|
};
|
|
36
38
|
|
|
37
39
|
return () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/react",
|
|
3
|
-
"version": "0.111.
|
|
3
|
+
"version": "0.111.2",
|
|
4
4
|
"description": "ReactLynx is a framework for developing Lynx applications with familiar React.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
"lazy": "./runtime/lazy/react.js",
|
|
15
15
|
"default": "./runtime/lib/index.js"
|
|
16
16
|
},
|
|
17
|
+
"./debug": {
|
|
18
|
+
"types": "./runtime/debug/index.d.ts",
|
|
19
|
+
"lazy": "./runtime/debug/index.js",
|
|
20
|
+
"default": "./runtime/debug/index.js"
|
|
21
|
+
},
|
|
17
22
|
"./experimental/lazy/import": {
|
|
18
23
|
"types": "./runtime/lazy/import.d.ts",
|
|
19
24
|
"default": "./runtime/lazy/import.js"
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
> @lynx-js/react-refresh@0.1.0 build /home/runner/work/lynx-stack/lynx-stack/packages/react/refresh
|
|
3
|
-
>
|
|
3
|
+
> rslib build
|
|
4
4
|
|
|
5
|
+
Rslib v0.10.5
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
info build started...
|
|
8
|
+
ready built in [1m0.11[22m s
|
|
9
|
+
|
|
10
|
+
[34mFile (esm) Size [39m
|
|
11
|
+
[2mdist/[22m[36mindex.js[39m 10.5 kB
|
|
7
12
|
|
|
8
|
-
⚡ Done in 25ms
|