@lynx-js/react-canary 0.112.7-canary-20250909-536ab089 → 0.112.7-canary-20250909-eb0a9aae
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 +1 -1
- package/package.json +1 -1
- package/refresh/.turbo/turbo-build.log +3 -3
- package/refresh/dist/index.js +34 -45
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/react-canary",
|
|
3
|
-
"version": "0.112.7-canary-20250909-
|
|
3
|
+
"version": "0.112.7-canary-20250909-eb0a9aae",
|
|
4
4
|
"description": "ReactLynx is a framework for developing Lynx applications with familiar React.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -2,11 +2,11 @@
|
|
|
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.
|
|
5
|
+
Rslib v0.13.0
|
|
6
6
|
|
|
7
7
|
info build started...
|
|
8
|
-
ready built in [1m0.
|
|
8
|
+
ready built in [1m0.10[22m s
|
|
9
9
|
|
|
10
10
|
[34mFile (esm) Size [39m
|
|
11
|
-
[2mdist/[22m[36mindex.js[39m
|
|
11
|
+
[2mdist/[22m[36mindex.js[39m 10.1 kB
|
|
12
12
|
|
package/refresh/dist/index.js
CHANGED
|
@@ -1,29 +1,18 @@
|
|
|
1
1
|
import { Component, options } from "@lynx-js/react/internal";
|
|
2
|
-
const VNODE_COMPONENT = '__c';
|
|
3
2
|
const NAMESPACE = '__PREFRESH__';
|
|
4
|
-
const COMPONENT_HOOKS = '__H';
|
|
5
|
-
const HOOKS_LIST = '__';
|
|
6
|
-
const EFFECTS_LIST = '__h';
|
|
7
|
-
const RERENDER_COUNT = '__r';
|
|
8
|
-
const CATCH_ERROR_OPTION = '__e';
|
|
9
|
-
const COMPONENT_DIRTY = '__d';
|
|
10
|
-
const COMPONENT_BITS = '__g';
|
|
11
|
-
const HOOK_VALUE = '__';
|
|
12
|
-
const HOOK_ARGS = '__H';
|
|
13
|
-
const HOOK_CLEANUP = '__c';
|
|
14
3
|
const COMPONENT_DIRTY_BIT = 8;
|
|
15
4
|
const isDirty = (vnode)=>{
|
|
16
|
-
if (vnode[
|
|
17
|
-
if (vnode[
|
|
5
|
+
if (vnode["__c"] && vnode["__c"]["__d"]) return true;
|
|
6
|
+
if (vnode["__c"] && vnode["__c"]["__g"] & COMPONENT_DIRTY_BIT) return true;
|
|
18
7
|
};
|
|
19
8
|
const unsetDirty = (vnode)=>{
|
|
20
|
-
if (vnode[
|
|
21
|
-
if (vnode[
|
|
22
|
-
if (vnode[
|
|
9
|
+
if (vnode["__c"]) {
|
|
10
|
+
if (vnode["__c"]["__d"]) vnode["__c"]["__d"] = false;
|
|
11
|
+
if (vnode["__c"]["__g"]) vnode["__c"]["__g"] &= ~COMPONENT_DIRTY_BIT;
|
|
23
12
|
}
|
|
24
13
|
};
|
|
25
|
-
const oldCatchError = options[
|
|
26
|
-
options[
|
|
14
|
+
const oldCatchError = options["__e"];
|
|
15
|
+
options["__e"] = (error, vnode, oldVNode, info)=>{
|
|
27
16
|
if (isDirty(vnode)) unsetDirty(vnode);
|
|
28
17
|
if (oldCatchError) oldCatchError(error, vnode, oldVNode, info);
|
|
29
18
|
};
|
|
@@ -33,7 +22,7 @@ options.debounceRendering = (process)=>{
|
|
|
33
22
|
try {
|
|
34
23
|
process();
|
|
35
24
|
} catch (e) {
|
|
36
|
-
process[
|
|
25
|
+
process["__r"] = 0;
|
|
37
26
|
throw e;
|
|
38
27
|
}
|
|
39
28
|
});
|
|
@@ -68,7 +57,7 @@ options.vnode = (vnode)=>{
|
|
|
68
57
|
]);
|
|
69
58
|
}
|
|
70
59
|
vnode.type = foundType;
|
|
71
|
-
if (vnode[
|
|
60
|
+
if (vnode["__c"] && 'prototype' in vnode.type && vnode.type.prototype.render) vnode["__c"].constructor = vnode.type;
|
|
72
61
|
}
|
|
73
62
|
if (oldVnode) oldVnode(vnode);
|
|
74
63
|
};
|
|
@@ -155,13 +144,13 @@ function replaceComponent(OldType, NewType, resetHookState) {
|
|
|
155
144
|
}
|
|
156
145
|
if (!vnode || !vnode.__c || !vnode.__c.__P) return;
|
|
157
146
|
vnode.type = NewType;
|
|
158
|
-
if (vnode[
|
|
159
|
-
vnode[
|
|
147
|
+
if (vnode["__c"]) {
|
|
148
|
+
vnode["__c"].constructor = vnode.type;
|
|
160
149
|
try {
|
|
161
|
-
if (vnode[
|
|
162
|
-
const oldInst = vnode[
|
|
163
|
-
const newInst = new NewType(vnode[
|
|
164
|
-
vnode[
|
|
150
|
+
if (vnode["__c"] instanceof OldType) {
|
|
151
|
+
const oldInst = vnode["__c"];
|
|
152
|
+
const newInst = new NewType(vnode["__c"].props, vnode["__c"].context);
|
|
153
|
+
vnode["__c"] = newInst;
|
|
165
154
|
for(let i in oldInst){
|
|
166
155
|
const type = typeof oldInst[i];
|
|
167
156
|
if (i in newInst) {
|
|
@@ -171,41 +160,41 @@ function replaceComponent(OldType, NewType, resetHookState) {
|
|
|
171
160
|
}
|
|
172
161
|
}
|
|
173
162
|
} catch (e) {
|
|
174
|
-
vnode[
|
|
163
|
+
vnode["__c"].constructor = NewType;
|
|
175
164
|
}
|
|
176
165
|
if (resetHookState) {
|
|
177
|
-
if (vnode[
|
|
178
|
-
if (possibleEffect[
|
|
179
|
-
possibleEffect[
|
|
180
|
-
possibleEffect[
|
|
181
|
-
} else if (possibleEffect[
|
|
182
|
-
const cleanupKey = Object.keys(possibleEffect).find((key)=>
|
|
166
|
+
if (vnode["__c"]["__H"] && vnode["__c"]["__H"]["__"] && vnode["__c"]["__H"]["__"].length) vnode["__c"]["__H"]["__"].forEach((possibleEffect)=>{
|
|
167
|
+
if (possibleEffect["__c"] && 'function' == typeof possibleEffect["__c"]) {
|
|
168
|
+
possibleEffect["__c"]();
|
|
169
|
+
possibleEffect["__c"] = void 0;
|
|
170
|
+
} else if (possibleEffect["__H"] && possibleEffect["__"] && 3 === Object.keys(possibleEffect).length) {
|
|
171
|
+
const cleanupKey = Object.keys(possibleEffect).find((key)=>"__H" !== key && "__" !== key);
|
|
183
172
|
if (cleanupKey && 'function' == typeof possibleEffect[cleanupKey]) {
|
|
184
173
|
possibleEffect[cleanupKey]();
|
|
185
174
|
possibleEffect[cleanupKey] = void 0;
|
|
186
175
|
}
|
|
187
176
|
}
|
|
188
177
|
});
|
|
189
|
-
vnode[
|
|
190
|
-
[
|
|
191
|
-
[
|
|
178
|
+
vnode["__c"]["__H"] = {
|
|
179
|
+
["__"]: [],
|
|
180
|
+
["__h"]: []
|
|
192
181
|
};
|
|
193
|
-
} else if (vnode[
|
|
194
|
-
vnode[
|
|
195
|
-
if (possibleEffect[
|
|
196
|
-
possibleEffect[
|
|
197
|
-
possibleEffect[
|
|
198
|
-
} else if (possibleEffect[
|
|
199
|
-
const cleanupKey = Object.keys(possibleEffect).find((key)=>
|
|
182
|
+
} else if (vnode["__c"]["__H"] && vnode["__c"]["__H"]["__"] && vnode["__c"]["__H"]["__"].length) {
|
|
183
|
+
vnode["__c"]["__H"]["__"].forEach((possibleEffect)=>{
|
|
184
|
+
if (possibleEffect["__c"] && 'function' == typeof possibleEffect["__c"]) {
|
|
185
|
+
possibleEffect["__c"]();
|
|
186
|
+
possibleEffect["__c"] = void 0;
|
|
187
|
+
} else if (possibleEffect["__H"] && possibleEffect["__"] && 3 === Object.keys(possibleEffect).length) {
|
|
188
|
+
const cleanupKey = Object.keys(possibleEffect).find((key)=>"__H" !== key && "__" !== key);
|
|
200
189
|
if (cleanupKey && 'function' == typeof possibleEffect[cleanupKey]) possibleEffect[cleanupKey]();
|
|
201
190
|
possibleEffect[cleanupKey] = void 0;
|
|
202
191
|
}
|
|
203
192
|
});
|
|
204
|
-
vnode[
|
|
193
|
+
vnode["__c"]["__H"]["__"].forEach((hook)=>{
|
|
205
194
|
if (hook.__H && Array.isArray(hook.__H)) hook.__H = void 0;
|
|
206
195
|
});
|
|
207
196
|
}
|
|
208
|
-
Component.prototype.forceUpdate.call(vnode[
|
|
197
|
+
Component.prototype.forceUpdate.call(vnode["__c"]);
|
|
209
198
|
}
|
|
210
199
|
});
|
|
211
200
|
}
|