@lynx-js/react 0.105.0
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 +250 -0
- package/LICENSE +202 -0
- package/README.md +20 -0
- package/components/lib/Page.d.ts +3 -0
- package/components/lib/Page.js +56 -0
- package/components/lib/Page.js.map +1 -0
- package/components/lib/index.d.ts +1 -0
- package/components/lib/index.js +5 -0
- package/components/lib/index.js.map +1 -0
- package/components/src/Page.ts +75 -0
- package/components/src/index.ts +5 -0
- package/package.json +162 -0
- package/refresh/.gitignore +1 -0
- package/refresh/.npmignore +3 -0
- package/refresh/.turbo/turbo-build.log +8 -0
- package/refresh/dist/index.js +311 -0
- package/refresh/package.json +21 -0
- package/refresh/src/index.ts +6 -0
- package/refresh/src/prefresh.d.ts +11 -0
- package/refresh/tsconfig.json +4 -0
- package/refresh/turbo.json +15 -0
- package/runtime/jsx-dev-runtime/index.d.ts +5 -0
- package/runtime/jsx-dev-runtime/index.js +4 -0
- package/runtime/jsx-runtime/index.d.ts +4 -0
- package/runtime/jsx-runtime/index.js +4 -0
- package/runtime/lazy/import.d.ts +1 -0
- package/runtime/lazy/import.js +55 -0
- package/runtime/lazy/internal.js +39 -0
- package/runtime/lazy/jsx-dev-runtime.js +12 -0
- package/runtime/lazy/jsx-runtime.js +12 -0
- package/runtime/lazy/legacy-react-runtime.js +20 -0
- package/runtime/lazy/react-lepus.js +9 -0
- package/runtime/lazy/react.js +46 -0
- package/runtime/lazy/target.js +11 -0
- package/runtime/lepus/index.d.ts +4 -0
- package/runtime/lepus/index.js +43 -0
- package/runtime/lepus/jsx-dev-runtime/index.js +4 -0
- package/runtime/lepus/jsx-runtime/index.js +66 -0
- package/runtime/lib/backgroundSnapshot.d.ts +23 -0
- package/runtime/lib/backgroundSnapshot.js +348 -0
- package/runtime/lib/backgroundSnapshot.js.map +1 -0
- package/runtime/lib/compat/componentIs.d.ts +4 -0
- package/runtime/lib/compat/componentIs.js +20 -0
- package/runtime/lib/compat/componentIs.js.map +1 -0
- package/runtime/lib/compat/initData.d.ts +43 -0
- package/runtime/lib/compat/initData.js +93 -0
- package/runtime/lib/compat/initData.js.map +1 -0
- package/runtime/lib/compat/lynxComponent.d.ts +5 -0
- package/runtime/lib/compat/lynxComponent.js +71 -0
- package/runtime/lib/compat/lynxComponent.js.map +1 -0
- package/runtime/lib/debug/debug.d.ts +2 -0
- package/runtime/lib/debug/debug.js +9 -0
- package/runtime/lib/debug/debug.js.map +1 -0
- package/runtime/lib/debug/printSnapshot.d.ts +3 -0
- package/runtime/lib/debug/printSnapshot.js +21 -0
- package/runtime/lib/debug/printSnapshot.js.map +1 -0
- package/runtime/lib/debug/profile.d.ts +1 -0
- package/runtime/lib/debug/profile.js +51 -0
- package/runtime/lib/debug/profile.js.map +1 -0
- package/runtime/lib/document.d.ts +4 -0
- package/runtime/lib/document.js +49 -0
- package/runtime/lib/document.js.map +1 -0
- package/runtime/lib/gesture/processGesture.d.ts +4 -0
- package/runtime/lib/gesture/processGesture.js +48 -0
- package/runtime/lib/gesture/processGesture.js.map +1 -0
- package/runtime/lib/gesture/processGestureBagkround.d.ts +2 -0
- package/runtime/lib/gesture/processGestureBagkround.js +16 -0
- package/runtime/lib/gesture/processGestureBagkround.js.map +1 -0
- package/runtime/lib/gesture/types.d.ts +34 -0
- package/runtime/lib/gesture/types.js +13 -0
- package/runtime/lib/gesture/types.js.map +1 -0
- package/runtime/lib/hooks/react.d.ts +26 -0
- package/runtime/lib/hooks/react.js +35 -0
- package/runtime/lib/hooks/react.js.map +1 -0
- package/runtime/lib/hooks/useLynxGlobalEventListener.d.ts +29 -0
- package/runtime/lib/hooks/useLynxGlobalEventListener.js +53 -0
- package/runtime/lib/hooks/useLynxGlobalEventListener.js.map +1 -0
- package/runtime/lib/hydrate.d.ts +18 -0
- package/runtime/lib/hydrate.js +271 -0
- package/runtime/lib/hydrate.js.map +1 -0
- package/runtime/lib/index.d.ts +9 -0
- package/runtime/lib/index.js +46 -0
- package/runtime/lib/index.js.map +1 -0
- package/runtime/lib/internal.d.ts +26 -0
- package/runtime/lib/internal.js +41 -0
- package/runtime/lib/internal.js.map +1 -0
- package/runtime/lib/legacy-react-runtime/index.d.ts +7 -0
- package/runtime/lib/legacy-react-runtime/index.js +34 -0
- package/runtime/lib/legacy-react-runtime/index.js.map +1 -0
- package/runtime/lib/lifecycle/delayUnmount.d.ts +8 -0
- package/runtime/lib/lifecycle/delayUnmount.js +68 -0
- package/runtime/lib/lifecycle/delayUnmount.js.map +1 -0
- package/runtime/lib/lifecycle/destroy.d.ts +2 -0
- package/runtime/lib/lifecycle/destroy.js +21 -0
- package/runtime/lib/lifecycle/destroy.js.map +1 -0
- package/runtime/lib/lifecycle/pass.d.ts +3 -0
- package/runtime/lib/lifecycle/pass.js +12 -0
- package/runtime/lib/lifecycle/pass.js.map +1 -0
- package/runtime/lib/lifecycle/patchUpdate.d.ts +23 -0
- package/runtime/lib/lifecycle/patchUpdate.js +179 -0
- package/runtime/lib/lifecycle/patchUpdate.js.map +1 -0
- package/runtime/lib/lifecycle/reload.d.ts +3 -0
- package/runtime/lib/lifecycle/reload.js +63 -0
- package/runtime/lib/lifecycle/reload.js.map +1 -0
- package/runtime/lib/lifecycle/render.d.ts +2 -0
- package/runtime/lib/lifecycle/render.js +44 -0
- package/runtime/lib/lifecycle/render.js.map +1 -0
- package/runtime/lib/lifecycleConstant.d.ts +12 -0
- package/runtime/lib/lifecycleConstant.js +17 -0
- package/runtime/lib/lifecycleConstant.js.map +1 -0
- package/runtime/lib/list.d.ts +40 -0
- package/runtime/lib/list.js +305 -0
- package/runtime/lib/list.js.map +1 -0
- package/runtime/lib/lynx/calledByNative.d.ts +2 -0
- package/runtime/lib/lynx/calledByNative.js +113 -0
- package/runtime/lib/lynx/calledByNative.js.map +1 -0
- package/runtime/lib/lynx/component.d.ts +1 -0
- package/runtime/lib/lynx/component.js +69 -0
- package/runtime/lib/lynx/component.js.map +1 -0
- package/runtime/lib/lynx/dynamic-js.d.ts +2 -0
- package/runtime/lib/lynx/dynamic-js.js +31 -0
- package/runtime/lib/lynx/dynamic-js.js.map +1 -0
- package/runtime/lib/lynx/env.d.ts +1 -0
- package/runtime/lib/lynx/env.js +92 -0
- package/runtime/lib/lynx/env.js.map +1 -0
- package/runtime/lib/lynx/injectLepusMethods.d.ts +2 -0
- package/runtime/lib/lynx/injectLepusMethods.js +50 -0
- package/runtime/lib/lynx/injectLepusMethods.js.map +1 -0
- package/runtime/lib/lynx/lazy-bundle.d.ts +9 -0
- package/runtime/lib/lynx/lazy-bundle.js +119 -0
- package/runtime/lib/lynx/lazy-bundle.js.map +1 -0
- package/runtime/lib/lynx/performance.d.ts +29 -0
- package/runtime/lib/lynx/performance.js +100 -0
- package/runtime/lib/lynx/performance.js.map +1 -0
- package/runtime/lib/lynx/tt.d.ts +4 -0
- package/runtime/lib/lynx/tt.js +193 -0
- package/runtime/lib/lynx/tt.js.map +1 -0
- package/runtime/lib/lynx-api.d.ts +311 -0
- package/runtime/lib/lynx-api.js +116 -0
- package/runtime/lib/lynx-api.js.map +1 -0
- package/runtime/lib/lynx.d.ts +2 -0
- package/runtime/lib/lynx.js +91 -0
- package/runtime/lib/lynx.js.map +1 -0
- package/runtime/lib/opcodes.d.ts +2 -0
- package/runtime/lib/opcodes.js +59 -0
- package/runtime/lib/opcodes.js.map +1 -0
- package/runtime/lib/renderToOpcodes/constants.d.ts +17 -0
- package/runtime/lib/renderToOpcodes/constants.js +23 -0
- package/runtime/lib/renderToOpcodes/constants.js.map +1 -0
- package/runtime/lib/renderToOpcodes/index.d.ts +13 -0
- package/runtime/lib/renderToOpcodes/index.js +227 -0
- package/runtime/lib/renderToOpcodes/index.js.map +1 -0
- package/runtime/lib/root.d.ts +7 -0
- package/runtime/lib/root.js +17 -0
- package/runtime/lib/root.js.map +1 -0
- package/runtime/lib/snapshot/event.d.ts +3 -0
- package/runtime/lib/snapshot/event.js +24 -0
- package/runtime/lib/snapshot/event.js.map +1 -0
- package/runtime/lib/snapshot/gesture.d.ts +2 -0
- package/runtime/lib/snapshot/gesture.js +18 -0
- package/runtime/lib/snapshot/gesture.js.map +1 -0
- package/runtime/lib/snapshot/platformInfo.d.ts +4 -0
- package/runtime/lib/snapshot/platformInfo.js +35 -0
- package/runtime/lib/snapshot/platformInfo.js.map +1 -0
- package/runtime/lib/snapshot/ref.d.ts +10 -0
- package/runtime/lib/snapshot/ref.js +119 -0
- package/runtime/lib/snapshot/ref.js.map +1 -0
- package/runtime/lib/snapshot/spread.d.ts +5 -0
- package/runtime/lib/snapshot/spread.js +289 -0
- package/runtime/lib/snapshot/spread.js.map +1 -0
- package/runtime/lib/snapshot/workletEvent.d.ts +3 -0
- package/runtime/lib/snapshot/workletEvent.js +22 -0
- package/runtime/lib/snapshot/workletEvent.js.map +1 -0
- package/runtime/lib/snapshot/workletRef.d.ts +5 -0
- package/runtime/lib/snapshot/workletRef.js +52 -0
- package/runtime/lib/snapshot/workletRef.js.map +1 -0
- package/runtime/lib/snapshot.d.ts +81 -0
- package/runtime/lib/snapshot.js +477 -0
- package/runtime/lib/snapshot.js.map +1 -0
- package/runtime/lib/snapshotPatch.d.ts +14 -0
- package/runtime/lib/snapshotPatch.js +31 -0
- package/runtime/lib/snapshotPatch.js.map +1 -0
- package/runtime/lib/snapshotPatchApply.d.ts +2 -0
- package/runtime/lib/snapshotPatchApply.js +110 -0
- package/runtime/lib/snapshotPatchApply.js.map +1 -0
- package/runtime/lib/utils.d.ts +4 -0
- package/runtime/lib/utils.js +32 -0
- package/runtime/lib/utils.js.map +1 -0
- package/runtime/lib/worklet/ctx.d.ts +1 -0
- package/runtime/lib/worklet/ctx.js +17 -0
- package/runtime/lib/worklet/ctx.js.map +1 -0
- package/runtime/lib/worklet/execMap.d.ts +1 -0
- package/runtime/lib/worklet/execMap.js +42 -0
- package/runtime/lib/worklet/execMap.js.map +1 -0
- package/runtime/lib/worklet/functionality.d.ts +1 -0
- package/runtime/lib/worklet/functionality.js +11 -0
- package/runtime/lib/worklet/functionality.js.map +1 -0
- package/runtime/lib/worklet/hmr.d.ts +1 -0
- package/runtime/lib/worklet/hmr.js +21 -0
- package/runtime/lib/worklet/hmr.js.map +1 -0
- package/runtime/lib/worklet/indexMap.d.ts +8 -0
- package/runtime/lib/worklet/indexMap.js +17 -0
- package/runtime/lib/worklet/indexMap.js.map +1 -0
- package/runtime/lib/worklet/jsImpl.d.ts +11 -0
- package/runtime/lib/worklet/jsImpl.js +68 -0
- package/runtime/lib/worklet/jsImpl.js.map +1 -0
- package/runtime/lib/worklet/runWorklet.d.ts +14 -0
- package/runtime/lib/worklet/runWorklet.js +82 -0
- package/runtime/lib/worklet/runWorklet.js.map +1 -0
- package/runtime/lib/worklet/workletRef.d.ts +131 -0
- package/runtime/lib/worklet/workletRef.js +96 -0
- package/runtime/lib/worklet/workletRef.js.map +1 -0
- package/runtime/lib/worklet/workletRefPool.d.ts +2 -0
- package/runtime/lib/worklet/workletRefPool.js +22 -0
- package/runtime/lib/worklet/workletRefPool.js.map +1 -0
- package/runtime/src/backgroundSnapshot.ts +452 -0
- package/runtime/src/compat/componentIs.ts +30 -0
- package/runtime/src/compat/initData.ts +140 -0
- package/runtime/src/compat/lynxComponent.ts +80 -0
- package/runtime/src/debug/debug.ts +9 -0
- package/runtime/src/debug/printSnapshot.ts +28 -0
- package/runtime/src/debug/profile.ts +54 -0
- package/runtime/src/document.ts +53 -0
- package/runtime/src/gesture/processGesture.ts +77 -0
- package/runtime/src/gesture/processGestureBagkround.ts +15 -0
- package/runtime/src/gesture/types.ts +39 -0
- package/runtime/src/hooks/react.ts +62 -0
- package/runtime/src/hooks/useLynxGlobalEventListener.ts +59 -0
- package/runtime/src/hydrate.ts +364 -0
- package/runtime/src/index.ts +89 -0
- package/runtime/src/internal.ts +60 -0
- package/runtime/src/legacy-react-runtime/index.ts +40 -0
- package/runtime/src/lifecycle/delayUnmount.ts +77 -0
- package/runtime/src/lifecycle/destroy.ts +26 -0
- package/runtime/src/lifecycle/pass.ts +14 -0
- package/runtime/src/lifecycle/patchUpdate.ts +240 -0
- package/runtime/src/lifecycle/reload.ts +79 -0
- package/runtime/src/lifecycle/render.ts +46 -0
- package/runtime/src/lifecycleConstant.ts +16 -0
- package/runtime/src/list.ts +375 -0
- package/runtime/src/lynx/calledByNative.ts +132 -0
- package/runtime/src/lynx/component.ts +116 -0
- package/runtime/src/lynx/dynamic-js.ts +33 -0
- package/runtime/src/lynx/env.ts +110 -0
- package/runtime/src/lynx/injectLepusMethods.ts +53 -0
- package/runtime/src/lynx/lazy-bundle.ts +126 -0
- package/runtime/src/lynx/performance.ts +117 -0
- package/runtime/src/lynx/tt.ts +212 -0
- package/runtime/src/lynx-api.ts +374 -0
- package/runtime/src/lynx.ts +105 -0
- package/runtime/src/opcodes.ts +64 -0
- package/runtime/src/renderToOpcodes/constants.ts +24 -0
- package/runtime/src/renderToOpcodes/index.ts +301 -0
- package/runtime/src/root.ts +19 -0
- package/runtime/src/snapshot/event.ts +33 -0
- package/runtime/src/snapshot/gesture.ts +25 -0
- package/runtime/src/snapshot/platformInfo.ts +48 -0
- package/runtime/src/snapshot/ref.ts +151 -0
- package/runtime/src/snapshot/spread.ts +287 -0
- package/runtime/src/snapshot/workletEvent.ts +33 -0
- package/runtime/src/snapshot/workletRef.ts +63 -0
- package/runtime/src/snapshot.ts +576 -0
- package/runtime/src/snapshotPatch.ts +56 -0
- package/runtime/src/snapshotPatchApply.ts +117 -0
- package/runtime/src/utils.ts +35 -0
- package/runtime/src/worklet/ctx.ts +22 -0
- package/runtime/src/worklet/execMap.ts +50 -0
- package/runtime/src/worklet/functionality.ts +12 -0
- package/runtime/src/worklet/hmr.ts +26 -0
- package/runtime/src/worklet/indexMap.ts +20 -0
- package/runtime/src/worklet/jsImpl.ts +86 -0
- package/runtime/src/worklet/runWorklet.ts +88 -0
- package/runtime/src/worklet/workletRef.ts +229 -0
- package/runtime/src/worklet/workletRefPool.ts +25 -0
- package/transform/cjs/main.cjs +6 -0
- package/transform/cjs/main.d.cts +3 -0
- package/transform/cjs/package.json +3 -0
- package/transform/dist/wasm.cjs +8478 -0
- package/transform/index.d.ts +187 -0
- package/transform/main.js +15 -0
- package/types/react.d.ts +147 -0
- package/types/react.docs.d.ts +74 -0
- package/worklet-runtime/dist/dev.js +414 -0
- package/worklet-runtime/dist/dev.js.map +8 -0
- package/worklet-runtime/dist/main.js +414 -0
- package/worklet-runtime/dist/main.js.map +8 -0
- package/worklet-runtime/lib/api/element.d.ts +14 -0
- package/worklet-runtime/lib/api/element.js +71 -0
- package/worklet-runtime/lib/api/element.js.map +1 -0
- package/worklet-runtime/lib/api/lepusQuerySelector.d.ts +3 -0
- package/worklet-runtime/lib/api/lepusQuerySelector.js +23 -0
- package/worklet-runtime/lib/api/lepusQuerySelector.js.map +1 -0
- package/worklet-runtime/lib/api/lynxApi.d.ts +2 -0
- package/worklet-runtime/lib/api/lynxApi.js +35 -0
- package/worklet-runtime/lib/api/lynxApi.js.map +1 -0
- package/worklet-runtime/lib/bindings/bindings.d.ts +14 -0
- package/worklet-runtime/lib/bindings/bindings.js +61 -0
- package/worklet-runtime/lib/bindings/bindings.js.map +1 -0
- package/worklet-runtime/lib/bindings/events.d.ts +7 -0
- package/worklet-runtime/lib/bindings/events.js +9 -0
- package/worklet-runtime/lib/bindings/events.js.map +1 -0
- package/worklet-runtime/lib/bindings/index.d.ts +4 -0
- package/worklet-runtime/lib/bindings/index.js +7 -0
- package/worklet-runtime/lib/bindings/index.js.map +1 -0
- package/worklet-runtime/lib/bindings/loadRuntime.d.ts +8 -0
- package/worklet-runtime/lib/bindings/loadRuntime.js +25 -0
- package/worklet-runtime/lib/bindings/loadRuntime.js.map +1 -0
- package/worklet-runtime/lib/bindings/types.d.ts +35 -0
- package/worklet-runtime/lib/bindings/types.js +2 -0
- package/worklet-runtime/lib/bindings/types.js.map +1 -0
- package/worklet-runtime/lib/delayWorkletEvent.d.ts +11 -0
- package/worklet-runtime/lib/delayWorkletEvent.js +49 -0
- package/worklet-runtime/lib/delayWorkletEvent.js.map +1 -0
- package/worklet-runtime/lib/global.d.ts +15 -0
- package/worklet-runtime/lib/global.js +2 -0
- package/worklet-runtime/lib/global.js.map +1 -0
- package/worklet-runtime/lib/index.d.ts +1 -0
- package/worklet-runtime/lib/index.js +12 -0
- package/worklet-runtime/lib/index.js.map +1 -0
- package/worklet-runtime/lib/jsFunctionLifecycle.d.ts +18 -0
- package/worklet-runtime/lib/jsFunctionLifecycle.js +55 -0
- package/worklet-runtime/lib/jsFunctionLifecycle.js.map +1 -0
- package/worklet-runtime/lib/listeners.d.ts +2 -0
- package/worklet-runtime/lib/listeners.js +17 -0
- package/worklet-runtime/lib/listeners.js.map +1 -0
- package/worklet-runtime/lib/utils/profile.d.ts +1 -0
- package/worklet-runtime/lib/utils/profile.js +20 -0
- package/worklet-runtime/lib/utils/profile.js.map +1 -0
- package/worklet-runtime/lib/utils/version.d.ts +1 -0
- package/worklet-runtime/lib/utils/version.js +10 -0
- package/worklet-runtime/lib/utils/version.js.map +1 -0
- package/worklet-runtime/lib/workletRef.d.ts +12 -0
- package/worklet-runtime/lib/workletRef.js +50 -0
- package/worklet-runtime/lib/workletRef.js.map +1 -0
- package/worklet-runtime/lib/workletRuntime.d.ts +2 -0
- package/worklet-runtime/lib/workletRuntime.js +128 -0
- package/worklet-runtime/lib/workletRuntime.js.map +1 -0
package/package.json
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lynx-js/react",
|
|
3
|
+
"version": "0.105.0",
|
|
4
|
+
"description": "ReactLynx is a framework for developing Lynx applications with familiar React.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./types/react.d.ts",
|
|
9
|
+
"lazy": "./runtime/lazy/react.js",
|
|
10
|
+
"default": "./runtime/lib/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./experimental/lazy/import": {
|
|
13
|
+
"types": "./runtime/lazy/import.d.ts",
|
|
14
|
+
"default": "./runtime/lazy/import.js"
|
|
15
|
+
},
|
|
16
|
+
"./internal": {
|
|
17
|
+
"types": "./runtime/lib/internal.d.ts",
|
|
18
|
+
"lazy": "./runtime/lazy/internal.js",
|
|
19
|
+
"default": "./runtime/lib/internal.js"
|
|
20
|
+
},
|
|
21
|
+
"./internal/document": {
|
|
22
|
+
"types": "./runtime/lib/document.d.ts",
|
|
23
|
+
"default": "./runtime/lib/document.js"
|
|
24
|
+
},
|
|
25
|
+
"./jsx-runtime": {
|
|
26
|
+
"types": "./runtime/jsx-runtime/index.d.ts",
|
|
27
|
+
"lazy": "./runtime/lazy/jsx-runtime.js",
|
|
28
|
+
"default": "./runtime/jsx-runtime/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./lepus/jsx-runtime": {
|
|
31
|
+
"types": "./runtime/jsx-runtime/index.d.ts",
|
|
32
|
+
"default": "./runtime/lepus/jsx-runtime/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./jsx-dev-runtime": {
|
|
35
|
+
"types": "./runtime/jsx-dev-runtime/index.d.ts",
|
|
36
|
+
"lazy": "./runtime/lazy/jsx-dev-runtime.js",
|
|
37
|
+
"default": "./runtime/jsx-dev-runtime/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./lepus/jsx-dev-runtime": {
|
|
40
|
+
"types": "./runtime/jsx-runtime/index.d.ts",
|
|
41
|
+
"default": "./runtime/lepus/jsx-runtime/index.js"
|
|
42
|
+
},
|
|
43
|
+
"./lepus": {
|
|
44
|
+
"types": "./runtime/lepus/index.d.ts",
|
|
45
|
+
"lazy": "./runtime/lazy/react-lepus.js",
|
|
46
|
+
"default": "./runtime/lepus/index.js"
|
|
47
|
+
},
|
|
48
|
+
"./refresh": {
|
|
49
|
+
"types": "./refresh/src/index.ts",
|
|
50
|
+
"default": "./refresh/dist/index.js"
|
|
51
|
+
},
|
|
52
|
+
"./runtime-components": {
|
|
53
|
+
"types": "./components/lib/index.d.ts",
|
|
54
|
+
"default": "./components/lib/index.js"
|
|
55
|
+
},
|
|
56
|
+
"./transform": {
|
|
57
|
+
"require": "./transform/cjs/main.cjs",
|
|
58
|
+
"import": {
|
|
59
|
+
"types": "./transform/index.d.ts",
|
|
60
|
+
"default": "./transform/main.js"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"./worklet-runtime": {
|
|
64
|
+
"types": "./worklet-runtime/lib/index.d.ts",
|
|
65
|
+
"default": "./worklet-runtime/dist/main.js"
|
|
66
|
+
},
|
|
67
|
+
"./worklet-dev-runtime": {
|
|
68
|
+
"types": "./worklet-runtime/lib/index.d.ts",
|
|
69
|
+
"default": "./worklet-runtime/dist/dev.js"
|
|
70
|
+
},
|
|
71
|
+
"./worklet-runtime/bindings": {
|
|
72
|
+
"types": "./worklet-runtime/lib/bindings/index.d.ts",
|
|
73
|
+
"default": "./worklet-runtime/lib/bindings/index.js"
|
|
74
|
+
},
|
|
75
|
+
"./legacy-react-runtime": {
|
|
76
|
+
"types": "./runtime/lib/legacy-react-runtime/index.d.ts",
|
|
77
|
+
"lazy": "./runtime/lazy/legacy-react-runtime.js",
|
|
78
|
+
"default": "./runtime/lib/legacy-react-runtime/index.js"
|
|
79
|
+
},
|
|
80
|
+
"./package.json": "./package.json"
|
|
81
|
+
},
|
|
82
|
+
"types": "./types/react.d.ts",
|
|
83
|
+
"typesVersions": {
|
|
84
|
+
"*": {
|
|
85
|
+
"experimental/lazy/import": [
|
|
86
|
+
"./runtime/lazy/import.d.ts"
|
|
87
|
+
],
|
|
88
|
+
"internal": [
|
|
89
|
+
"./runtime/lib/internal.d.ts"
|
|
90
|
+
],
|
|
91
|
+
"internal/document": [
|
|
92
|
+
"./runtime/lib/document.d.ts"
|
|
93
|
+
],
|
|
94
|
+
"jsx-runtime": [
|
|
95
|
+
"./runtime/jsx-runtime/index.d.ts"
|
|
96
|
+
],
|
|
97
|
+
"jsx-dev-runtime": [
|
|
98
|
+
"./runtime/jsx-dev-runtime/index.d.ts"
|
|
99
|
+
],
|
|
100
|
+
"lepus/jsx-runtime": [
|
|
101
|
+
"./runtime/jsx-runtime/index.d.ts"
|
|
102
|
+
],
|
|
103
|
+
"lepus/jsx-dev-runtime": [
|
|
104
|
+
"./runtime/jsx-dev-runtime/index.d.ts"
|
|
105
|
+
],
|
|
106
|
+
"lepus": [
|
|
107
|
+
"./runtime/lepus/index.d.ts"
|
|
108
|
+
],
|
|
109
|
+
"refresh": [
|
|
110
|
+
"./refresh/src/index.ts"
|
|
111
|
+
],
|
|
112
|
+
"runtime-components": [
|
|
113
|
+
"./components/lib/index.d.ts"
|
|
114
|
+
],
|
|
115
|
+
"worklet-runtime": [
|
|
116
|
+
"./worklet-runtime/lib/index.d.ts"
|
|
117
|
+
],
|
|
118
|
+
"worklet-dev-runtime": [
|
|
119
|
+
"./worklet-runtime/lib/index.d.ts"
|
|
120
|
+
],
|
|
121
|
+
"worklet-runtime/bindings": [
|
|
122
|
+
"./worklet-runtime/lib/bindings/index.d.ts"
|
|
123
|
+
],
|
|
124
|
+
"legacy-react-runtime": [
|
|
125
|
+
"./runtime/lib/legacy-react-runtime/index.d.ts"
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"files": [
|
|
130
|
+
"components",
|
|
131
|
+
"refresh/*",
|
|
132
|
+
"runtime",
|
|
133
|
+
"transform",
|
|
134
|
+
"types",
|
|
135
|
+
"docs",
|
|
136
|
+
"worklet-runtime",
|
|
137
|
+
"CHANGELOG.md",
|
|
138
|
+
"internal.js",
|
|
139
|
+
"README.md",
|
|
140
|
+
"README.zh.md"
|
|
141
|
+
],
|
|
142
|
+
"dependencies": {
|
|
143
|
+
"preact": "npm:@hongzhiyuan/preact@10.24.0-319c684e"
|
|
144
|
+
},
|
|
145
|
+
"devDependencies": {
|
|
146
|
+
"@lynx-js/types": "^3.2.0",
|
|
147
|
+
"@microsoft/api-extractor": "7.51.0",
|
|
148
|
+
"@types/react": "^18.3.18"
|
|
149
|
+
},
|
|
150
|
+
"peerDependencies": {
|
|
151
|
+
"@lynx-js/types": "*",
|
|
152
|
+
"@types/react": "^18"
|
|
153
|
+
},
|
|
154
|
+
"peerDependenciesMeta": {
|
|
155
|
+
"@lynx-js/types": {
|
|
156
|
+
"optional": true
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
"scripts": {
|
|
160
|
+
"api-extractor": "api-extractor run --verbose"
|
|
161
|
+
}
|
|
162
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/dist
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
|
|
2
|
+
> @lynx-js/react-refresh@0.1.0 build /home/runner/work/lynx-stack/lynx-stack/packages/react/refresh
|
|
3
|
+
> esbuild --bundle src/index.ts --outfile=dist/index.js --external:@lynx-js/react --define:self=globalThis --format=esm --alias:preact=@lynx-js/react/internal --alias:preact/hooks=@lynx-js/react
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
dist/index.js 11.4kb
|
|
7
|
+
|
|
8
|
+
⚡ Done in 33ms
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
// ../../../node_modules/.pnpm/@prefresh+core@1.5.3_preact@10.23.2/node_modules/@prefresh/core/src/runtime/catchError.js
|
|
2
|
+
import { options } from "@lynx-js/react/internal";
|
|
3
|
+
|
|
4
|
+
// ../../../node_modules/.pnpm/@prefresh+core@1.5.3_preact@10.23.2/node_modules/@prefresh/core/src/constants.js
|
|
5
|
+
var VNODE_COMPONENT = "__c";
|
|
6
|
+
var NAMESPACE = "__PREFRESH__";
|
|
7
|
+
var COMPONENT_HOOKS = "__H";
|
|
8
|
+
var HOOKS_LIST = "__";
|
|
9
|
+
var EFFECTS_LIST = "__h";
|
|
10
|
+
var RERENDER_COUNT = "__r";
|
|
11
|
+
var CATCH_ERROR_OPTION = "__e";
|
|
12
|
+
var COMPONENT_DIRTY = "__d";
|
|
13
|
+
var HOOK_VALUE = "__";
|
|
14
|
+
var HOOK_ARGS = "__H";
|
|
15
|
+
var HOOK_CLEANUP = "__c";
|
|
16
|
+
|
|
17
|
+
// ../../../node_modules/.pnpm/@prefresh+core@1.5.3_preact@10.23.2/node_modules/@prefresh/core/src/runtime/catchError.js
|
|
18
|
+
var oldCatchError = options[CATCH_ERROR_OPTION];
|
|
19
|
+
options[CATCH_ERROR_OPTION] = (error, vnode, oldVNode) => {
|
|
20
|
+
if (vnode[VNODE_COMPONENT] && vnode[VNODE_COMPONENT][COMPONENT_DIRTY]) {
|
|
21
|
+
vnode[VNODE_COMPONENT][COMPONENT_DIRTY] = false;
|
|
22
|
+
}
|
|
23
|
+
if (oldCatchError) oldCatchError(error, vnode, oldVNode);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// ../../../node_modules/.pnpm/@prefresh+core@1.5.3_preact@10.23.2/node_modules/@prefresh/core/src/runtime/debounceRendering.js
|
|
27
|
+
import { options as options2 } from "@lynx-js/react/internal";
|
|
28
|
+
var defer = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout;
|
|
29
|
+
options2.debounceRendering = (process) => {
|
|
30
|
+
defer(() => {
|
|
31
|
+
try {
|
|
32
|
+
process();
|
|
33
|
+
} catch (e) {
|
|
34
|
+
process[RERENDER_COUNT] = 0;
|
|
35
|
+
throw e;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// ../../../node_modules/.pnpm/@prefresh+core@1.5.3_preact@10.23.2/node_modules/@prefresh/core/src/runtime/vnode.js
|
|
41
|
+
import { options as options3 } from "@lynx-js/react/internal";
|
|
42
|
+
|
|
43
|
+
// ../../../node_modules/.pnpm/@prefresh+core@1.5.3_preact@10.23.2/node_modules/@prefresh/core/src/runtime/vnodesForComponent.js
|
|
44
|
+
var vnodesForComponent = /* @__PURE__ */ new WeakMap();
|
|
45
|
+
var mappedVNodes = /* @__PURE__ */ new WeakMap();
|
|
46
|
+
|
|
47
|
+
// ../../../node_modules/.pnpm/@prefresh+core@1.5.3_preact@10.23.2/node_modules/@prefresh/core/src/runtime/vnode.js
|
|
48
|
+
var getMappedVnode = (type) => {
|
|
49
|
+
if (mappedVNodes.has(type)) {
|
|
50
|
+
return getMappedVnode(mappedVNodes.get(type));
|
|
51
|
+
}
|
|
52
|
+
return type;
|
|
53
|
+
};
|
|
54
|
+
var BUILT_IN_COMPONENTS = ["Fragment", "Suspense", "SuspenseList"];
|
|
55
|
+
var isBuiltIn = (type) => {
|
|
56
|
+
return BUILT_IN_COMPONENTS.includes(type.name);
|
|
57
|
+
};
|
|
58
|
+
var oldVnode = options3.vnode;
|
|
59
|
+
options3.vnode = (vnode) => {
|
|
60
|
+
if (vnode && typeof vnode.type === "function" && !isBuiltIn(vnode.type)) {
|
|
61
|
+
const vnodes = vnodesForComponent.get(vnode.type);
|
|
62
|
+
if (!vnodes) {
|
|
63
|
+
vnodesForComponent.set(vnode.type, [vnode]);
|
|
64
|
+
} else {
|
|
65
|
+
vnodes.push(vnode);
|
|
66
|
+
}
|
|
67
|
+
const foundType = getMappedVnode(vnode.type);
|
|
68
|
+
if (foundType !== vnode.type) {
|
|
69
|
+
const vnodes2 = vnodesForComponent.get(foundType);
|
|
70
|
+
if (!vnodes2) {
|
|
71
|
+
vnodesForComponent.set(foundType, [vnode]);
|
|
72
|
+
} else {
|
|
73
|
+
vnodes2.push(vnode);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
vnode.type = foundType;
|
|
77
|
+
if (vnode[VNODE_COMPONENT] && "prototype" in vnode.type && vnode.type.prototype.render) {
|
|
78
|
+
vnode[VNODE_COMPONENT].constructor = vnode.type;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (oldVnode) oldVnode(vnode);
|
|
82
|
+
};
|
|
83
|
+
var oldDiffed = options3.diffed;
|
|
84
|
+
options3.diffed = (vnode) => {
|
|
85
|
+
if (vnode && typeof vnode.type === "function") {
|
|
86
|
+
const vnodes = vnodesForComponent.get(vnode.type);
|
|
87
|
+
if (vnodes) {
|
|
88
|
+
const matchingDom = vnodes.filter((p) => p.__c === vnode.__c);
|
|
89
|
+
if (matchingDom.length > 1) {
|
|
90
|
+
const i = vnodes.findIndex((p) => p === matchingDom[0]);
|
|
91
|
+
vnodes.splice(i, 1);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (oldDiffed) oldDiffed(vnode);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// ../../../node_modules/.pnpm/@prefresh+core@1.5.3_preact@10.23.2/node_modules/@prefresh/core/src/runtime/unmount.js
|
|
99
|
+
import { options as options4 } from "@lynx-js/react/internal";
|
|
100
|
+
var oldUnmount = options4.unmount;
|
|
101
|
+
options4.unmount = (vnode) => {
|
|
102
|
+
const type = (vnode || {}).type;
|
|
103
|
+
if (typeof type === "function" && vnodesForComponent.has(type)) {
|
|
104
|
+
const vnodes = vnodesForComponent.get(type);
|
|
105
|
+
if (vnodes) {
|
|
106
|
+
const index = vnodes.indexOf(vnode);
|
|
107
|
+
if (index !== -1) {
|
|
108
|
+
vnodes.splice(index, 1);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (oldUnmount) oldUnmount(vnode);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
// ../../../node_modules/.pnpm/@prefresh+core@1.5.3_preact@10.23.2/node_modules/@prefresh/core/src/index.js
|
|
116
|
+
import { Component } from "@lynx-js/react/internal";
|
|
117
|
+
|
|
118
|
+
// ../../../node_modules/.pnpm/@prefresh+core@1.5.3_preact@10.23.2/node_modules/@prefresh/core/src/runtime/signaturesForType.js
|
|
119
|
+
var signaturesForType = /* @__PURE__ */ new WeakMap();
|
|
120
|
+
|
|
121
|
+
// ../../../node_modules/.pnpm/@prefresh+core@1.5.3_preact@10.23.2/node_modules/@prefresh/core/src/computeKey.js
|
|
122
|
+
var computeKey = (signature) => {
|
|
123
|
+
let fullKey = signature.key;
|
|
124
|
+
let hooks;
|
|
125
|
+
try {
|
|
126
|
+
hooks = signature.getCustomHooks();
|
|
127
|
+
} catch (err) {
|
|
128
|
+
signature.forceReset = true;
|
|
129
|
+
return fullKey;
|
|
130
|
+
}
|
|
131
|
+
for (let i = 0; i < hooks.length; i++) {
|
|
132
|
+
const hook = hooks[i];
|
|
133
|
+
if (typeof hook !== "function") {
|
|
134
|
+
signature.forceReset = true;
|
|
135
|
+
return fullKey;
|
|
136
|
+
}
|
|
137
|
+
const nestedHookSignature = signaturesForType.get(hook);
|
|
138
|
+
if (nestedHookSignature === void 0) continue;
|
|
139
|
+
const nestedHookKey = computeKey(nestedHookSignature);
|
|
140
|
+
if (nestedHookSignature.forceReset) signature.forceReset = true;
|
|
141
|
+
fullKey += "\n---\n" + nestedHookKey;
|
|
142
|
+
}
|
|
143
|
+
return fullKey;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
// ../../../node_modules/.pnpm/@prefresh+core@1.5.3_preact@10.23.2/node_modules/@prefresh/core/src/index.js
|
|
147
|
+
var typesById = /* @__PURE__ */ new Map();
|
|
148
|
+
var pendingUpdates = [];
|
|
149
|
+
function sign(type, key, forceReset, getCustomHooks, status) {
|
|
150
|
+
if (type) {
|
|
151
|
+
let signature = signaturesForType.get(type);
|
|
152
|
+
if (status === "begin") {
|
|
153
|
+
signaturesForType.set(type, {
|
|
154
|
+
type,
|
|
155
|
+
key,
|
|
156
|
+
forceReset,
|
|
157
|
+
getCustomHooks: getCustomHooks || (() => [])
|
|
158
|
+
});
|
|
159
|
+
return "needsHooks";
|
|
160
|
+
} else if (status === "needsHooks") {
|
|
161
|
+
signature.fullKey = computeKey(signature);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function replaceComponent(OldType, NewType, resetHookState) {
|
|
166
|
+
const vnodes = vnodesForComponent.get(OldType);
|
|
167
|
+
if (!vnodes) return;
|
|
168
|
+
vnodesForComponent.delete(OldType);
|
|
169
|
+
vnodesForComponent.set(NewType, vnodes);
|
|
170
|
+
mappedVNodes.set(OldType, NewType);
|
|
171
|
+
pendingUpdates = pendingUpdates.filter((p) => p[0] !== OldType);
|
|
172
|
+
vnodes.forEach((vnode) => {
|
|
173
|
+
if (!vnode.__c || !vnode.__c.__P) return;
|
|
174
|
+
vnode.type = NewType;
|
|
175
|
+
if (vnode[VNODE_COMPONENT]) {
|
|
176
|
+
vnode[VNODE_COMPONENT].constructor = vnode.type;
|
|
177
|
+
try {
|
|
178
|
+
if (vnode[VNODE_COMPONENT] instanceof OldType) {
|
|
179
|
+
const oldInst = vnode[VNODE_COMPONENT];
|
|
180
|
+
const newInst = new NewType(
|
|
181
|
+
vnode[VNODE_COMPONENT].props,
|
|
182
|
+
vnode[VNODE_COMPONENT].context
|
|
183
|
+
);
|
|
184
|
+
vnode[VNODE_COMPONENT] = newInst;
|
|
185
|
+
for (let i in oldInst) {
|
|
186
|
+
const type = typeof oldInst[i];
|
|
187
|
+
if (!(i in newInst)) {
|
|
188
|
+
newInst[i] = oldInst[i];
|
|
189
|
+
} else if (type !== "function" && typeof newInst[i] === type) {
|
|
190
|
+
if (type === "object" && newInst[i] != null && newInst[i].constructor === oldInst[i].constructor) {
|
|
191
|
+
Object.assign(newInst[i], oldInst[i]);
|
|
192
|
+
} else {
|
|
193
|
+
newInst[i] = oldInst[i];
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
} catch (e) {
|
|
199
|
+
vnode[VNODE_COMPONENT].constructor = NewType;
|
|
200
|
+
}
|
|
201
|
+
if (resetHookState) {
|
|
202
|
+
if (vnode[VNODE_COMPONENT][COMPONENT_HOOKS] && vnode[VNODE_COMPONENT][COMPONENT_HOOKS][HOOKS_LIST] && vnode[VNODE_COMPONENT][COMPONENT_HOOKS][HOOKS_LIST].length) {
|
|
203
|
+
vnode[VNODE_COMPONENT][COMPONENT_HOOKS][HOOKS_LIST].forEach(
|
|
204
|
+
(possibleEffect) => {
|
|
205
|
+
if (possibleEffect[HOOK_CLEANUP] && typeof possibleEffect[HOOK_CLEANUP] === "function") {
|
|
206
|
+
possibleEffect[HOOK_CLEANUP]();
|
|
207
|
+
possibleEffect[HOOK_CLEANUP] = void 0;
|
|
208
|
+
} else if (possibleEffect[HOOK_ARGS] && possibleEffect[HOOK_VALUE] && Object.keys(possibleEffect).length === 3) {
|
|
209
|
+
const cleanupKey = Object.keys(possibleEffect).find(
|
|
210
|
+
(key) => key !== HOOK_ARGS && key !== HOOK_VALUE
|
|
211
|
+
);
|
|
212
|
+
if (cleanupKey && typeof possibleEffect[cleanupKey] == "function") {
|
|
213
|
+
possibleEffect[cleanupKey]();
|
|
214
|
+
possibleEffect[cleanupKey] = void 0;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
vnode[VNODE_COMPONENT][COMPONENT_HOOKS] = {
|
|
221
|
+
[HOOKS_LIST]: [],
|
|
222
|
+
[EFFECTS_LIST]: []
|
|
223
|
+
};
|
|
224
|
+
} else if (vnode[VNODE_COMPONENT][COMPONENT_HOOKS] && vnode[VNODE_COMPONENT][COMPONENT_HOOKS][HOOKS_LIST] && vnode[VNODE_COMPONENT][COMPONENT_HOOKS][HOOKS_LIST].length) {
|
|
225
|
+
vnode[VNODE_COMPONENT][COMPONENT_HOOKS][HOOKS_LIST].forEach(
|
|
226
|
+
(possibleEffect) => {
|
|
227
|
+
if (possibleEffect[HOOK_CLEANUP] && typeof possibleEffect[HOOK_CLEANUP] === "function") {
|
|
228
|
+
possibleEffect[HOOK_CLEANUP]();
|
|
229
|
+
possibleEffect[HOOK_CLEANUP] = void 0;
|
|
230
|
+
} else if (possibleEffect[HOOK_ARGS] && possibleEffect[HOOK_VALUE] && Object.keys(possibleEffect).length === 3) {
|
|
231
|
+
const cleanupKey = Object.keys(possibleEffect).find(
|
|
232
|
+
(key) => key !== HOOK_ARGS && key !== HOOK_VALUE
|
|
233
|
+
);
|
|
234
|
+
if (cleanupKey && typeof possibleEffect[cleanupKey] == "function")
|
|
235
|
+
possibleEffect[cleanupKey]();
|
|
236
|
+
possibleEffect[cleanupKey] = void 0;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
);
|
|
240
|
+
vnode[VNODE_COMPONENT][COMPONENT_HOOKS][HOOKS_LIST].forEach((hook) => {
|
|
241
|
+
if (hook.__H && Array.isArray(hook.__H)) {
|
|
242
|
+
hook.__H = void 0;
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
Component.prototype.forceUpdate.call(vnode[VNODE_COMPONENT]);
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
globalThis[NAMESPACE] = {
|
|
251
|
+
getSignature: (type) => signaturesForType.get(type),
|
|
252
|
+
register: (type, id) => {
|
|
253
|
+
if (typeof type !== "function") return;
|
|
254
|
+
if (typesById.has(id)) {
|
|
255
|
+
const existing = typesById.get(id);
|
|
256
|
+
if (existing !== type) {
|
|
257
|
+
pendingUpdates.push([existing, type]);
|
|
258
|
+
typesById.set(id, type);
|
|
259
|
+
}
|
|
260
|
+
} else {
|
|
261
|
+
typesById.set(id, type);
|
|
262
|
+
}
|
|
263
|
+
if (!signaturesForType.has(type)) {
|
|
264
|
+
signaturesForType.set(type, {
|
|
265
|
+
getCustomHooks: () => [],
|
|
266
|
+
type
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
getPendingUpdates: () => pendingUpdates,
|
|
271
|
+
flush: () => {
|
|
272
|
+
pendingUpdates = [];
|
|
273
|
+
},
|
|
274
|
+
replaceComponent,
|
|
275
|
+
sign,
|
|
276
|
+
computeKey
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
// ../../../node_modules/.pnpm/@prefresh+utils@1.2.0/node_modules/@prefresh/utils/src/index.js
|
|
280
|
+
var compareSignatures = (prev, next) => {
|
|
281
|
+
const prevSignature = globalThis.__PREFRESH__.getSignature(prev) || {};
|
|
282
|
+
const nextSignature = globalThis.__PREFRESH__.getSignature(next) || {};
|
|
283
|
+
if (prevSignature.key !== nextSignature.key || globalThis.__PREFRESH__.computeKey(prevSignature) !== globalThis.__PREFRESH__.computeKey(nextSignature) || nextSignature.forceReset) {
|
|
284
|
+
globalThis.__PREFRESH__.replaceComponent(prev, next, true);
|
|
285
|
+
} else {
|
|
286
|
+
globalThis.__PREFRESH__.replaceComponent(prev, next, false);
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
var flush = () => {
|
|
290
|
+
const pending = [...globalThis.__PREFRESH__.getPendingUpdates()];
|
|
291
|
+
globalThis.__PREFRESH__.flush();
|
|
292
|
+
if (pending.length > 0) {
|
|
293
|
+
pending.forEach(([prev, next]) => {
|
|
294
|
+
compareSignatures(prev, next);
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
var isComponent = (exportValue) => {
|
|
299
|
+
if (typeof exportValue === "function") {
|
|
300
|
+
if (exportValue.prototype != null && exportValue.prototype.isReactComponent) {
|
|
301
|
+
return true;
|
|
302
|
+
}
|
|
303
|
+
const name = exportValue.name || exportValue.displayName;
|
|
304
|
+
return typeof name === "string" && name[0] && name[0] == name[0].toUpperCase();
|
|
305
|
+
}
|
|
306
|
+
return false;
|
|
307
|
+
};
|
|
308
|
+
export {
|
|
309
|
+
flush,
|
|
310
|
+
isComponent
|
|
311
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lynx-js/react-refresh",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./src/index.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"src"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "esbuild --bundle src/index.ts --outfile=dist/index.js --external:@lynx-js/react --define:self=globalThis --format=esm --alias:preact=@lynx-js/react/internal --alias:preact/hooks=@lynx-js/react"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@lynx-js/react": "workspace:*",
|
|
17
|
+
"@prefresh/core": "^1.5.3",
|
|
18
|
+
"@prefresh/utils": "^1.2.0",
|
|
19
|
+
"esbuild": "^0.25.0"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Copyright 2024 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
import '@prefresh/core';
|
|
5
|
+
|
|
6
|
+
export { flush, isComponent } from '@prefresh/utils';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright 2024 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
declare module '@prefresh/core' {
|
|
5
|
+
export {};
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
declare module '@prefresh/utils' {
|
|
9
|
+
export declare function flush(): void;
|
|
10
|
+
export declare function isComponent(component: unknown): boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Copyright 2024 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
export { jsxDEV, Fragment } from 'react/jsx-dev-runtime';
|
|
5
|
+
export { jsx, jsxs } from 'react/jsx-runtime';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Copyright 2024 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
import * as ReactAPIs from '@lynx-js/react';
|
|
5
|
+
import * as ReactInternal from '@lynx-js/react/internal';
|
|
6
|
+
import * as ReactJSXDevRuntime from '@lynx-js/react/jsx-dev-runtime';
|
|
7
|
+
import * as ReactJSXRuntime from '@lynx-js/react/jsx-runtime';
|
|
8
|
+
import * as ReactLegacyReactRuntime from '@lynx-js/react/legacy-react-runtime';
|
|
9
|
+
import * as ReactLepusAPIs from '@lynx-js/react/lepus';
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
sExportsJSXDevRuntime,
|
|
13
|
+
sExportsJSXRuntime,
|
|
14
|
+
sExportsLegacyReactRuntime,
|
|
15
|
+
sExportsReact,
|
|
16
|
+
sExportsReactInternal,
|
|
17
|
+
sExportsReactLepus,
|
|
18
|
+
target,
|
|
19
|
+
} from './target';
|
|
20
|
+
|
|
21
|
+
Object.defineProperty(target, sExportsReact, {
|
|
22
|
+
value: ReactAPIs,
|
|
23
|
+
enumerable: false,
|
|
24
|
+
writable: false,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
Object.defineProperty(target, sExportsReactLepus, {
|
|
28
|
+
value: ReactLepusAPIs,
|
|
29
|
+
enumerable: false,
|
|
30
|
+
writable: false,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
Object.defineProperty(target, sExportsReactInternal, {
|
|
34
|
+
value: ReactInternal,
|
|
35
|
+
enumerable: false,
|
|
36
|
+
writable: false,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
Object.defineProperty(target, sExportsJSXRuntime, {
|
|
40
|
+
value: ReactJSXRuntime,
|
|
41
|
+
enumerable: false,
|
|
42
|
+
writable: false,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
Object.defineProperty(target, sExportsJSXDevRuntime, {
|
|
46
|
+
value: ReactJSXDevRuntime,
|
|
47
|
+
enumerable: false,
|
|
48
|
+
writable: false,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
Object.defineProperty(target, sExportsLegacyReactRuntime, {
|
|
52
|
+
value: ReactLegacyReactRuntime,
|
|
53
|
+
enumerable: false,
|
|
54
|
+
writable: false,
|
|
55
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright 2024 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
|
|
5
|
+
import { sExportsReactInternal, target } from './target';
|
|
6
|
+
|
|
7
|
+
export const {
|
|
8
|
+
Component,
|
|
9
|
+
__ComponentIsPolyfill,
|
|
10
|
+
__DynamicPartChildren,
|
|
11
|
+
__DynamicPartChildren_0,
|
|
12
|
+
__DynamicPartListChildren,
|
|
13
|
+
__DynamicPartSlot,
|
|
14
|
+
__DynamicPartMultiChildren,
|
|
15
|
+
__dynamicImport,
|
|
16
|
+
__page,
|
|
17
|
+
__pageId,
|
|
18
|
+
__root,
|
|
19
|
+
createSnapshot,
|
|
20
|
+
loadDynamicJS,
|
|
21
|
+
loadLazyBundle,
|
|
22
|
+
loadWorkletRuntime,
|
|
23
|
+
options,
|
|
24
|
+
registerWorkletOnBackground,
|
|
25
|
+
snapshotCreateList,
|
|
26
|
+
snapshotManager,
|
|
27
|
+
SnapshotInstance,
|
|
28
|
+
transformRef,
|
|
29
|
+
transformToWorklet,
|
|
30
|
+
updateEvent,
|
|
31
|
+
updateRef,
|
|
32
|
+
updateSpread,
|
|
33
|
+
updateWorkletEvent,
|
|
34
|
+
updateGesture,
|
|
35
|
+
updateListItemPlatformInfo,
|
|
36
|
+
updateWorkletRef,
|
|
37
|
+
withInitDataInState,
|
|
38
|
+
wrapWithLynxComponent,
|
|
39
|
+
} = target[sExportsReactInternal];
|