@lynx-js/react-canary 0.115.3 → 0.115.4-canary-20260107-27c3d90f

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,21 @@
1
1
  # @lynx-js/react
2
2
 
3
+ ## 0.115.4-canary-20260107053629-27c3d90f3b63f8cb62dc705b2ec4c1d0bdd22c31
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: unable to access `MainThreadRef` in some scenarios ([#1996](https://github.com/lynx-family/lynx-stack/pull/1996))
8
+
9
+ - Add `getComputedStyleByKey` for `MainThread.Element`, now you can measure elements in sync. ([#2005](https://github.com/lynx-family/lynx-stack/pull/2005))
10
+
11
+ ```typescript
12
+ function getStyle(ele: MainThread.Element) {
13
+ "main thread";
14
+ const width = ele.getComputedStyleByKey("width"); // Returns 300px
15
+ const transformMatrix = ele.getComputedStyleByKey("transform"); // Returns matrix(2, 0, 0, 2, 200, 400)
16
+ }
17
+ ```
18
+
3
19
  ## 0.115.3
4
20
 
5
21
  ### Patch Changes
@@ -11,7 +27,7 @@
11
27
  ```ts
12
28
  const LazyComponent = lazy(async () => {
13
29
  try {
14
- const mod = await import('./lazy-bundle');
30
+ const mod = await import("./lazy-bundle");
15
31
  return mod.default;
16
32
  } catch (error) {
17
33
  console.error(`Lazy Bundle load failed message: ${error.message}`);
@@ -123,11 +139,11 @@
123
139
  - Support testing React Compiler in testing library. Enable React Compiler by setting the `experimental_enableReactCompiler` option of `createVitestConfig` to `true`. ([#1269](https://github.com/lynx-family/lynx-stack/pull/1269))
124
140
 
125
141
  ```js
126
- import { defineConfig, mergeConfig } from 'vitest/config';
127
- import { createVitestConfig } from '@lynx-js/react/testing-library/vitest-config';
142
+ import { defineConfig, mergeConfig } from "vitest/config";
143
+ import { createVitestConfig } from "@lynx-js/react/testing-library/vitest-config";
128
144
 
129
145
  const defaultConfig = await createVitestConfig({
130
- runtimePkgName: '@lynx-js/react',
146
+ runtimePkgName: "@lynx-js/react",
131
147
  experimental_enableReactCompiler: true,
132
148
  });
133
149
 
@@ -157,7 +173,7 @@
157
173
  ```tsx
158
174
  function App() {
159
175
  function handleInnerTap(event: MainThread.TouchEvent) {
160
- 'main thread';
176
+ "main thread";
161
177
  event.stopPropagation();
162
178
  // Or stop immediate propagation with
163
179
  // event.stopImmediatePropagation();
@@ -255,10 +271,10 @@
255
271
  - Add `animate` API in Main Thread Script(MTS), so you can now control a CSS animation imperatively ([#1534](https://github.com/lynx-family/lynx-stack/pull/1534))
256
272
 
257
273
  ```ts
258
- import type { MainThread } from '@lynx-js/types';
274
+ import type { MainThread } from "@lynx-js/types";
259
275
 
260
276
  function startAnimation(ele: MainThread.Element) {
261
- 'main thread';
277
+ "main thread";
262
278
  const animation = ele.animate([{ opacity: 0 }, { opacity: 1 }], {
263
279
  duration: 3000,
264
280
  });
@@ -287,7 +303,7 @@
287
303
  - Supports `recyclable` attribute in `<list-item>` to control whether the list item is recyclable. The `recyclable` attribute depends on Lynx Engine 3.4 or later. ([#1388](https://github.com/lynx-family/lynx-stack/pull/1388))
288
304
 
289
305
  ```jsx
290
- <list-item recyclable={false} />;
306
+ <list-item recyclable={false} />
291
307
  ```
292
308
 
293
309
  - feat: Support using a host element as direct child of Suspense ([#1455](https://github.com/lynx-family/lynx-stack/pull/1455))
@@ -308,7 +324,7 @@
308
324
 
309
325
  ```ts
310
326
  function handleTap() {
311
- 'main thread';
327
+ "main thread";
312
328
  // The following check always returned false before this fix
313
329
  if (myHandleTap) {
314
330
  runOnBackground(myHandleTap)();
@@ -369,10 +385,10 @@
369
385
  Add the import to `@lynx-js/react/debug` at the first line of the entry:
370
386
 
371
387
  ```js
372
- import '@lynx-js/react/debug';
373
- import { root } from '@lynx-js/react';
388
+ import "@lynx-js/react/debug";
389
+ import { root } from "@lynx-js/react";
374
390
 
375
- import { App } from './App.jsx';
391
+ import { App } from "./App.jsx";
376
392
 
377
393
  root.render(<App />);
378
394
  ```
@@ -382,9 +398,9 @@
382
398
  For example, you can use it like this:
383
399
 
384
400
  ```jsx
385
- <list-item defer={{ unmountRecycled: true }} item-key='1'>
401
+ <list-item defer={{ unmountRecycled: true }} item-key="1">
386
402
  <WillBeUnmountIfRecycled />
387
- </list-item>;
403
+ </list-item>
388
404
  ```
389
405
 
390
406
  Now the component will be unmounted when it is recycled, which can help with performance in certain scenarios.
@@ -392,7 +408,7 @@
392
408
  - 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))
393
409
 
394
410
  ```jsx
395
- <image async-mode={undefined} />;
411
+ <image async-mode={undefined} />
396
412
  ```
397
413
 
398
414
  ## 0.111.1
@@ -438,7 +454,7 @@
438
454
  - Supports `act` in testing library. ([#1182](https://github.com/lynx-family/lynx-stack/pull/1182))
439
455
 
440
456
  ```js
441
- import { act } from '@lynx-js/react/testing-library';
457
+ import { act } from "@lynx-js/react/testing-library";
442
458
 
443
459
  act(() => {
444
460
  // ...
@@ -544,8 +560,7 @@
544
560
  * 3: Full Resolution - Batch render with async property and element tree resolution for list item subtree
545
561
  */
546
562
  experimental-batch-render-strategy={3}
547
- >
548
- </list>;
563
+ ></list>
549
564
  ```
550
565
 
551
566
  - rename @lynx-js/test-environment to @lynx-js/testing-environment ([#704](https://github.com/lynx-family/lynx-stack/pull/704))
@@ -663,7 +678,7 @@
663
678
  You can now use `useErrorBoundary` it in TypeScript like this:
664
679
 
665
680
  ```tsx
666
- import { useErrorBoundary } from '@lynx-js/react';
681
+ import { useErrorBoundary } from "@lynx-js/react";
667
682
  ```
668
683
 
669
684
  - Modified the format of data sent from background threads to the main thread. ([#207](https://github.com/lynx-family/lynx-stack/pull/207))
@@ -715,13 +730,13 @@
715
730
  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.
716
731
 
717
732
  ```js
718
- import { runOnBackground } from '@lynx-js/react';
733
+ import { runOnBackground } from "@lynx-js/react";
719
734
 
720
735
  const onTap = async () => {
721
- 'main thread';
736
+ "main thread";
722
737
  const text = await runOnBackground(() => {
723
- 'background only';
724
- return 'Hello, world!';
738
+ "background only";
739
+ return "Hello, world!";
725
740
  })();
726
741
  console.log(text);
727
742
  };
@@ -756,9 +771,9 @@
756
771
 
757
772
  ```ts
758
773
  // These imports will be removed from the final bundle
759
- import type { Foo } from 'xyz';
760
- import { type Bar } from 'xyz';
761
- import { xyz } from 'xyz'; // When xyz is not used
774
+ import type { Foo } from "xyz";
775
+ import { type Bar } from "xyz";
776
+ import { xyz } from "xyz"; // When xyz is not used
762
777
  ```
763
778
 
764
779
  See [TypeScript - verbatimModuleSyntax](https://www.typescriptlang.org/tsconfig/#verbatimModuleSyntax) for details.
@@ -798,7 +813,7 @@
798
813
  const f = undefined;
799
814
 
800
815
  function mts() {
801
- 'main thread';
816
+ "main thread";
802
817
  // throws in background rendering
803
818
  f && runOnBackground(f)();
804
819
  }
@@ -832,14 +847,14 @@
832
847
  - a30c83d: Add `compat.removeComponentAttrRegex`.
833
848
 
834
849
  ```js
835
- import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin';
836
- import { defineConfig } from '@lynx-js/rspeedy';
850
+ import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
851
+ import { defineConfig } from "@lynx-js/rspeedy";
837
852
 
838
853
  export default defineConfig({
839
854
  plugins: [
840
855
  pluginReactLynx({
841
856
  compat: {
842
- removeComponentAttrRegex: 'YOUR REGEX',
857
+ removeComponentAttrRegex: "YOUR REGEX",
843
858
  },
844
859
  }),
845
860
  ],
@@ -925,22 +940,22 @@
925
940
  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.
926
941
 
927
942
  ```tsx
928
- import { useGesture, PanGesture } from '@lynx-js/gesture-runtime';
943
+ import { useGesture, PanGesture } from "@lynx-js/gesture-runtime";
929
944
 
930
945
  function App() {
931
946
  const pan = useGesture(PanGesture);
932
947
 
933
948
  pan
934
949
  .onBegin((event, stateManager) => {
935
- 'main thread';
950
+ "main thread";
936
951
  // some logic
937
952
  })
938
953
  .onUpdate((event, stateManager) => {
939
- 'main thread';
954
+ "main thread";
940
955
  // some logic
941
956
  })
942
957
  .onEnd((event, stateManager) => {
943
- 'main thread';
958
+ "main thread";
944
959
  // some logic
945
960
  });
946
961
 
@@ -960,7 +975,7 @@
960
975
  return;
961
976
  }
962
977
 
963
- console.log('not __LEPUS__'); // This can be removed now
978
+ console.log("not __LEPUS__"); // This can be removed now
964
979
  }
965
980
  ```
966
981
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/react-canary",
3
- "version": "0.115.3",
3
+ "version": "0.115.4-canary-20260107-27c3d90f",
4
4
  "description": "ReactLynx is a framework for developing Lynx applications with familiar React.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -2,15 +2,10 @@
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.15.0
5
+ Rslib v0.19.1
6
6
 
7
- [Rspack Deprecation] `experiments.lazyBarrel` config is deprecated and will be removed in Rspack v2.0. Lazy barrel is already stable and enabled by default. Remove this option from your Rspack configuration.
8
- [Rspack Deprecation] `experiments.inlineConst` config is deprecated and will be removed in Rspack v2.0. Inline Const is already stable and enabled by default. Remove this option from your Rspack configuration.
9
- [Rspack Deprecation] `experiments.inlineEnum` config is deprecated and will be removed in Rspack v2.0. Inline Enum is already stable. Remove this option from your Rspack configuration.
10
- [Rspack Deprecation] `experiments.typeReexportsPresence` config is deprecated and will be removed in Rspack v2.0. typeReexportsPresence is already stable. Remove this option from your Rspack configuration.
11
7
  info build started...
12
- [Rspack Deprecation] `rspackExperiments.collectTypeScriptInfo` is deprecated and will be removed in Rspack v2.0. Use top-level `collectTypeScriptInfo` instead.
13
- ready built in 0.12 s
8
+ ready built in 0.21 s
14
9
 
15
10
  File (esm) Size 
16
11
  dist/index.js 10.1 kB
@@ -1,5 +1,4 @@
1
1
  import { Component, options } from "@lynx-js/react/internal";
2
- const NAMESPACE = '__PREFRESH__';
3
2
  const COMPONENT_DIRTY_BIT = 8;
4
3
  const isDirty = (vnode)=>{
5
4
  if (vnode["__c"] && vnode["__c"]["__d"]) return true;
@@ -89,6 +88,7 @@ options.unmount = (vnode)=>{
89
88
  }
90
89
  if (oldUnmount) oldUnmount(vnode);
91
90
  };
91
+ const NAMESPACE = '__PREFRESH__';
92
92
  const signaturesForType = new WeakMap();
93
93
  const computeKey = (signature)=>{
94
94
  let fullKey = signature.key;
@@ -222,8 +222,8 @@ globalThis[NAMESPACE] = {
222
222
  flush: ()=>{
223
223
  pendingUpdates = [];
224
224
  },
225
- replaceComponent,
226
- sign,
225
+ replaceComponent: replaceComponent,
226
+ sign: sign,
227
227
  computeKey: computeKey
228
228
  };
229
229
  const compareSignatures = (prev, next)=>{
@@ -9,10 +9,10 @@ import { LifecycleConstant } from '../lifecycleConstant.js';
9
9
  import { ssrHydrateByOpcodes } from '../opcodes.js';
10
10
  import { __pendingListUpdates } from '../pendingListUpdates.js';
11
11
  import { __root, setRoot } from '../root.js';
12
+ import { markTiming, setPipeline } from './performance.js';
12
13
  import { applyRefQueue } from '../snapshot/workletRef.js';
13
14
  import { SnapshotInstance, __page, setupPage } from '../snapshot.js';
14
15
  import { isEmptyObject } from '../utils.js';
15
- import { markTiming, setPipeline } from './performance.js';
16
16
  function ssrEncode() {
17
17
  const { __opcodes } = __root;
18
18
  delete __root.__opcodes;
@@ -26,7 +26,13 @@ function ssrEncode() {
26
26
  ];
27
27
  };
28
28
  try {
29
- return JSON.stringify({ __opcodes, __root_values: __root.__values });
29
+ const replacer = (_key, value) => {
30
+ if (value && typeof value === 'object' && '_wkltId' in value) {
31
+ return null;
32
+ }
33
+ return value;
34
+ };
35
+ return JSON.stringify({ __opcodes, __root_values: __root.__values }, replacer);
30
36
  }
31
37
  finally {
32
38
  SnapshotInstance.prototype.toJSON = oldToJSON;
@@ -1 +1 @@
1
- {"version":3,"file":"calledByNative.js","sourceRoot":"","sources":["../../src/lynx/calledByNative.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACrG,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE3D,SAAS,SAAS;IAChB,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IAC7B,OAAO,MAAM,CAAC,SAAS,CAAC;IAExB,6DAA6D;IAC7D,MAAM,SAAS,GAAG,gBAAgB,CAAC,SAAS,CAAC,MAAM,CAAC;IACpD,gBAAgB,CAAC,SAAS,CAAC,MAAM,GAAG;QAClC,OAAO;YACL,IAAI,CAAC,IAAI;YACT,IAAI,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AG,OAAO,IAAI,EAAE,CAAC;IACnC,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,MAAM,CAAC;QACvB,OAAO,CAAC,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;QACtC,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAE7B,WAAW,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;QACtC,UAAU,CAAC,qBAAqB,CAAC,CAAC;QAClC,CAAC;YACC,oBAAoB,CAAC,kBAAkB,EAAE,CAAC;YAC1C,gBAAgB,EAAE,CAAC;YACnB,yFAAyF;YACzF,+DAA+D;YAC/D,OAAO,CACL,OAA2B,EAC3B,MAA0B,EAC1B,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAC9C,CAAC;YAEF,+CAA+C;YAC/C,oBAAoB,CAAC,KAAK,EAAE,CAAC;YAC7B,aAAa,EAAE,CAAC;QAClB,CAAC;QACD,YAAY,CAAC,kBAAkB,GAAG,IAAI,CAAC;QACvC,UAAU,CAAC,mBAAmB,CAAC,CAAC;IAClC,CAAC;IAED,kBAAkB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAC3C,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAU,EAAE,OAA0B;IAC/D,IAAI,OAAO,EAAE,CAAC;QACZ,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;SAAM,CAAC;QACN,kBAAkB,EAAE,CAAC;IACvB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
@@ -111,8 +111,7 @@ const initElementTree = ()=>{
111
111
  e.setAttribute(key, JSON.stringify(value));
112
112
  }
113
113
  __AddEvent(e, eventType, eventName, eventHandler) {
114
- var _e_eventMap;
115
- if (null == (_e_eventMap = e.eventMap) ? void 0 : _e_eventMap[`${eventType}:${eventName}`]) {
114
+ if (e.eventMap?.[`${eventType}:${eventName}`]) {
116
115
  e.removeEventListener(`${eventType}:${eventName}`, e.eventMap[`${eventType}:${eventName}`]);
117
116
  delete e.eventMap[`${eventType}:${eventName}`];
118
117
  }
@@ -138,8 +137,7 @@ const initElementTree = ()=>{
138
137
  });
139
138
  }
140
139
  __GetEvent(e, eventType, eventName) {
141
- var _e_eventMap;
142
- const jsFunction = null == (_e_eventMap = e.eventMap) ? void 0 : _e_eventMap[`${eventType}:${eventName}`];
140
+ const jsFunction = e.eventMap?.[`${eventType}:${eventName}`];
143
141
  if (void 0 !== jsFunction) return {
144
142
  type: eventType,
145
143
  name: eventName,
@@ -325,12 +323,11 @@ function __injectElementApi(target) {
325
323
  function createPolyfills() {
326
324
  const app = {
327
325
  callLepusMethod: (...rLynxChange)=>{
328
- var _rLynxChange_;
329
326
  const isBackground = !__MAIN_THREAD__;
330
327
  globalThis.lynxTestingEnv.switchToMainThread();
331
328
  globalThis[rLynxChange[0]](rLynxChange[1]);
332
329
  globalThis.lynxTestingEnv.switchToBackgroundThread();
333
- null == (_rLynxChange_ = rLynxChange[2]) || _rLynxChange_.call(rLynxChange);
330
+ rLynxChange[2]?.();
334
331
  globalThis.lynxTestingEnv.switchToMainThread();
335
332
  if (isBackground) globalThis.lynxTestingEnv.switchToBackgroundThread();
336
333
  },
@@ -389,10 +386,8 @@ function createPolyfills() {
389
386
  const isBackground = !__MAIN_THREAD__;
390
387
  globalThis.lynxTestingEnv.switchToMainThread();
391
388
  let ans;
392
- if ('worklet-runtime' === chunkName) {
393
- var _globalThis_onInitWorkletRuntime, _globalThis;
394
- ans = null == (_globalThis_onInitWorkletRuntime = (_globalThis = globalThis).onInitWorkletRuntime) ? void 0 : _globalThis_onInitWorkletRuntime.call(_globalThis);
395
- } else throw new Error(`__LoadLepusChunk: Unknown chunk name: ${chunkName}`);
389
+ if ('worklet-runtime' === chunkName) ans = globalThis.onInitWorkletRuntime?.();
390
+ else throw new Error(`__LoadLepusChunk: Unknown chunk name: ${chunkName}`);
396
391
  if (isBackground) globalThis.lynxTestingEnv.switchToBackgroundThread();
397
392
  return ans;
398
393
  }
@@ -412,7 +407,6 @@ function createPreconfiguredConsole() {
412
407
  return console1;
413
408
  }
414
409
  function injectMainThreadGlobals(target, polyfills) {
415
- var _globalThis_onInjectMainThreadGlobals, _globalThis;
416
410
  __injectElementApi(target);
417
411
  const { performance, CoreContext, JsContext, __LoadLepusChunk } = polyfills || {};
418
412
  if (void 0 === target) target = globalThis;
@@ -440,7 +434,7 @@ function injectMainThreadGlobals(target, polyfills) {
440
434
  target.cancelAnimationFrame = clearTimeout;
441
435
  target.console = createPreconfiguredConsole();
442
436
  target.__LoadLepusChunk = __LoadLepusChunk;
443
- null == (_globalThis_onInjectMainThreadGlobals = (_globalThis = globalThis).onInjectMainThreadGlobals) || _globalThis_onInjectMainThreadGlobals.call(_globalThis, target);
437
+ globalThis.onInjectMainThreadGlobals?.(target);
444
438
  }
445
439
  const IGNORE_LIST_GLOBALS = [
446
440
  'globalThis',
@@ -473,7 +467,6 @@ class NodesRef {
473
467
  }
474
468
  }
475
469
  function injectBackgroundThreadGlobals(target, polyfills) {
476
- var _globalThis_onInjectBackgroundThreadGlobals, _globalThis;
477
470
  const { app, performance, CoreContext, JsContext, __LoadLepusChunk } = polyfills || {};
478
471
  if (void 0 === target) target = globalThis;
479
472
  target.__DEV__ = true;
@@ -536,7 +529,7 @@ function injectBackgroundThreadGlobals(target, polyfills) {
536
529
  lynxSdkVersion: '3.0'
537
530
  };
538
531
  target.__LoadLepusChunk = __LoadLepusChunk;
539
- null == (_globalThis_onInjectBackgroundThreadGlobals = (_globalThis = globalThis).onInjectBackgroundThreadGlobals) || _globalThis_onInjectBackgroundThreadGlobals.call(_globalThis, target);
532
+ globalThis.onInjectBackgroundThreadGlobals?.(target);
540
533
  }
541
534
  class LynxTestingEnv {
542
535
  injectGlobals() {
@@ -545,38 +538,34 @@ class LynxTestingEnv {
545
538
  injectMainThreadGlobals(this.mainThread.globalThis, polyfills);
546
539
  }
547
540
  switchToBackgroundThread() {
548
- var _globalThis_onSwitchedToBackgroundThread, _globalThis;
549
541
  this.originals = new Map();
550
542
  Object.getOwnPropertyNames(this.backgroundThread.globalThis).forEach((key)=>{
551
543
  if (IGNORE_LIST_GLOBALS.includes(key)) return;
552
544
  this.originals.set(key, global[key]);
553
545
  global[key] = this.backgroundThread.globalThis[key];
554
546
  });
555
- null == (_globalThis = globalThis) || null == (_globalThis_onSwitchedToBackgroundThread = _globalThis.onSwitchedToBackgroundThread) || _globalThis_onSwitchedToBackgroundThread.call(_globalThis);
547
+ globalThis?.onSwitchedToBackgroundThread?.();
556
548
  }
557
549
  switchToMainThread() {
558
- var _globalThis_onSwitchedToMainThread, _globalThis;
559
550
  this.originals = new Map();
560
551
  Object.getOwnPropertyNames(this.mainThread.globalThis).forEach((key)=>{
561
552
  if (IGNORE_LIST_GLOBALS.includes(key)) return;
562
553
  this.originals.set(key, global[key]);
563
554
  global[key] = this.mainThread.globalThis[key];
564
555
  });
565
- null == (_globalThis = globalThis) || null == (_globalThis_onSwitchedToMainThread = _globalThis.onSwitchedToMainThread) || _globalThis_onSwitchedToMainThread.call(_globalThis);
556
+ globalThis?.onSwitchedToMainThread?.();
566
557
  }
567
558
  clearGlobal() {
568
- var _this_originals, _this_originals1;
569
- null == (_this_originals = this.originals) || _this_originals.forEach((v, k)=>{
559
+ this.originals?.forEach((v, k)=>{
570
560
  global[k] = v;
571
561
  });
572
- null == (_this_originals1 = this.originals) || _this_originals1.clear();
562
+ this.originals?.clear();
573
563
  }
574
564
  reset() {
575
- var _globalThis_onResetLynxTestingEnv, _globalThis;
576
565
  this.injectGlobals();
577
566
  this.switchToMainThread();
578
567
  this.switchToBackgroundThread();
579
- null == (_globalThis_onResetLynxTestingEnv = (_globalThis = globalThis).onResetLynxTestingEnv) || _globalThis_onResetLynxTestingEnv.call(_globalThis);
568
+ globalThis.onResetLynxTestingEnv?.();
580
569
  }
581
570
  constructor(jsdom){
582
571
  dist_define_property(this, "originals", new Map());
@@ -619,4 +608,4 @@ const env = {
619
608
  };
620
609
  const vitest = env;
621
610
  const env_vitest = vitest;
622
- export { env_vitest as default };
611
+ export default env_vitest;