@lynx-js/react-canary 0.106.3 → 0.106.4-canary-20250411-bbcdba12

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @lynx-js/react
2
2
 
3
+ ## 0.106.4-canary-20250411152153-bbcdba12421f96b99460dd4c102ce40fa88d70ae
4
+
5
+ ### Patch Changes
6
+
7
+ - Disable MTS HMR functionality temporarily to address stability issues. This is a temporary fix while we work on a more robust solution. ([#512](https://github.com/lynx-family/lynx-stack/pull/512))
8
+
3
9
  ## 0.106.3
4
10
 
5
11
  ### Patch Changes
@@ -39,7 +45,7 @@
39
45
  You can now use `useErrorBoundary` it in TypeScript like this:
40
46
 
41
47
  ```tsx
42
- import { useErrorBoundary } from '@lynx-js/react';
48
+ import { useErrorBoundary } from "@lynx-js/react";
43
49
  ```
44
50
 
45
51
  - Modified the format of data sent from background threads to the main thread. ([#207](https://github.com/lynx-family/lynx-stack/pull/207))
@@ -91,13 +97,13 @@
91
97
  Now you can get the return value from `runOnBackground()` and `runOnMainThread()`, which enables more flexible data flow between the main thread and the background thread.
92
98
 
93
99
  ```js
94
- import { runOnBackground } from '@lynx-js/react';
100
+ import { runOnBackground } from "@lynx-js/react";
95
101
 
96
102
  const onTap = async () => {
97
- 'main thread';
103
+ "main thread";
98
104
  const text = await runOnBackground(() => {
99
- 'background only';
100
- return 'Hello, world!';
105
+ "background only";
106
+ return "Hello, world!";
101
107
  })();
102
108
  console.log(text);
103
109
  };
@@ -132,9 +138,9 @@
132
138
 
133
139
  ```ts
134
140
  // These imports will be removed from the final bundle
135
- import type { Foo } from 'xyz';
136
- import { type Bar } from 'xyz';
137
- import { xyz } from 'xyz'; // When xyz is not used
141
+ import type { Foo } from "xyz";
142
+ import { type Bar } from "xyz";
143
+ import { xyz } from "xyz"; // When xyz is not used
138
144
  ```
139
145
 
140
146
  See [TypeScript - verbatimModuleSyntax](https://www.typescriptlang.org/tsconfig/#verbatimModuleSyntax) for details.
@@ -174,7 +180,7 @@
174
180
  const f = undefined;
175
181
 
176
182
  function mts() {
177
- 'main thread';
183
+ "main thread";
178
184
  // throws in background rendering
179
185
  f && runOnBackground(f)();
180
186
  }
@@ -208,14 +214,14 @@
208
214
  - a30c83d: Add `compat.removeComponentAttrRegex`.
209
215
 
210
216
  ```js
211
- import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin';
212
- import { defineConfig } from '@lynx-js/rspeedy';
217
+ import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
218
+ import { defineConfig } from "@lynx-js/rspeedy";
213
219
 
214
220
  export default defineConfig({
215
221
  plugins: [
216
222
  pluginReactLynx({
217
223
  compat: {
218
- removeComponentAttrRegex: 'YOUR REGEX',
224
+ removeComponentAttrRegex: "YOUR REGEX",
219
225
  },
220
226
  }),
221
227
  ],
@@ -301,22 +307,22 @@
301
307
  Gesture Handler is a set of gesture handling capabilities built on top of the Main Thread Script. It currently supports drag, inertial scrolling, long press, and tap gestures for `<view>`, `<scroll-view>`, `<list>`, and `<text>`. In the future, it will also support multi-finger zoom, multi-finger rotation, and other gesture capabilities.
302
308
 
303
309
  ```tsx
304
- import { useGesture, PanGesture } from '@lynx-js/gesture-runtime';
310
+ import { useGesture, PanGesture } from "@lynx-js/gesture-runtime";
305
311
 
306
312
  function App() {
307
313
  const pan = useGesture(PanGesture);
308
314
 
309
315
  pan
310
316
  .onBegin((event, stateManager) => {
311
- 'main thread';
317
+ "main thread";
312
318
  // some logic
313
319
  })
314
320
  .onUpdate((event, stateManager) => {
315
- 'main thread';
321
+ "main thread";
316
322
  // some logic
317
323
  })
318
324
  .onEnd((event, stateManager) => {
319
- 'main thread';
325
+ "main thread";
320
326
  // some logic
321
327
  });
322
328
 
@@ -336,7 +342,7 @@
336
342
  return;
337
343
  }
338
344
 
339
- console.log('not __LEPUS__'); // This can be removed now
345
+ console.log("not __LEPUS__"); // This can be removed now
340
346
  }
341
347
  ```
342
348
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/react-canary",
3
- "version": "0.106.3",
3
+ "version": "0.106.4-canary-20250411-bbcdba12",
4
4
  "description": "ReactLynx is a framework for developing Lynx applications with familiar React.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -148,8 +148,8 @@
148
148
  "preact": "npm:@hongzhiyuan/preact@10.24.0-319c684e"
149
149
  },
150
150
  "devDependencies": {
151
- "@lynx-js/types": "^3.2.0",
152
- "@microsoft/api-extractor": "7.52.2",
151
+ "@lynx-js/types": "^3.2.1",
152
+ "@microsoft/api-extractor": "7.52.3",
153
153
  "@types/react": "^18.3.20"
154
154
  },
155
155
  "peerDependencies": {
@@ -5,4 +5,4 @@
5
5
 
6
6
  dist/index.js 11.4kb
7
7
 
8
- ⚡ Done in 14ms
8
+ ⚡ Done in 28ms
@@ -82,16 +82,16 @@ export function snapshotPatchApply(snapshotPatch) {
82
82
  }
83
83
  break;
84
84
  }
85
- case SnapshotOperation.DEV_ONLY_RegisterWorklet: {
86
- // HMR-related
87
- if (__DEV__) {
88
- const hash = snapshotPatch[++i];
89
- const fnStr = snapshotPatch[++i];
90
- const fn = evaluate(fnStr);
91
- registerWorklet('main-thread', hash, fn);
92
- }
93
- break;
94
- }
85
+ // case SnapshotOperation.DEV_ONLY_RegisterWorklet: {
86
+ // // HMR-related
87
+ // if (__DEV__) {
88
+ // const hash: string = snapshotPatch[++i];
89
+ // const fnStr: string = snapshotPatch[++i];
90
+ // const fn = evaluate<(ctx: SnapshotInstance) => FiberElement[]>(fnStr);
91
+ // registerWorklet('main-thread', hash, fn);
92
+ // }
93
+ // break;
94
+ // }
95
95
  }
96
96
  }
97
97
  }
@@ -1 +1 @@
1
- {"version":3,"file":"snapshotPatchApply.js","sourceRoot":"","sources":["../../../src/lifecycle/patch/snapshotPatchApply.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;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MAAM,GAAa,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC;oBAC5C,MAAM,IAAI,GAAG,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC;oBAChC,MAAM,KAAK,GAAW,aAAa,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;oBAC9C,MAAM,SAAS,GAAuB,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC;oBAEzD,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;wBACxC,cAAc;wBACd,0CAA0C;wBAC1C,cAAc,CACZ,MAAM,EACN,QAAQ,CAA4C,MAAM,CAAC,EAC3D,MAAM,CAAC,GAAG,CAAgE,QAAQ,CAAC,EACnF,IAAI,EACJ,KAAK,EACL,SAAS,CACV,CAAC;oBACJ,CAAC;gBACH,CAAC;gBACD,MAAM;YACR,CAAC;YACC,qDAAqD;YACrD,mBAAmB;YACnB,mBAAmB;YACnB,+CAA+C;YAC/C,gDAAgD;YAChD,6EAA6E;YAC7E,gDAAgD;YAChD,MAAM;YACN,WAAW;YACX,IAAI;QACR,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,SAAS,QAAQ,CAAI,IAAY;IAC/B,OAAO,IAAI,QAAQ,CAAC,UAAU,IAAI,EAAE,CAAC,EAAE,CAAC;AAC1C,CAAC"}
@@ -1,21 +1,28 @@
1
1
  // Copyright 2024 The Lynx Authors. All rights reserved.
2
2
  // Licensed under the Apache License Version 2.0 that can be found in the
3
3
  // LICENSE file in the root directory of this source tree.
4
- import { SnapshotOperation, __globalSnapshotPatch } from '../lifecycle/patch/snapshotPatch.js';
5
- const workletHashSet = /* @__PURE__ */ new Set();
4
+ // import { __globalSnapshotPatch } from '../lifecycle/patch/snapshotPatch.js';
5
+ // const workletHashSet: Set<string> = /* @__PURE__ */ new Set();
6
+ /* v8 ignore start */
6
7
  /**
7
8
  * @internal
8
9
  */
9
- function registerWorkletOnBackground(_type, hash, fn) {
10
- if (workletHashSet.has(hash)) {
11
- return;
12
- }
13
- workletHashSet.add(hash);
14
- if (__globalSnapshotPatch) {
15
- __globalSnapshotPatch.push(SnapshotOperation.DEV_ONLY_RegisterWorklet, hash,
16
- // We use `Function.prototype.toString` to serialize the function for Lepus.
17
- fn.toString());
18
- }
10
+ // disable hmr until bugs are fixed
11
+ // TODO: re-enable hmr or change a way to impl it; also need to fix the test case DEV_ONLY_RegisterWorklet
12
+ function registerWorkletOnBackground(_type, _hash, _fn) {
13
+ // if (workletHashSet.has(hash)) {
14
+ // return;
15
+ // }
16
+ // workletHashSet.add(hash);
17
+ // if (__globalSnapshotPatch) {
18
+ // __globalSnapshotPatch.push(
19
+ // SnapshotOperation.DEV_ONLY_RegisterWorklet,
20
+ // hash,
21
+ // // We use `Function.prototype.toString` to serialize the function for Lepus.
22
+ // fn.toString(),
23
+ // );
24
+ // }
19
25
  }
26
+ /* v8 ignore stop */
20
27
  export { registerWorkletOnBackground };
21
28
  //# sourceMappingURL=hmr.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hmr.js","sourceRoot":"","sources":["../../src/worklet/hmr.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAE/F,MAAM,cAAc,GAAgB,eAAe,CAAC,IAAI,GAAG,EAAE,CAAC;AAE9D;;GAEG;AACH,SAAS,2BAA2B,CAAC,KAAa,EAAE,IAAY,EAAE,EAAY;IAC5E,IAAI,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAC7B,OAAO;IACT,CAAC;IACD,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACzB,IAAI,qBAAqB,EAAE,CAAC;QAC1B,qBAAqB,CAAC,IAAI,CACxB,iBAAiB,CAAC,wBAAwB,EAC1C,IAAI;QACJ,4EAA4E;QAC5E,EAAE,CAAC,QAAQ,EAAE,CACd,CAAC;IACJ,CAAC;AACH,CAAC;AAED,OAAO,EAAE,2BAA2B,EAAE,CAAC"}
1
+ {"version":3,"file":"hmr.js","sourceRoot":"","sources":["../../src/worklet/hmr.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,+EAA+E;AAE/E,iEAAiE;AAEjE,qBAAqB;AACrB;;GAEG;AACH,mCAAmC;AACnC,0GAA0G;AAC1G,SAAS,2BAA2B,CAAC,KAAa,EAAE,KAAa,EAAE,GAAa;IAC9E,kCAAkC;IAClC,YAAY;IACZ,IAAI;IACJ,4BAA4B;IAC5B,+BAA+B;IAC/B,gCAAgC;IAChC,kDAAkD;IAClD,YAAY;IACZ,mFAAmF;IACnF,qBAAqB;IACrB,OAAO;IACP,IAAI;AACN,CAAC;AACD,oBAAoB;AAEpB,OAAO,EAAE,2BAA2B,EAAE,CAAC"}
@@ -92,16 +92,16 @@ export function snapshotPatchApply(snapshotPatch: SnapshotPatch): void {
92
92
  }
93
93
  break;
94
94
  }
95
- case SnapshotOperation.DEV_ONLY_RegisterWorklet: {
96
- // HMR-related
97
- if (__DEV__) {
98
- const hash: string = snapshotPatch[++i];
99
- const fnStr: string = snapshotPatch[++i];
100
- const fn = evaluate<(ctx: SnapshotInstance) => FiberElement[]>(fnStr);
101
- registerWorklet('main-thread', hash, fn);
102
- }
103
- break;
104
- }
95
+ // case SnapshotOperation.DEV_ONLY_RegisterWorklet: {
96
+ // // HMR-related
97
+ // if (__DEV__) {
98
+ // const hash: string = snapshotPatch[++i];
99
+ // const fnStr: string = snapshotPatch[++i];
100
+ // const fn = evaluate<(ctx: SnapshotInstance) => FiberElement[]>(fnStr);
101
+ // registerWorklet('main-thread', hash, fn);
102
+ // }
103
+ // break;
104
+ // }
105
105
  }
106
106
  }
107
107
  }
@@ -1,26 +1,30 @@
1
1
  // Copyright 2024 The Lynx Authors. All rights reserved.
2
2
  // Licensed under the Apache License Version 2.0 that can be found in the
3
3
  // LICENSE file in the root directory of this source tree.
4
- import { SnapshotOperation, __globalSnapshotPatch } from '../lifecycle/patch/snapshotPatch.js';
4
+ // import { __globalSnapshotPatch } from '../lifecycle/patch/snapshotPatch.js';
5
5
 
6
- const workletHashSet: Set<string> = /* @__PURE__ */ new Set();
6
+ // const workletHashSet: Set<string> = /* @__PURE__ */ new Set();
7
7
 
8
+ /* v8 ignore start */
8
9
  /**
9
10
  * @internal
10
11
  */
11
- function registerWorkletOnBackground(_type: string, hash: string, fn: Function) {
12
- if (workletHashSet.has(hash)) {
13
- return;
14
- }
15
- workletHashSet.add(hash);
16
- if (__globalSnapshotPatch) {
17
- __globalSnapshotPatch.push(
18
- SnapshotOperation.DEV_ONLY_RegisterWorklet,
19
- hash,
20
- // We use `Function.prototype.toString` to serialize the function for Lepus.
21
- fn.toString(),
22
- );
23
- }
12
+ // disable hmr until bugs are fixed
13
+ // TODO: re-enable hmr or change a way to impl it; also need to fix the test case DEV_ONLY_RegisterWorklet
14
+ function registerWorkletOnBackground(_type: string, _hash: string, _fn: Function) {
15
+ // if (workletHashSet.has(hash)) {
16
+ // return;
17
+ // }
18
+ // workletHashSet.add(hash);
19
+ // if (__globalSnapshotPatch) {
20
+ // __globalSnapshotPatch.push(
21
+ // SnapshotOperation.DEV_ONLY_RegisterWorklet,
22
+ // hash,
23
+ // // We use `Function.prototype.toString` to serialize the function for Lepus.
24
+ // fn.toString(),
25
+ // );
26
+ // }
24
27
  }
28
+ /* v8 ignore stop */
25
29
 
26
30
  export { registerWorkletOnBackground };