@lynx-js/react 0.109.0 → 0.109.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 +20 -0
- package/package.json +3 -3
- package/refresh/.turbo/turbo-build.log +1 -1
- package/refresh/package.json +1 -1
- package/runtime/lib/lifecycle/patch/snapshotPatchApply.js +8 -1
- package/runtime/lib/lifecycle/patch/snapshotPatchApply.js.map +1 -1
- package/runtime/lib/list.js +2 -2
- package/runtime/lib/list.js.map +1 -1
- package/runtime/lib/lynx/calledByNative.js +1 -1
- package/runtime/lib/lynx/calledByNative.js.map +1 -1
- package/runtime/lib/worklet/execMap.js +4 -3
- package/runtime/lib/worklet/execMap.js.map +1 -1
- package/runtime/lib/worklet/functionality.js +2 -8
- package/runtime/lib/worklet/functionality.js.map +1 -1
- package/runtime/lib/worklet/hmr.js.map +1 -1
- package/runtime/lib/worklet/indexMap.js +3 -0
- package/runtime/lib/worklet/indexMap.js.map +1 -1
- package/runtime/src/lifecycle/patch/snapshotPatchApply.ts +8 -1
- package/runtime/src/list.ts +2 -2
- package/runtime/src/lynx/calledByNative.ts +1 -1
- package/runtime/src/worklet/execMap.ts +4 -3
- package/runtime/src/worklet/functionality.ts +2 -8
- package/runtime/src/worklet/hmr.ts +5 -1
- package/runtime/src/worklet/indexMap.ts +4 -1
- package/testing-library/dist/env/vitest.js +5 -5
- package/testing-library/dist/index.js +3 -3
- package/testing-library/dist/pure.js +89 -89
- package/testing-library/dist/vitest-global-setup.js +41 -41
- package/testing-library/dist/vitest.config.js +17 -14
- package/transform/dist/wasm.cjs +1 -2
- package/worklet-runtime/dist/dev.js +1 -1
- package/worklet-runtime/dist/main.js +0 -1
- package/worklet-runtime/lib/bindings/bindings.d.ts +1 -1
- package/worklet-runtime/lib/bindings/bindings.js +1 -26
- package/worklet-runtime/lib/bindings/bindings.js.map +1 -1
- package/worklet-runtime/lib/bindings/index.d.ts +2 -1
- package/worklet-runtime/lib/bindings/index.js +2 -1
- package/worklet-runtime/lib/bindings/index.js.map +1 -1
- package/worklet-runtime/lib/bindings/observers.d.ts +1 -0
- package/worklet-runtime/lib/bindings/observers.js +31 -0
- package/worklet-runtime/lib/bindings/observers.js.map +1 -0
- package/worklet-runtime/dist/dev.js.map +0 -8
- package/worklet-runtime/dist/main.js.map +0 -8
|
@@ -1,92 +1,92 @@
|
|
|
1
1
|
/*! For license information please see pure.js.LICENSE.txt */
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
2
|
+
import { jsx } from "@lynx-js/react/jsx-runtime";
|
|
3
|
+
import { cloneElement, createRef, h, render } from "preact";
|
|
4
|
+
import { useEffect } from "preact/hooks";
|
|
5
|
+
import { act } from "preact/test-utils";
|
|
6
|
+
import { __root } from "@lynx-js/react/internal";
|
|
7
|
+
import { flushDelayedLifecycleEvents } from "../../runtime/lib/lynx/tt.js";
|
|
8
|
+
import { clearPage } from "../../runtime/lib/snapshot.js";
|
|
9
9
|
var __webpack_modules__ = {
|
|
10
10
|
"../../../node_modules/.pnpm/@testing-library+dom@10.4.0/node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js": function(module, __webpack_exports__, __webpack_require__) {
|
|
11
11
|
__webpack_require__.d(__webpack_exports__, {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
SU: ()=>findAllByTitle,
|
|
15
|
-
UK: ()=>getAllByTestId,
|
|
16
|
-
iJ: ()=>getAllByDisplayValue,
|
|
17
|
-
xx: ()=>findByPlaceholderText,
|
|
18
|
-
dB: ()=>getAllByTitle,
|
|
19
|
-
nG: ()=>getElementError,
|
|
20
|
-
F3: ()=>getRoles,
|
|
21
|
-
VF: ()=>queryAllByRoleWithSuggestions,
|
|
22
|
-
Z2: ()=>queryAllByTextWithSuggestions,
|
|
23
|
-
sp: ()=>screen,
|
|
24
|
-
Gi: ()=>buildQueries,
|
|
12
|
+
qg: ()=>getNodeText,
|
|
13
|
+
j: ()=>findAllByPlaceholderText,
|
|
25
14
|
Qc: ()=>findByAltText,
|
|
26
|
-
|
|
15
|
+
FE: ()=>getAllByText,
|
|
16
|
+
Jh: ()=>queryAllByDisplayValueWithSuggestions,
|
|
17
|
+
zZ: ()=>queryByText,
|
|
18
|
+
Rr: ()=>findAllByRole,
|
|
27
19
|
Sd: ()=>queryAllByTestIdWithSuggestions,
|
|
28
|
-
si: ()=>getByTestId,
|
|
29
|
-
DP: ()=>queryAllByPlaceholderTextWithSuggestions,
|
|
30
|
-
fl: ()=>findAllByText,
|
|
31
|
-
pP: ()=>findByTitle,
|
|
32
|
-
gF: ()=>getByDisplayValue,
|
|
33
|
-
u7: ()=>getByPlaceholderText,
|
|
34
|
-
kt: ()=>makeGetAllQuery,
|
|
35
|
-
fV: ()=>makeSingleQuery,
|
|
36
20
|
m_: ()=>build,
|
|
37
|
-
j: ()=>findAllByPlaceholderText,
|
|
38
|
-
cp: ()=>queryAllByTitleWithSuggestions,
|
|
39
|
-
MS: ()=>getByText,
|
|
40
|
-
PD: ()=>queryAllByAltTextWithSuggestions,
|
|
41
|
-
jQ: ()=>configure,
|
|
42
|
-
QU: ()=>queryAllByLabelTextWithSuggestions,
|
|
43
|
-
hq: ()=>queryByDisplayValue,
|
|
44
|
-
$S: ()=>getAllByRole,
|
|
45
21
|
Lr: ()=>getAllByAltText,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
KS: ()=>queryByPlaceholderText,
|
|
53
|
-
X_: ()=>waitForWrapper,
|
|
22
|
+
iE: ()=>getConfig,
|
|
23
|
+
Op: ()=>getAllByPlaceholderText,
|
|
24
|
+
dB: ()=>getAllByTitle,
|
|
25
|
+
DR: ()=>findByDisplayValue,
|
|
26
|
+
MY: ()=>findAllByTestId,
|
|
27
|
+
o$: ()=>queries,
|
|
54
28
|
mz: ()=>waitForElementToBeRemoved,
|
|
55
|
-
zZ: ()=>queryByText,
|
|
56
|
-
uh: ()=>getQueriesForElement,
|
|
57
29
|
Do: ()=>findAllByLabelText,
|
|
30
|
+
YA: ()=>getByRole,
|
|
31
|
+
bH: ()=>wrapAllByQueryWithSuggestion,
|
|
58
32
|
BX: ()=>fireEvent,
|
|
33
|
+
pP: ()=>findByTitle,
|
|
34
|
+
DP: ()=>queryAllByPlaceholderTextWithSuggestions,
|
|
35
|
+
SU: ()=>findAllByTitle,
|
|
36
|
+
aT: ()=>findAllByDisplayValue,
|
|
59
37
|
YS: ()=>getByLabelTextWithSuggestions,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
38
|
+
Qz: ()=>getSuggestedQuery,
|
|
39
|
+
iJ: ()=>getAllByDisplayValue,
|
|
40
|
+
X_: ()=>waitForWrapper,
|
|
41
|
+
J$: ()=>logDOM,
|
|
42
|
+
UK: ()=>getAllByTestId,
|
|
43
|
+
$S: ()=>getAllByRole,
|
|
44
|
+
gm: ()=>findByLabelText,
|
|
45
|
+
Cn: ()=>getByTitle,
|
|
46
|
+
si: ()=>getByTestId,
|
|
47
|
+
Gi: ()=>buildQueries,
|
|
48
|
+
c6: ()=>getMultipleElementsFoundError,
|
|
49
|
+
MS: ()=>getByText,
|
|
50
|
+
CZ: ()=>dom_esm_isInaccessible,
|
|
51
|
+
VF: ()=>queryAllByRoleWithSuggestions,
|
|
70
52
|
JU: ()=>queryByAttribute,
|
|
71
|
-
fn: ()=>queryByLabelText,
|
|
72
53
|
zx: ()=>queryHelpers,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
54
|
+
cp: ()=>queryAllByTitleWithSuggestions,
|
|
55
|
+
hq: ()=>queryByDisplayValue,
|
|
56
|
+
fn: ()=>queryByLabelText,
|
|
57
|
+
nG: ()=>getElementError,
|
|
58
|
+
sp: ()=>screen,
|
|
59
|
+
nd: ()=>findByTestId,
|
|
60
|
+
u7: ()=>getByPlaceholderText,
|
|
61
|
+
kG: ()=>wrapSingleQueryWithSuggestion,
|
|
62
|
+
uh: ()=>getQueriesForElement,
|
|
63
|
+
QU: ()=>queryAllByLabelTextWithSuggestions,
|
|
76
64
|
kd: ()=>findAllByAltText,
|
|
77
|
-
|
|
78
|
-
o$: ()=>queries,
|
|
79
|
-
Xv: ()=>queryByTestId,
|
|
80
|
-
MY: ()=>findAllByTestId,
|
|
65
|
+
fl: ()=>findAllByText,
|
|
81
66
|
T6: ()=>getAllByLabelTextWithSuggestions,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
67
|
+
nE: ()=>getByAltText,
|
|
68
|
+
vF: ()=>prettyDOM,
|
|
69
|
+
PD: ()=>queryAllByAltTextWithSuggestions,
|
|
70
|
+
M: ()=>findByText,
|
|
71
|
+
RG: ()=>queryByRole,
|
|
72
|
+
Xv: ()=>queryByTestId,
|
|
73
|
+
Ox: ()=>queryAllByAttribute,
|
|
74
|
+
Uv: ()=>makeFindQuery,
|
|
75
|
+
xG: ()=>getDefaultNormalizer,
|
|
76
|
+
yM: ()=>createEvent,
|
|
77
|
+
xx: ()=>findByPlaceholderText,
|
|
78
|
+
fV: ()=>makeSingleQuery,
|
|
79
|
+
jQ: ()=>configure,
|
|
80
|
+
Z2: ()=>queryAllByTextWithSuggestions,
|
|
81
|
+
hN: ()=>findByRole,
|
|
85
82
|
W2: ()=>getQueriesForElement,
|
|
86
83
|
m2: ()=>logRoles,
|
|
87
|
-
Jh: ()=>queryAllByDisplayValueWithSuggestions,
|
|
88
84
|
rf: ()=>queryByAltText,
|
|
89
|
-
|
|
85
|
+
KS: ()=>queryByPlaceholderText,
|
|
86
|
+
kt: ()=>makeGetAllQuery,
|
|
87
|
+
F3: ()=>getRoles,
|
|
88
|
+
MM: ()=>queryByTitle,
|
|
89
|
+
gF: ()=>getByDisplayValue
|
|
90
90
|
});
|
|
91
91
|
var build = __webpack_require__("../../../node_modules/.pnpm/pretty-format@27.5.1/node_modules/pretty-format/build/index.js");
|
|
92
92
|
var toStr = Object.prototype.toString;
|
|
@@ -14566,33 +14566,33 @@ function waitSchedule() {
|
|
|
14566
14566
|
(0, dom_esm.jQ)({
|
|
14567
14567
|
asyncWrapper: async (cb)=>{
|
|
14568
14568
|
let result;
|
|
14569
|
-
await
|
|
14569
|
+
await act(()=>{
|
|
14570
14570
|
result = cb();
|
|
14571
14571
|
});
|
|
14572
14572
|
return result;
|
|
14573
14573
|
},
|
|
14574
14574
|
eventWrapper: (cb)=>{
|
|
14575
14575
|
let result;
|
|
14576
|
-
|
|
14576
|
+
act(()=>{
|
|
14577
14577
|
result = cb();
|
|
14578
14578
|
});
|
|
14579
14579
|
return result;
|
|
14580
14580
|
}
|
|
14581
14581
|
});
|
|
14582
|
-
function
|
|
14582
|
+
function pure_render(ui, { queries, wrapper: WrapperComponent, enableMainThread = false, enableBackgroundThread = true } = {}) {
|
|
14583
14583
|
if (!enableMainThread && !enableBackgroundThread) throw new Error('You must enable at least one thread for rendering (enableMainThread or enableBackgroundThread)');
|
|
14584
|
-
const wrapUiIfNeeded = (innerElement)=>WrapperComponent ?
|
|
14584
|
+
const wrapUiIfNeeded = (innerElement)=>WrapperComponent ? h(WrapperComponent, null, innerElement) : innerElement;
|
|
14585
14585
|
const comp = wrapUiIfNeeded(ui);
|
|
14586
|
-
const compMainThread =
|
|
14587
|
-
const compBackgroundThread =
|
|
14586
|
+
const compMainThread = cloneElement(comp);
|
|
14587
|
+
const compBackgroundThread = cloneElement(comp);
|
|
14588
14588
|
globalThis.lynxTestingEnv.switchToMainThread();
|
|
14589
|
-
|
|
14589
|
+
__root.__jsx = enableMainThread ? compMainThread : null;
|
|
14590
14590
|
renderPage();
|
|
14591
14591
|
if (enableBackgroundThread) {
|
|
14592
14592
|
globalThis.lynxTestingEnv.switchToBackgroundThread();
|
|
14593
|
-
|
|
14594
|
-
|
|
14595
|
-
|
|
14593
|
+
act(()=>{
|
|
14594
|
+
render(compBackgroundThread, __root);
|
|
14595
|
+
flushDelayedLifecycleEvents();
|
|
14596
14596
|
});
|
|
14597
14597
|
}
|
|
14598
14598
|
return {
|
|
@@ -14600,7 +14600,7 @@ function render(ui, { queries, wrapper: WrapperComponent, enableMainThread = fal
|
|
|
14600
14600
|
unmount: cleanup,
|
|
14601
14601
|
rerender: (rerenderUi)=>{
|
|
14602
14602
|
lynxTestingEnv.reset();
|
|
14603
|
-
return
|
|
14603
|
+
return pure_render(wrapUiIfNeeded(rerenderUi), {
|
|
14604
14604
|
queries,
|
|
14605
14605
|
wrapper: WrapperComponent,
|
|
14606
14606
|
enableMainThread,
|
|
@@ -14613,31 +14613,31 @@ function render(ui, { queries, wrapper: WrapperComponent, enableMainThread = fal
|
|
|
14613
14613
|
function cleanup() {
|
|
14614
14614
|
const isMainThread = __MAIN_THREAD__;
|
|
14615
14615
|
globalThis.lynxTestingEnv.switchToBackgroundThread();
|
|
14616
|
-
|
|
14617
|
-
|
|
14616
|
+
act(()=>{
|
|
14617
|
+
render(null, __root);
|
|
14618
14618
|
});
|
|
14619
14619
|
lynxTestingEnv.mainThread.elementTree.root = void 0;
|
|
14620
|
-
|
|
14620
|
+
clearPage();
|
|
14621
14621
|
lynxTestingEnv.jsdom.window.document.body.innerHTML = '';
|
|
14622
14622
|
if (isMainThread) globalThis.lynxTestingEnv.switchToMainThread();
|
|
14623
14623
|
}
|
|
14624
14624
|
function renderHook(renderCallback, options) {
|
|
14625
14625
|
const { initialProps, wrapper } = options || {};
|
|
14626
|
-
const result =
|
|
14626
|
+
const result = createRef();
|
|
14627
14627
|
function TestComponent({ renderCallbackProps }) {
|
|
14628
14628
|
const pendingResult = renderCallback(renderCallbackProps);
|
|
14629
|
-
|
|
14629
|
+
useEffect(()=>{
|
|
14630
14630
|
result.current = pendingResult;
|
|
14631
14631
|
});
|
|
14632
14632
|
return null;
|
|
14633
14633
|
}
|
|
14634
|
-
const { rerender: baseRerender, unmount } =
|
|
14634
|
+
const { rerender: baseRerender, unmount } = pure_render(/*#__PURE__*/ jsx(TestComponent, {
|
|
14635
14635
|
renderCallbackProps: initialProps
|
|
14636
14636
|
}), {
|
|
14637
14637
|
wrapper
|
|
14638
14638
|
});
|
|
14639
14639
|
function rerender(rerenderCallbackProps) {
|
|
14640
|
-
return baseRerender(/*#__PURE__*/
|
|
14640
|
+
return baseRerender(/*#__PURE__*/ jsx(TestComponent, {
|
|
14641
14641
|
renderCallbackProps: rerenderCallbackProps
|
|
14642
14642
|
}));
|
|
14643
14643
|
}
|
|
@@ -14724,4 +14724,4 @@ var __webpack_exports__waitForElementToBeRemoved = dom_esm.mz;
|
|
|
14724
14724
|
var __webpack_exports__within = dom_esm.uh;
|
|
14725
14725
|
var __webpack_exports__wrapAllByQueryWithSuggestion = dom_esm.bH;
|
|
14726
14726
|
var __webpack_exports__wrapSingleQueryWithSuggestion = dom_esm.kG;
|
|
14727
|
-
export { cleanup, fireEvent, render, renderHook, waitSchedule, __webpack_exports__buildQueries as buildQueries, __webpack_exports__configure as configure, __webpack_exports__createEvent as createEvent, __webpack_exports__findAllByAltText as findAllByAltText, __webpack_exports__findAllByDisplayValue as findAllByDisplayValue, __webpack_exports__findAllByLabelText as findAllByLabelText, __webpack_exports__findAllByPlaceholderText as findAllByPlaceholderText, __webpack_exports__findAllByRole as findAllByRole, __webpack_exports__findAllByTestId as findAllByTestId, __webpack_exports__findAllByText as findAllByText, __webpack_exports__findAllByTitle as findAllByTitle, __webpack_exports__findByAltText as findByAltText, __webpack_exports__findByDisplayValue as findByDisplayValue, __webpack_exports__findByLabelText as findByLabelText, __webpack_exports__findByPlaceholderText as findByPlaceholderText, __webpack_exports__findByRole as findByRole, __webpack_exports__findByTestId as findByTestId, __webpack_exports__findByText as findByText, __webpack_exports__findByTitle as findByTitle, __webpack_exports__getAllByAltText as getAllByAltText, __webpack_exports__getAllByDisplayValue as getAllByDisplayValue, __webpack_exports__getAllByLabelText as getAllByLabelText, __webpack_exports__getAllByPlaceholderText as getAllByPlaceholderText, __webpack_exports__getAllByRole as getAllByRole, __webpack_exports__getAllByTestId as getAllByTestId, __webpack_exports__getAllByText as getAllByText, __webpack_exports__getAllByTitle as getAllByTitle, __webpack_exports__getByAltText as getByAltText, __webpack_exports__getByDisplayValue as getByDisplayValue, __webpack_exports__getByLabelText as getByLabelText, __webpack_exports__getByPlaceholderText as getByPlaceholderText, __webpack_exports__getByRole as getByRole, __webpack_exports__getByTestId as getByTestId, __webpack_exports__getByText as getByText, __webpack_exports__getByTitle as getByTitle, __webpack_exports__getConfig as getConfig, __webpack_exports__getDefaultNormalizer as getDefaultNormalizer, __webpack_exports__getElementError as getElementError, __webpack_exports__getMultipleElementsFoundError as getMultipleElementsFoundError, __webpack_exports__getNodeText as getNodeText, __webpack_exports__getQueriesForElement as getQueriesForElement, __webpack_exports__getRoles as getRoles, __webpack_exports__getSuggestedQuery as getSuggestedQuery, __webpack_exports__isInaccessible as isInaccessible, __webpack_exports__logDOM as logDOM, __webpack_exports__logRoles as logRoles, __webpack_exports__makeFindQuery as makeFindQuery, __webpack_exports__makeGetAllQuery as makeGetAllQuery, __webpack_exports__makeSingleQuery as makeSingleQuery, __webpack_exports__prettyDOM as prettyDOM, __webpack_exports__prettyFormat as prettyFormat, __webpack_exports__queries as queries, __webpack_exports__queryAllByAltText as queryAllByAltText, __webpack_exports__queryAllByAttribute as queryAllByAttribute, __webpack_exports__queryAllByDisplayValue as queryAllByDisplayValue, __webpack_exports__queryAllByLabelText as queryAllByLabelText, __webpack_exports__queryAllByPlaceholderText as queryAllByPlaceholderText, __webpack_exports__queryAllByRole as queryAllByRole, __webpack_exports__queryAllByTestId as queryAllByTestId, __webpack_exports__queryAllByText as queryAllByText, __webpack_exports__queryAllByTitle as queryAllByTitle, __webpack_exports__queryByAltText as queryByAltText, __webpack_exports__queryByAttribute as queryByAttribute, __webpack_exports__queryByDisplayValue as queryByDisplayValue, __webpack_exports__queryByLabelText as queryByLabelText, __webpack_exports__queryByPlaceholderText as queryByPlaceholderText, __webpack_exports__queryByRole as queryByRole, __webpack_exports__queryByTestId as queryByTestId, __webpack_exports__queryByText as queryByText, __webpack_exports__queryByTitle as queryByTitle, __webpack_exports__queryHelpers as queryHelpers, __webpack_exports__screen as screen, __webpack_exports__waitFor as waitFor, __webpack_exports__waitForElementToBeRemoved as waitForElementToBeRemoved, __webpack_exports__within as within, __webpack_exports__wrapAllByQueryWithSuggestion as wrapAllByQueryWithSuggestion, __webpack_exports__wrapSingleQueryWithSuggestion as wrapSingleQueryWithSuggestion };
|
|
14727
|
+
export { cleanup, fireEvent, pure_render as render, renderHook, waitSchedule, __webpack_exports__buildQueries as buildQueries, __webpack_exports__configure as configure, __webpack_exports__createEvent as createEvent, __webpack_exports__findAllByAltText as findAllByAltText, __webpack_exports__findAllByDisplayValue as findAllByDisplayValue, __webpack_exports__findAllByLabelText as findAllByLabelText, __webpack_exports__findAllByPlaceholderText as findAllByPlaceholderText, __webpack_exports__findAllByRole as findAllByRole, __webpack_exports__findAllByTestId as findAllByTestId, __webpack_exports__findAllByText as findAllByText, __webpack_exports__findAllByTitle as findAllByTitle, __webpack_exports__findByAltText as findByAltText, __webpack_exports__findByDisplayValue as findByDisplayValue, __webpack_exports__findByLabelText as findByLabelText, __webpack_exports__findByPlaceholderText as findByPlaceholderText, __webpack_exports__findByRole as findByRole, __webpack_exports__findByTestId as findByTestId, __webpack_exports__findByText as findByText, __webpack_exports__findByTitle as findByTitle, __webpack_exports__getAllByAltText as getAllByAltText, __webpack_exports__getAllByDisplayValue as getAllByDisplayValue, __webpack_exports__getAllByLabelText as getAllByLabelText, __webpack_exports__getAllByPlaceholderText as getAllByPlaceholderText, __webpack_exports__getAllByRole as getAllByRole, __webpack_exports__getAllByTestId as getAllByTestId, __webpack_exports__getAllByText as getAllByText, __webpack_exports__getAllByTitle as getAllByTitle, __webpack_exports__getByAltText as getByAltText, __webpack_exports__getByDisplayValue as getByDisplayValue, __webpack_exports__getByLabelText as getByLabelText, __webpack_exports__getByPlaceholderText as getByPlaceholderText, __webpack_exports__getByRole as getByRole, __webpack_exports__getByTestId as getByTestId, __webpack_exports__getByText as getByText, __webpack_exports__getByTitle as getByTitle, __webpack_exports__getConfig as getConfig, __webpack_exports__getDefaultNormalizer as getDefaultNormalizer, __webpack_exports__getElementError as getElementError, __webpack_exports__getMultipleElementsFoundError as getMultipleElementsFoundError, __webpack_exports__getNodeText as getNodeText, __webpack_exports__getQueriesForElement as getQueriesForElement, __webpack_exports__getRoles as getRoles, __webpack_exports__getSuggestedQuery as getSuggestedQuery, __webpack_exports__isInaccessible as isInaccessible, __webpack_exports__logDOM as logDOM, __webpack_exports__logRoles as logRoles, __webpack_exports__makeFindQuery as makeFindQuery, __webpack_exports__makeGetAllQuery as makeGetAllQuery, __webpack_exports__makeSingleQuery as makeSingleQuery, __webpack_exports__prettyDOM as prettyDOM, __webpack_exports__prettyFormat as prettyFormat, __webpack_exports__queries as queries, __webpack_exports__queryAllByAltText as queryAllByAltText, __webpack_exports__queryAllByAttribute as queryAllByAttribute, __webpack_exports__queryAllByDisplayValue as queryAllByDisplayValue, __webpack_exports__queryAllByLabelText as queryAllByLabelText, __webpack_exports__queryAllByPlaceholderText as queryAllByPlaceholderText, __webpack_exports__queryAllByRole as queryAllByRole, __webpack_exports__queryAllByTestId as queryAllByTestId, __webpack_exports__queryAllByText as queryAllByText, __webpack_exports__queryAllByTitle as queryAllByTitle, __webpack_exports__queryByAltText as queryByAltText, __webpack_exports__queryByAttribute as queryByAttribute, __webpack_exports__queryByDisplayValue as queryByDisplayValue, __webpack_exports__queryByLabelText as queryByLabelText, __webpack_exports__queryByPlaceholderText as queryByPlaceholderText, __webpack_exports__queryByRole as queryByRole, __webpack_exports__queryByTestId as queryByTestId, __webpack_exports__queryByText as queryByText, __webpack_exports__queryByTitle as queryByTitle, __webpack_exports__queryHelpers as queryHelpers, __webpack_exports__screen as screen, __webpack_exports__waitFor as waitFor, __webpack_exports__waitForElementToBeRemoved as waitForElementToBeRemoved, __webpack_exports__within as within, __webpack_exports__wrapAllByQueryWithSuggestion as wrapAllByQueryWithSuggestion, __webpack_exports__wrapSingleQueryWithSuggestion as wrapSingleQueryWithSuggestion };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
1
|
+
import { options } from "preact";
|
|
2
|
+
import { BackgroundSnapshotInstance } from "../../runtime/lib/backgroundSnapshot.js";
|
|
3
|
+
import { clearCommitTaskId, replaceCommitHook } from "../../runtime/lib/lifecycle/patch/commit.js";
|
|
4
|
+
import { deinitGlobalSnapshotPatch } from "../../runtime/lib/lifecycle/patch/snapshotPatch.js";
|
|
5
|
+
import { injectUpdateMainThread } from "../../runtime/lib/lifecycle/patch/updateMainThread.js";
|
|
6
|
+
import { injectCalledByNative } from "../../runtime/lib/lynx/calledByNative.js";
|
|
7
|
+
import { flushDelayedLifecycleEvents, injectTt } from "../../runtime/lib/lynx/tt.js";
|
|
8
|
+
import { setRoot } from "../../runtime/lib/root.js";
|
|
9
|
+
import { SnapshotInstance, backgroundSnapshotInstanceManager, snapshotInstanceManager } from "../../runtime/lib/snapshot.js";
|
|
10
|
+
import { destroyWorklet } from "../../runtime/lib/worklet/destroy.js";
|
|
11
|
+
import { initApiEnv } from "../../worklet-runtime/lib/api/lynxApi.js";
|
|
12
|
+
import { initEventListeners } from "../../worklet-runtime/lib/listeners.js";
|
|
13
|
+
import { initWorklet } from "../../worklet-runtime/lib/workletRuntime.js";
|
|
14
14
|
const { onInjectMainThreadGlobals, onInjectBackgroundThreadGlobals, onResetLynxTestingEnv, onSwitchedToMainThread, onSwitchedToBackgroundThread, onInitWorkletRuntime } = globalThis;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
injectCalledByNative();
|
|
16
|
+
injectUpdateMainThread();
|
|
17
|
+
replaceCommitHook();
|
|
18
18
|
globalThis.onInitWorkletRuntime = ()=>{
|
|
19
19
|
if (onInitWorkletRuntime) onInitWorkletRuntime();
|
|
20
20
|
if (process.env.DEBUG) console.log('initWorkletRuntime');
|
|
@@ -22,26 +22,26 @@ globalThis.onInitWorkletRuntime = ()=>{
|
|
|
22
22
|
lynx.setInterval = setInterval;
|
|
23
23
|
lynx.clearTimeout = clearTimeout;
|
|
24
24
|
lynx.clearInterval = clearInterval;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
initWorklet();
|
|
26
|
+
initApiEnv();
|
|
27
|
+
initEventListeners();
|
|
28
28
|
return true;
|
|
29
29
|
};
|
|
30
30
|
globalThis.onInjectMainThreadGlobals = (target)=>{
|
|
31
31
|
if (onInjectMainThreadGlobals) onInjectMainThreadGlobals();
|
|
32
32
|
if (process.env.DEBUG) console.log('onInjectMainThreadGlobals');
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
target.__root = new
|
|
33
|
+
snapshotInstanceManager.clear();
|
|
34
|
+
snapshotInstanceManager.nextId = 0;
|
|
35
|
+
target.__root = new SnapshotInstance('root');
|
|
36
36
|
function setupDocument(document) {
|
|
37
37
|
document.createElement = function(type) {
|
|
38
|
-
return new
|
|
38
|
+
return new SnapshotInstance(type);
|
|
39
39
|
};
|
|
40
40
|
document.createElementNS = function(_ns, type) {
|
|
41
|
-
return new
|
|
41
|
+
return new SnapshotInstance(type);
|
|
42
42
|
};
|
|
43
43
|
document.createTextNode = function(text) {
|
|
44
|
-
const i = new
|
|
44
|
+
const i = new SnapshotInstance(null);
|
|
45
45
|
i.setAttribute(0, text);
|
|
46
46
|
Object.defineProperty(i, 'data', {
|
|
47
47
|
set (v) {
|
|
@@ -58,18 +58,18 @@ globalThis.onInjectMainThreadGlobals = (target)=>{
|
|
|
58
58
|
globalThis.onInjectBackgroundThreadGlobals = (target)=>{
|
|
59
59
|
if (onInjectBackgroundThreadGlobals) onInjectBackgroundThreadGlobals();
|
|
60
60
|
if (process.env.DEBUG) console.log('onInjectBackgroundThreadGlobals');
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
target.__root = new
|
|
61
|
+
backgroundSnapshotInstanceManager.clear();
|
|
62
|
+
backgroundSnapshotInstanceManager.nextId = 0;
|
|
63
|
+
target.__root = new BackgroundSnapshotInstance('root');
|
|
64
64
|
function setupBackgroundDocument(document) {
|
|
65
65
|
document.createElement = function(type) {
|
|
66
|
-
return new
|
|
66
|
+
return new BackgroundSnapshotInstance(type);
|
|
67
67
|
};
|
|
68
68
|
document.createElementNS = function(_ns, type) {
|
|
69
|
-
return new
|
|
69
|
+
return new BackgroundSnapshotInstance(type);
|
|
70
70
|
};
|
|
71
71
|
document.createTextNode = function(text) {
|
|
72
|
-
const i = new
|
|
72
|
+
const i = new BackgroundSnapshotInstance(null);
|
|
73
73
|
i.setAttribute(0, text);
|
|
74
74
|
Object.defineProperty(i, 'data', {
|
|
75
75
|
set (v) {
|
|
@@ -84,7 +84,7 @@ globalThis.onInjectBackgroundThreadGlobals = (target)=>{
|
|
|
84
84
|
target.globalPipelineOptions = void 0;
|
|
85
85
|
const oldLynxCoreInject = globalThis.lynxCoreInject;
|
|
86
86
|
globalThis.lynxCoreInject = target.lynxCoreInject;
|
|
87
|
-
|
|
87
|
+
injectTt();
|
|
88
88
|
globalThis.lynxCoreInject = oldLynxCoreInject;
|
|
89
89
|
target.lynx.requireModuleAsync = async (url, callback)=>{
|
|
90
90
|
try {
|
|
@@ -93,29 +93,29 @@ globalThis.onInjectBackgroundThreadGlobals = (target)=>{
|
|
|
93
93
|
callback(err, null);
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
deinitGlobalSnapshotPatch();
|
|
97
|
+
clearCommitTaskId();
|
|
98
98
|
};
|
|
99
99
|
globalThis.onResetLynxTestingEnv = ()=>{
|
|
100
100
|
if (onResetLynxTestingEnv) onResetLynxTestingEnv();
|
|
101
101
|
if (process.env.DEBUG) console.log('onResetLynxTestingEnv');
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
flushDelayedLifecycleEvents();
|
|
103
|
+
destroyWorklet();
|
|
104
104
|
lynxTestingEnv.switchToMainThread();
|
|
105
|
-
|
|
105
|
+
initEventListeners();
|
|
106
106
|
lynxTestingEnv.switchToBackgroundThread();
|
|
107
107
|
};
|
|
108
108
|
globalThis.onSwitchedToMainThread = ()=>{
|
|
109
109
|
if (onSwitchedToMainThread) onSwitchedToMainThread();
|
|
110
110
|
if (process.env.DEBUG) console.log('onSwitchedToMainThread');
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
setRoot(globalThis.__root);
|
|
112
|
+
options.document = globalThis._document;
|
|
113
113
|
};
|
|
114
114
|
globalThis.onSwitchedToBackgroundThread = ()=>{
|
|
115
115
|
if (onSwitchedToBackgroundThread) onSwitchedToBackgroundThread();
|
|
116
116
|
if (process.env.DEBUG) console.log('onSwitchedToBackgroundThread');
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
setRoot(globalThis.__root);
|
|
118
|
+
options.document = globalThis._document;
|
|
119
119
|
};
|
|
120
120
|
globalThis.onInjectMainThreadGlobals(globalThis.lynxTestingEnv.mainThread.globalThis);
|
|
121
121
|
globalThis.onInjectBackgroundThreadGlobals(globalThis.lynxTestingEnv.backgroundThread.globalThis);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
const vitest_config_filename =
|
|
7
|
-
const vitest_config_dirname =
|
|
8
|
-
const vitest_config_require =
|
|
1
|
+
import { defineConfig } from "vitest/config";
|
|
2
|
+
import { VitestPackageInstaller } from "vitest/node";
|
|
3
|
+
import external_path_default from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
import { createRequire } from "module";
|
|
6
|
+
const vitest_config_filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const vitest_config_dirname = external_path_default.dirname(vitest_config_filename);
|
|
8
|
+
const vitest_config_require = createRequire(import.meta.url);
|
|
9
9
|
async function ensurePackagesInstalled() {
|
|
10
|
-
const installer = new
|
|
10
|
+
const installer = new VitestPackageInstaller();
|
|
11
11
|
const installed = await installer.ensureInstalled('jsdom', process.cwd());
|
|
12
12
|
if (!installed) {
|
|
13
13
|
console.log('ReactLynx Testing Library requires jsdom to be installed.');
|
|
@@ -28,8 +28,8 @@ const createVitestConfig = async (options)=>{
|
|
|
28
28
|
return '';
|
|
29
29
|
}
|
|
30
30
|
const { transformReactLynxSync } = vitest_config_require('@lynx-js/react/transform');
|
|
31
|
-
const relativePath =
|
|
32
|
-
const basename =
|
|
31
|
+
const relativePath = normalizeSlashes(external_path_default.relative(vitest_config_dirname, sourcePath));
|
|
32
|
+
const basename = external_path_default.basename(sourcePath);
|
|
33
33
|
const result = transformReactLynxSync(sourceText, {
|
|
34
34
|
mode: 'test',
|
|
35
35
|
pluginName: '',
|
|
@@ -67,11 +67,11 @@ const createVitestConfig = async (options)=>{
|
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
-
return
|
|
70
|
+
return defineConfig({
|
|
71
71
|
server: {
|
|
72
72
|
fs: {
|
|
73
73
|
allow: [
|
|
74
|
-
|
|
74
|
+
external_path_default.join(vitest_config_dirname, '..')
|
|
75
75
|
]
|
|
76
76
|
}
|
|
77
77
|
},
|
|
@@ -82,9 +82,12 @@ const createVitestConfig = async (options)=>{
|
|
|
82
82
|
environment: vitest_config_require.resolve('./env/vitest'),
|
|
83
83
|
globals: true,
|
|
84
84
|
setupFiles: [
|
|
85
|
-
|
|
85
|
+
external_path_default.join(vitest_config_dirname, 'vitest-global-setup')
|
|
86
86
|
]
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
89
|
};
|
|
90
|
+
function normalizeSlashes(file) {
|
|
91
|
+
return file.replaceAll(external_path_default.win32.sep, '/');
|
|
92
|
+
}
|
|
90
93
|
export { createVitestConfig };
|