vitest-native 0.1.3 → 0.2.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 +6 -0
- package/dist/index.cjs +15 -16
- package/dist/index.mjs +15 -16
- package/dist/{preset-map-C5d8DSY7.cjs → preset-map-Bt4dXkZO.cjs} +3 -0
- package/dist/{preset-map-CTAjv5aa.mjs → preset-map-D224CC5w.mjs} +3 -0
- package/dist/{presets-DgEuMxfn.mjs → presets-C9tAPD15.mjs} +226 -120
- package/dist/{presets-ArwboRy7.cjs → presets-D4jrt194.cjs} +226 -120
- package/dist/presets.cjs +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/setup.cjs +2 -2
- package/dist/setup.mjs +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# vitest-native
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Add Metro-compatible extensionless module resolution for node_modules. Add navigation preset mocks for @react-navigation/native-stack, @react-navigation/bottom-tabs, and @react-navigation/elements. Support custom presets.
|
|
8
|
+
|
|
3
9
|
## 0.1.3
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_presets = require("./presets-
|
|
3
|
-
const require_preset_map = require("./preset-map-
|
|
2
|
+
const require_presets = require("./presets-D4jrt194.cjs");
|
|
3
|
+
const require_preset_map = require("./preset-map-Bt4dXkZO.cjs");
|
|
4
4
|
let node_url = require("node:url");
|
|
5
5
|
let node_path = require("node:path");
|
|
6
6
|
node_path = require_presets.__toESM(node_path);
|
|
@@ -197,16 +197,6 @@ const RN_EXPORT_NAMES = [
|
|
|
197
197
|
"NativeDialogManagerAndroid",
|
|
198
198
|
"usePressability"
|
|
199
199
|
];
|
|
200
|
-
/** Names of all built-in presets that can be reconstructed in the worker. */
|
|
201
|
-
const BUILT_IN_PRESET_NAMES = new Set([
|
|
202
|
-
"reanimated",
|
|
203
|
-
"gestureHandler",
|
|
204
|
-
"safeAreaContext",
|
|
205
|
-
"navigation",
|
|
206
|
-
"asyncStorage",
|
|
207
|
-
"screens",
|
|
208
|
-
"expo"
|
|
209
|
-
]);
|
|
210
200
|
/** Check if a value (or any nested value) contains functions. */
|
|
211
201
|
function containsFunctions(value, visited = /* @__PURE__ */ new WeakSet()) {
|
|
212
202
|
if (typeof value === "function") return true;
|
|
@@ -224,9 +214,6 @@ function containsFunctions(value, visited = /* @__PURE__ */ new WeakSet()) {
|
|
|
224
214
|
* React Native code in a Node/JSDOM environment.
|
|
225
215
|
*/
|
|
226
216
|
function reactNative(options) {
|
|
227
|
-
if (options?.presets) {
|
|
228
|
-
for (const preset of options.presets) if (!BUILT_IN_PRESET_NAMES.has(preset.name)) throw new Error(`[vitest-native] Unknown preset "${preset.name}". Only built-in presets are supported: ${[...BUILT_IN_PRESET_NAMES].join(", ")}. For custom module mocking, use vi.mock() in a setup file.`);
|
|
229
|
-
}
|
|
230
217
|
if (options?.mocks && containsFunctions(options.mocks)) throw new Error("[vitest-native] The \"mocks\" option contains function values, which cannot be transferred to Vitest worker processes. Only JSON-serializable values (strings, numbers, booleans, plain objects, arrays) are supported.\n\nFor function-based mock overrides, use vi.mock() in a setup file:\n\n // vitest.setup.ts\n import { vi } from 'vitest';\n vi.mock('react-native', async (importOriginal) => {\n const actual = await importOriginal();\n return { ...actual, Alert: { alert: vi.fn() } };\n });");
|
|
231
218
|
let resolved;
|
|
232
219
|
const presetModules = /* @__PURE__ */ new Map();
|
|
@@ -272,10 +259,22 @@ function reactNative(options) {
|
|
|
272
259
|
}
|
|
273
260
|
assetPattern = new RegExp(`\\.(${resolved.assetExts.join("|")})$`);
|
|
274
261
|
},
|
|
275
|
-
resolveId(source) {
|
|
262
|
+
resolveId(source, importer) {
|
|
276
263
|
if (source === "react-native") return "\0virtual:react-native";
|
|
277
264
|
if (source.startsWith("react-native/")) return `\0virtual:rn-subpath:${source}`;
|
|
278
265
|
if (presetModules.has(source)) return `\0virtual:preset:${source}`;
|
|
266
|
+
if (importer && importer.includes("node_modules") && source.startsWith(".") && !node_path.default.extname(source)) {
|
|
267
|
+
const importerDir = node_path.default.dirname(importer);
|
|
268
|
+
const absolute = node_path.default.resolve(importerDir, source);
|
|
269
|
+
for (const ext of extensions) {
|
|
270
|
+
const candidate = absolute + ext;
|
|
271
|
+
if (node_fs.default.existsSync(candidate)) return candidate;
|
|
272
|
+
}
|
|
273
|
+
for (const ext of extensions) {
|
|
274
|
+
const candidate = node_path.default.join(absolute, `index${ext}`);
|
|
275
|
+
if (node_fs.default.existsSync(candidate)) return candidate;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
279
278
|
},
|
|
280
279
|
load(id) {
|
|
281
280
|
if (id === "\0virtual:react-native") return "export default {};";
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as AUTO_DETECT_PRESETS } from "./preset-map-
|
|
2
|
-
import { t as presets_exports } from "./presets-
|
|
1
|
+
import { t as AUTO_DETECT_PRESETS } from "./preset-map-D224CC5w.mjs";
|
|
2
|
+
import { t as presets_exports } from "./presets-C9tAPD15.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import path from "node:path";
|
|
@@ -194,16 +194,6 @@ const RN_EXPORT_NAMES = [
|
|
|
194
194
|
"NativeDialogManagerAndroid",
|
|
195
195
|
"usePressability"
|
|
196
196
|
];
|
|
197
|
-
/** Names of all built-in presets that can be reconstructed in the worker. */
|
|
198
|
-
const BUILT_IN_PRESET_NAMES = new Set([
|
|
199
|
-
"reanimated",
|
|
200
|
-
"gestureHandler",
|
|
201
|
-
"safeAreaContext",
|
|
202
|
-
"navigation",
|
|
203
|
-
"asyncStorage",
|
|
204
|
-
"screens",
|
|
205
|
-
"expo"
|
|
206
|
-
]);
|
|
207
197
|
/** Check if a value (or any nested value) contains functions. */
|
|
208
198
|
function containsFunctions(value, visited = /* @__PURE__ */ new WeakSet()) {
|
|
209
199
|
if (typeof value === "function") return true;
|
|
@@ -221,9 +211,6 @@ function containsFunctions(value, visited = /* @__PURE__ */ new WeakSet()) {
|
|
|
221
211
|
* React Native code in a Node/JSDOM environment.
|
|
222
212
|
*/
|
|
223
213
|
function reactNative(options) {
|
|
224
|
-
if (options?.presets) {
|
|
225
|
-
for (const preset of options.presets) if (!BUILT_IN_PRESET_NAMES.has(preset.name)) throw new Error(`[vitest-native] Unknown preset "${preset.name}". Only built-in presets are supported: ${[...BUILT_IN_PRESET_NAMES].join(", ")}. For custom module mocking, use vi.mock() in a setup file.`);
|
|
226
|
-
}
|
|
227
214
|
if (options?.mocks && containsFunctions(options.mocks)) throw new Error("[vitest-native] The \"mocks\" option contains function values, which cannot be transferred to Vitest worker processes. Only JSON-serializable values (strings, numbers, booleans, plain objects, arrays) are supported.\n\nFor function-based mock overrides, use vi.mock() in a setup file:\n\n // vitest.setup.ts\n import { vi } from 'vitest';\n vi.mock('react-native', async (importOriginal) => {\n const actual = await importOriginal();\n return { ...actual, Alert: { alert: vi.fn() } };\n });");
|
|
228
215
|
let resolved;
|
|
229
216
|
const presetModules = /* @__PURE__ */ new Map();
|
|
@@ -269,10 +256,22 @@ function reactNative(options) {
|
|
|
269
256
|
}
|
|
270
257
|
assetPattern = new RegExp(`\\.(${resolved.assetExts.join("|")})$`);
|
|
271
258
|
},
|
|
272
|
-
resolveId(source) {
|
|
259
|
+
resolveId(source, importer) {
|
|
273
260
|
if (source === "react-native") return "\0virtual:react-native";
|
|
274
261
|
if (source.startsWith("react-native/")) return `\0virtual:rn-subpath:${source}`;
|
|
275
262
|
if (presetModules.has(source)) return `\0virtual:preset:${source}`;
|
|
263
|
+
if (importer && importer.includes("node_modules") && source.startsWith(".") && !path.extname(source)) {
|
|
264
|
+
const importerDir = path.dirname(importer);
|
|
265
|
+
const absolute = path.resolve(importerDir, source);
|
|
266
|
+
for (const ext of extensions) {
|
|
267
|
+
const candidate = absolute + ext;
|
|
268
|
+
if (fs.existsSync(candidate)) return candidate;
|
|
269
|
+
}
|
|
270
|
+
for (const ext of extensions) {
|
|
271
|
+
const candidate = path.join(absolute, `index${ext}`);
|
|
272
|
+
if (fs.existsSync(candidate)) return candidate;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
276
275
|
},
|
|
277
276
|
load(id) {
|
|
278
277
|
if (id === "\0virtual:react-native") return "export default {};";
|
|
@@ -8,6 +8,9 @@ const AUTO_DETECT_PRESETS = {
|
|
|
8
8
|
"react-native-gesture-handler": "gestureHandler",
|
|
9
9
|
"react-native-safe-area-context": "safeAreaContext",
|
|
10
10
|
"@react-navigation/native": "navigation",
|
|
11
|
+
"@react-navigation/native-stack": "navigation",
|
|
12
|
+
"@react-navigation/bottom-tabs": "navigation",
|
|
13
|
+
"@react-navigation/elements": "navigation",
|
|
11
14
|
"@react-native-async-storage/async-storage": "asyncStorage",
|
|
12
15
|
"react-native-screens": "screens",
|
|
13
16
|
"expo-constants": "expo"
|
|
@@ -8,6 +8,9 @@ const AUTO_DETECT_PRESETS = {
|
|
|
8
8
|
"react-native-gesture-handler": "gestureHandler",
|
|
9
9
|
"react-native-safe-area-context": "safeAreaContext",
|
|
10
10
|
"@react-navigation/native": "navigation",
|
|
11
|
+
"@react-navigation/native-stack": "navigation",
|
|
12
|
+
"@react-navigation/bottom-tabs": "navigation",
|
|
13
|
+
"@react-navigation/elements": "navigation",
|
|
11
14
|
"@react-native-async-storage/async-storage": "asyncStorage",
|
|
12
15
|
"react-native-screens": "screens",
|
|
13
16
|
"expo-constants": "expo"
|
|
@@ -436,138 +436,244 @@ function safeAreaContext() {
|
|
|
436
436
|
function navigation() {
|
|
437
437
|
return {
|
|
438
438
|
name: "navigation",
|
|
439
|
-
modules: {
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
439
|
+
modules: {
|
|
440
|
+
"@react-navigation/native": {
|
|
441
|
+
exports: [
|
|
442
|
+
"NavigationContainer",
|
|
443
|
+
"useNavigation",
|
|
444
|
+
"useRoute",
|
|
445
|
+
"useFocusEffect",
|
|
446
|
+
"useIsFocused",
|
|
447
|
+
"useNavigationState",
|
|
448
|
+
"createNavigationContainerRef",
|
|
449
|
+
"NavigationContext",
|
|
450
|
+
"NavigationRouteContext",
|
|
451
|
+
"CommonActions",
|
|
452
|
+
"StackActions",
|
|
453
|
+
"TabActions",
|
|
454
|
+
"DrawerActions",
|
|
455
|
+
"useLinkTo",
|
|
456
|
+
"Link"
|
|
457
|
+
],
|
|
458
|
+
factory: () => {
|
|
459
|
+
const NavigationContainer = React.forwardRef((props, ref) => React.createElement("NavigationContainer", {
|
|
460
|
+
...props,
|
|
461
|
+
ref
|
|
462
|
+
}, props.children));
|
|
463
|
+
NavigationContainer.displayName = "NavigationContainer";
|
|
464
|
+
const navigate = vi.fn();
|
|
465
|
+
const goBack = vi.fn();
|
|
466
|
+
const reset = vi.fn();
|
|
467
|
+
const setParams = vi.fn();
|
|
468
|
+
const setOptions = vi.fn();
|
|
469
|
+
const dispatch = vi.fn();
|
|
470
|
+
const canGoBack = vi.fn(() => false);
|
|
471
|
+
const getParent = vi.fn(() => void 0);
|
|
472
|
+
const getState = vi.fn(() => ({
|
|
473
|
+
index: 0,
|
|
474
|
+
key: "root",
|
|
475
|
+
routeNames: [],
|
|
476
|
+
routes: [],
|
|
477
|
+
type: "stack",
|
|
478
|
+
stale: false
|
|
479
|
+
}));
|
|
480
|
+
function useNavigation() {
|
|
481
|
+
return {
|
|
482
|
+
navigate,
|
|
483
|
+
goBack,
|
|
484
|
+
reset,
|
|
485
|
+
setParams,
|
|
486
|
+
setOptions,
|
|
487
|
+
dispatch,
|
|
488
|
+
canGoBack,
|
|
489
|
+
getParent,
|
|
490
|
+
getState,
|
|
491
|
+
isFocused: vi.fn(() => true),
|
|
492
|
+
addListener: vi.fn(() => vi.fn()),
|
|
493
|
+
removeListener: vi.fn(),
|
|
494
|
+
getId: vi.fn(() => void 0)
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
function useRoute() {
|
|
498
|
+
return {
|
|
499
|
+
key: "test-route-key",
|
|
500
|
+
name: "TestScreen",
|
|
501
|
+
params: {}
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
function useFocusEffect(callback) {
|
|
505
|
+
React.useEffect(callback, []);
|
|
506
|
+
}
|
|
507
|
+
function useIsFocused() {
|
|
508
|
+
return true;
|
|
509
|
+
}
|
|
510
|
+
function useNavigationState(selector) {
|
|
511
|
+
return selector(getState());
|
|
512
|
+
}
|
|
513
|
+
function createNavigationContainerRef() {
|
|
514
|
+
return {
|
|
515
|
+
current: null,
|
|
516
|
+
isReady: vi.fn(() => true),
|
|
517
|
+
navigate,
|
|
518
|
+
goBack,
|
|
519
|
+
reset,
|
|
520
|
+
dispatch,
|
|
521
|
+
canGoBack,
|
|
522
|
+
getState,
|
|
523
|
+
getRootState: getState,
|
|
524
|
+
getCurrentRoute: vi.fn(() => ({
|
|
525
|
+
key: "test",
|
|
526
|
+
name: "TestScreen"
|
|
527
|
+
})),
|
|
528
|
+
getCurrentOptions: vi.fn(() => ({})),
|
|
529
|
+
addListener: vi.fn(() => vi.fn())
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
const NavigationContext = React.createContext(null);
|
|
533
|
+
const NavigationRouteContext = React.createContext(null);
|
|
480
534
|
return {
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
535
|
+
default: { NavigationContainer },
|
|
536
|
+
NavigationContainer,
|
|
537
|
+
useNavigation,
|
|
538
|
+
useRoute,
|
|
539
|
+
useFocusEffect,
|
|
540
|
+
useIsFocused,
|
|
541
|
+
useNavigationState,
|
|
542
|
+
createNavigationContainerRef,
|
|
543
|
+
NavigationContext,
|
|
544
|
+
NavigationRouteContext,
|
|
545
|
+
CommonActions: {
|
|
546
|
+
navigate: vi.fn(),
|
|
547
|
+
reset: vi.fn(),
|
|
548
|
+
goBack: vi.fn(),
|
|
549
|
+
setParams: vi.fn()
|
|
550
|
+
},
|
|
551
|
+
StackActions: {
|
|
552
|
+
push: vi.fn(),
|
|
553
|
+
pop: vi.fn(),
|
|
554
|
+
popToTop: vi.fn(),
|
|
555
|
+
replace: vi.fn()
|
|
556
|
+
},
|
|
557
|
+
TabActions: { jumpTo: vi.fn() },
|
|
558
|
+
DrawerActions: {
|
|
559
|
+
openDrawer: vi.fn(),
|
|
560
|
+
closeDrawer: vi.fn(),
|
|
561
|
+
toggleDrawer: vi.fn(),
|
|
562
|
+
jumpTo: vi.fn()
|
|
563
|
+
},
|
|
564
|
+
useLinkTo: vi.fn(() => vi.fn()),
|
|
565
|
+
Link: React.forwardRef((props, ref) => React.createElement("Link", {
|
|
566
|
+
...props,
|
|
567
|
+
ref
|
|
568
|
+
}, props.children))
|
|
494
569
|
};
|
|
495
570
|
}
|
|
496
|
-
|
|
571
|
+
},
|
|
572
|
+
"@react-navigation/native-stack": {
|
|
573
|
+
exports: ["createNativeStackNavigator"],
|
|
574
|
+
factory: () => {
|
|
575
|
+
function createNativeStackNavigator() {
|
|
576
|
+
return {
|
|
577
|
+
Navigator: React.forwardRef((props, ref) => React.createElement("NativeStackNavigator", {
|
|
578
|
+
...props,
|
|
579
|
+
ref
|
|
580
|
+
}, props.children)),
|
|
581
|
+
Screen: React.forwardRef((props, ref) => React.createElement("Screen", {
|
|
582
|
+
...props,
|
|
583
|
+
ref
|
|
584
|
+
}, props.children)),
|
|
585
|
+
Group: React.forwardRef((props, ref) => React.createElement("Group", {
|
|
586
|
+
...props,
|
|
587
|
+
ref
|
|
588
|
+
}, props.children))
|
|
589
|
+
};
|
|
590
|
+
}
|
|
497
591
|
return {
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
params: {}
|
|
592
|
+
default: { createNativeStackNavigator },
|
|
593
|
+
createNativeStackNavigator
|
|
501
594
|
};
|
|
502
595
|
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
596
|
+
},
|
|
597
|
+
"@react-navigation/bottom-tabs": {
|
|
598
|
+
exports: ["createBottomTabNavigator"],
|
|
599
|
+
factory: () => {
|
|
600
|
+
function createBottomTabNavigator() {
|
|
601
|
+
return {
|
|
602
|
+
Navigator: React.forwardRef((props, ref) => React.createElement("BottomTabNavigator", {
|
|
603
|
+
...props,
|
|
604
|
+
ref
|
|
605
|
+
}, props.children)),
|
|
606
|
+
Screen: React.forwardRef((props, ref) => React.createElement("Screen", {
|
|
607
|
+
...props,
|
|
608
|
+
ref
|
|
609
|
+
}, props.children)),
|
|
610
|
+
Group: React.forwardRef((props, ref) => React.createElement("Group", {
|
|
611
|
+
...props,
|
|
612
|
+
ref
|
|
613
|
+
}, props.children))
|
|
614
|
+
};
|
|
615
|
+
}
|
|
513
616
|
return {
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
navigate,
|
|
517
|
-
goBack,
|
|
518
|
-
reset,
|
|
519
|
-
dispatch,
|
|
520
|
-
canGoBack,
|
|
521
|
-
getState,
|
|
522
|
-
getRootState: getState,
|
|
523
|
-
getCurrentRoute: vi.fn(() => ({
|
|
524
|
-
key: "test",
|
|
525
|
-
name: "TestScreen"
|
|
526
|
-
})),
|
|
527
|
-
getCurrentOptions: vi.fn(() => ({})),
|
|
528
|
-
addListener: vi.fn(() => vi.fn())
|
|
617
|
+
default: { createBottomTabNavigator },
|
|
618
|
+
createBottomTabNavigator
|
|
529
619
|
};
|
|
530
620
|
}
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
goBack: vi.fn(),
|
|
548
|
-
setParams: vi.fn()
|
|
549
|
-
},
|
|
550
|
-
StackActions: {
|
|
551
|
-
push: vi.fn(),
|
|
552
|
-
pop: vi.fn(),
|
|
553
|
-
popToTop: vi.fn(),
|
|
554
|
-
replace: vi.fn()
|
|
555
|
-
},
|
|
556
|
-
TabActions: { jumpTo: vi.fn() },
|
|
557
|
-
DrawerActions: {
|
|
558
|
-
openDrawer: vi.fn(),
|
|
559
|
-
closeDrawer: vi.fn(),
|
|
560
|
-
toggleDrawer: vi.fn(),
|
|
561
|
-
jumpTo: vi.fn()
|
|
562
|
-
},
|
|
563
|
-
useLinkTo: vi.fn(() => vi.fn()),
|
|
564
|
-
Link: React.forwardRef((props, ref) => React.createElement("Link", {
|
|
621
|
+
},
|
|
622
|
+
"@react-navigation/elements": {
|
|
623
|
+
exports: [
|
|
624
|
+
"Header",
|
|
625
|
+
"HeaderBackground",
|
|
626
|
+
"HeaderBackButton",
|
|
627
|
+
"HeaderTitle",
|
|
628
|
+
"HeaderBackContext",
|
|
629
|
+
"HeaderShownContext",
|
|
630
|
+
"HeaderHeightContext",
|
|
631
|
+
"useHeaderHeight",
|
|
632
|
+
"getDefaultHeaderHeight",
|
|
633
|
+
"getHeaderTitle"
|
|
634
|
+
],
|
|
635
|
+
factory: () => {
|
|
636
|
+
const Header = React.forwardRef((props, ref) => React.createElement("Header", {
|
|
565
637
|
...props,
|
|
566
638
|
ref
|
|
567
|
-
}, props.children))
|
|
568
|
-
|
|
639
|
+
}, props.children));
|
|
640
|
+
Header.displayName = "Header";
|
|
641
|
+
const HeaderBackground = React.forwardRef((props, ref) => React.createElement("HeaderBackground", {
|
|
642
|
+
...props,
|
|
643
|
+
ref
|
|
644
|
+
}, props.children));
|
|
645
|
+
HeaderBackground.displayName = "HeaderBackground";
|
|
646
|
+
const HeaderBackButton = React.forwardRef((props, ref) => React.createElement("HeaderBackButton", {
|
|
647
|
+
...props,
|
|
648
|
+
ref
|
|
649
|
+
}));
|
|
650
|
+
HeaderBackButton.displayName = "HeaderBackButton";
|
|
651
|
+
const HeaderTitle = React.forwardRef((props, ref) => React.createElement("HeaderTitle", {
|
|
652
|
+
...props,
|
|
653
|
+
ref
|
|
654
|
+
}, props.children));
|
|
655
|
+
HeaderTitle.displayName = "HeaderTitle";
|
|
656
|
+
return {
|
|
657
|
+
default: {
|
|
658
|
+
Header,
|
|
659
|
+
HeaderBackground,
|
|
660
|
+
HeaderBackButton,
|
|
661
|
+
HeaderTitle
|
|
662
|
+
},
|
|
663
|
+
Header,
|
|
664
|
+
HeaderBackground,
|
|
665
|
+
HeaderBackButton,
|
|
666
|
+
HeaderTitle,
|
|
667
|
+
HeaderBackContext: React.createContext(void 0),
|
|
668
|
+
HeaderShownContext: React.createContext(true),
|
|
669
|
+
HeaderHeightContext: React.createContext(64),
|
|
670
|
+
useHeaderHeight: () => 64,
|
|
671
|
+
getDefaultHeaderHeight: vi.fn(() => 64),
|
|
672
|
+
getHeaderTitle: vi.fn((options, fallback) => options?.headerTitle ?? options?.title ?? fallback)
|
|
673
|
+
};
|
|
674
|
+
}
|
|
569
675
|
}
|
|
570
|
-
}
|
|
676
|
+
}
|
|
571
677
|
};
|
|
572
678
|
}
|
|
573
679
|
//#endregion
|
|
@@ -467,138 +467,244 @@ function safeAreaContext() {
|
|
|
467
467
|
function navigation() {
|
|
468
468
|
return {
|
|
469
469
|
name: "navigation",
|
|
470
|
-
modules: {
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
470
|
+
modules: {
|
|
471
|
+
"@react-navigation/native": {
|
|
472
|
+
exports: [
|
|
473
|
+
"NavigationContainer",
|
|
474
|
+
"useNavigation",
|
|
475
|
+
"useRoute",
|
|
476
|
+
"useFocusEffect",
|
|
477
|
+
"useIsFocused",
|
|
478
|
+
"useNavigationState",
|
|
479
|
+
"createNavigationContainerRef",
|
|
480
|
+
"NavigationContext",
|
|
481
|
+
"NavigationRouteContext",
|
|
482
|
+
"CommonActions",
|
|
483
|
+
"StackActions",
|
|
484
|
+
"TabActions",
|
|
485
|
+
"DrawerActions",
|
|
486
|
+
"useLinkTo",
|
|
487
|
+
"Link"
|
|
488
|
+
],
|
|
489
|
+
factory: () => {
|
|
490
|
+
const NavigationContainer = react.default.forwardRef((props, ref) => react.default.createElement("NavigationContainer", {
|
|
491
|
+
...props,
|
|
492
|
+
ref
|
|
493
|
+
}, props.children));
|
|
494
|
+
NavigationContainer.displayName = "NavigationContainer";
|
|
495
|
+
const navigate = vitest.vi.fn();
|
|
496
|
+
const goBack = vitest.vi.fn();
|
|
497
|
+
const reset = vitest.vi.fn();
|
|
498
|
+
const setParams = vitest.vi.fn();
|
|
499
|
+
const setOptions = vitest.vi.fn();
|
|
500
|
+
const dispatch = vitest.vi.fn();
|
|
501
|
+
const canGoBack = vitest.vi.fn(() => false);
|
|
502
|
+
const getParent = vitest.vi.fn(() => void 0);
|
|
503
|
+
const getState = vitest.vi.fn(() => ({
|
|
504
|
+
index: 0,
|
|
505
|
+
key: "root",
|
|
506
|
+
routeNames: [],
|
|
507
|
+
routes: [],
|
|
508
|
+
type: "stack",
|
|
509
|
+
stale: false
|
|
510
|
+
}));
|
|
511
|
+
function useNavigation() {
|
|
512
|
+
return {
|
|
513
|
+
navigate,
|
|
514
|
+
goBack,
|
|
515
|
+
reset,
|
|
516
|
+
setParams,
|
|
517
|
+
setOptions,
|
|
518
|
+
dispatch,
|
|
519
|
+
canGoBack,
|
|
520
|
+
getParent,
|
|
521
|
+
getState,
|
|
522
|
+
isFocused: vitest.vi.fn(() => true),
|
|
523
|
+
addListener: vitest.vi.fn(() => vitest.vi.fn()),
|
|
524
|
+
removeListener: vitest.vi.fn(),
|
|
525
|
+
getId: vitest.vi.fn(() => void 0)
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
function useRoute() {
|
|
529
|
+
return {
|
|
530
|
+
key: "test-route-key",
|
|
531
|
+
name: "TestScreen",
|
|
532
|
+
params: {}
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
function useFocusEffect(callback) {
|
|
536
|
+
react.default.useEffect(callback, []);
|
|
537
|
+
}
|
|
538
|
+
function useIsFocused() {
|
|
539
|
+
return true;
|
|
540
|
+
}
|
|
541
|
+
function useNavigationState(selector) {
|
|
542
|
+
return selector(getState());
|
|
543
|
+
}
|
|
544
|
+
function createNavigationContainerRef() {
|
|
545
|
+
return {
|
|
546
|
+
current: null,
|
|
547
|
+
isReady: vitest.vi.fn(() => true),
|
|
548
|
+
navigate,
|
|
549
|
+
goBack,
|
|
550
|
+
reset,
|
|
551
|
+
dispatch,
|
|
552
|
+
canGoBack,
|
|
553
|
+
getState,
|
|
554
|
+
getRootState: getState,
|
|
555
|
+
getCurrentRoute: vitest.vi.fn(() => ({
|
|
556
|
+
key: "test",
|
|
557
|
+
name: "TestScreen"
|
|
558
|
+
})),
|
|
559
|
+
getCurrentOptions: vitest.vi.fn(() => ({})),
|
|
560
|
+
addListener: vitest.vi.fn(() => vitest.vi.fn())
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
const NavigationContext = react.default.createContext(null);
|
|
564
|
+
const NavigationRouteContext = react.default.createContext(null);
|
|
511
565
|
return {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
566
|
+
default: { NavigationContainer },
|
|
567
|
+
NavigationContainer,
|
|
568
|
+
useNavigation,
|
|
569
|
+
useRoute,
|
|
570
|
+
useFocusEffect,
|
|
571
|
+
useIsFocused,
|
|
572
|
+
useNavigationState,
|
|
573
|
+
createNavigationContainerRef,
|
|
574
|
+
NavigationContext,
|
|
575
|
+
NavigationRouteContext,
|
|
576
|
+
CommonActions: {
|
|
577
|
+
navigate: vitest.vi.fn(),
|
|
578
|
+
reset: vitest.vi.fn(),
|
|
579
|
+
goBack: vitest.vi.fn(),
|
|
580
|
+
setParams: vitest.vi.fn()
|
|
581
|
+
},
|
|
582
|
+
StackActions: {
|
|
583
|
+
push: vitest.vi.fn(),
|
|
584
|
+
pop: vitest.vi.fn(),
|
|
585
|
+
popToTop: vitest.vi.fn(),
|
|
586
|
+
replace: vitest.vi.fn()
|
|
587
|
+
},
|
|
588
|
+
TabActions: { jumpTo: vitest.vi.fn() },
|
|
589
|
+
DrawerActions: {
|
|
590
|
+
openDrawer: vitest.vi.fn(),
|
|
591
|
+
closeDrawer: vitest.vi.fn(),
|
|
592
|
+
toggleDrawer: vitest.vi.fn(),
|
|
593
|
+
jumpTo: vitest.vi.fn()
|
|
594
|
+
},
|
|
595
|
+
useLinkTo: vitest.vi.fn(() => vitest.vi.fn()),
|
|
596
|
+
Link: react.default.forwardRef((props, ref) => react.default.createElement("Link", {
|
|
597
|
+
...props,
|
|
598
|
+
ref
|
|
599
|
+
}, props.children))
|
|
525
600
|
};
|
|
526
601
|
}
|
|
527
|
-
|
|
602
|
+
},
|
|
603
|
+
"@react-navigation/native-stack": {
|
|
604
|
+
exports: ["createNativeStackNavigator"],
|
|
605
|
+
factory: () => {
|
|
606
|
+
function createNativeStackNavigator() {
|
|
607
|
+
return {
|
|
608
|
+
Navigator: react.default.forwardRef((props, ref) => react.default.createElement("NativeStackNavigator", {
|
|
609
|
+
...props,
|
|
610
|
+
ref
|
|
611
|
+
}, props.children)),
|
|
612
|
+
Screen: react.default.forwardRef((props, ref) => react.default.createElement("Screen", {
|
|
613
|
+
...props,
|
|
614
|
+
ref
|
|
615
|
+
}, props.children)),
|
|
616
|
+
Group: react.default.forwardRef((props, ref) => react.default.createElement("Group", {
|
|
617
|
+
...props,
|
|
618
|
+
ref
|
|
619
|
+
}, props.children))
|
|
620
|
+
};
|
|
621
|
+
}
|
|
528
622
|
return {
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
params: {}
|
|
623
|
+
default: { createNativeStackNavigator },
|
|
624
|
+
createNativeStackNavigator
|
|
532
625
|
};
|
|
533
626
|
}
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
627
|
+
},
|
|
628
|
+
"@react-navigation/bottom-tabs": {
|
|
629
|
+
exports: ["createBottomTabNavigator"],
|
|
630
|
+
factory: () => {
|
|
631
|
+
function createBottomTabNavigator() {
|
|
632
|
+
return {
|
|
633
|
+
Navigator: react.default.forwardRef((props, ref) => react.default.createElement("BottomTabNavigator", {
|
|
634
|
+
...props,
|
|
635
|
+
ref
|
|
636
|
+
}, props.children)),
|
|
637
|
+
Screen: react.default.forwardRef((props, ref) => react.default.createElement("Screen", {
|
|
638
|
+
...props,
|
|
639
|
+
ref
|
|
640
|
+
}, props.children)),
|
|
641
|
+
Group: react.default.forwardRef((props, ref) => react.default.createElement("Group", {
|
|
642
|
+
...props,
|
|
643
|
+
ref
|
|
644
|
+
}, props.children))
|
|
645
|
+
};
|
|
646
|
+
}
|
|
544
647
|
return {
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
navigate,
|
|
548
|
-
goBack,
|
|
549
|
-
reset,
|
|
550
|
-
dispatch,
|
|
551
|
-
canGoBack,
|
|
552
|
-
getState,
|
|
553
|
-
getRootState: getState,
|
|
554
|
-
getCurrentRoute: vitest.vi.fn(() => ({
|
|
555
|
-
key: "test",
|
|
556
|
-
name: "TestScreen"
|
|
557
|
-
})),
|
|
558
|
-
getCurrentOptions: vitest.vi.fn(() => ({})),
|
|
559
|
-
addListener: vitest.vi.fn(() => vitest.vi.fn())
|
|
648
|
+
default: { createBottomTabNavigator },
|
|
649
|
+
createBottomTabNavigator
|
|
560
650
|
};
|
|
561
651
|
}
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
goBack: vitest.vi.fn(),
|
|
579
|
-
setParams: vitest.vi.fn()
|
|
580
|
-
},
|
|
581
|
-
StackActions: {
|
|
582
|
-
push: vitest.vi.fn(),
|
|
583
|
-
pop: vitest.vi.fn(),
|
|
584
|
-
popToTop: vitest.vi.fn(),
|
|
585
|
-
replace: vitest.vi.fn()
|
|
586
|
-
},
|
|
587
|
-
TabActions: { jumpTo: vitest.vi.fn() },
|
|
588
|
-
DrawerActions: {
|
|
589
|
-
openDrawer: vitest.vi.fn(),
|
|
590
|
-
closeDrawer: vitest.vi.fn(),
|
|
591
|
-
toggleDrawer: vitest.vi.fn(),
|
|
592
|
-
jumpTo: vitest.vi.fn()
|
|
593
|
-
},
|
|
594
|
-
useLinkTo: vitest.vi.fn(() => vitest.vi.fn()),
|
|
595
|
-
Link: react.default.forwardRef((props, ref) => react.default.createElement("Link", {
|
|
652
|
+
},
|
|
653
|
+
"@react-navigation/elements": {
|
|
654
|
+
exports: [
|
|
655
|
+
"Header",
|
|
656
|
+
"HeaderBackground",
|
|
657
|
+
"HeaderBackButton",
|
|
658
|
+
"HeaderTitle",
|
|
659
|
+
"HeaderBackContext",
|
|
660
|
+
"HeaderShownContext",
|
|
661
|
+
"HeaderHeightContext",
|
|
662
|
+
"useHeaderHeight",
|
|
663
|
+
"getDefaultHeaderHeight",
|
|
664
|
+
"getHeaderTitle"
|
|
665
|
+
],
|
|
666
|
+
factory: () => {
|
|
667
|
+
const Header = react.default.forwardRef((props, ref) => react.default.createElement("Header", {
|
|
596
668
|
...props,
|
|
597
669
|
ref
|
|
598
|
-
}, props.children))
|
|
599
|
-
|
|
670
|
+
}, props.children));
|
|
671
|
+
Header.displayName = "Header";
|
|
672
|
+
const HeaderBackground = react.default.forwardRef((props, ref) => react.default.createElement("HeaderBackground", {
|
|
673
|
+
...props,
|
|
674
|
+
ref
|
|
675
|
+
}, props.children));
|
|
676
|
+
HeaderBackground.displayName = "HeaderBackground";
|
|
677
|
+
const HeaderBackButton = react.default.forwardRef((props, ref) => react.default.createElement("HeaderBackButton", {
|
|
678
|
+
...props,
|
|
679
|
+
ref
|
|
680
|
+
}));
|
|
681
|
+
HeaderBackButton.displayName = "HeaderBackButton";
|
|
682
|
+
const HeaderTitle = react.default.forwardRef((props, ref) => react.default.createElement("HeaderTitle", {
|
|
683
|
+
...props,
|
|
684
|
+
ref
|
|
685
|
+
}, props.children));
|
|
686
|
+
HeaderTitle.displayName = "HeaderTitle";
|
|
687
|
+
return {
|
|
688
|
+
default: {
|
|
689
|
+
Header,
|
|
690
|
+
HeaderBackground,
|
|
691
|
+
HeaderBackButton,
|
|
692
|
+
HeaderTitle
|
|
693
|
+
},
|
|
694
|
+
Header,
|
|
695
|
+
HeaderBackground,
|
|
696
|
+
HeaderBackButton,
|
|
697
|
+
HeaderTitle,
|
|
698
|
+
HeaderBackContext: react.default.createContext(void 0),
|
|
699
|
+
HeaderShownContext: react.default.createContext(true),
|
|
700
|
+
HeaderHeightContext: react.default.createContext(64),
|
|
701
|
+
useHeaderHeight: () => 64,
|
|
702
|
+
getDefaultHeaderHeight: vitest.vi.fn(() => 64),
|
|
703
|
+
getHeaderTitle: vitest.vi.fn((options, fallback) => options?.headerTitle ?? options?.title ?? fallback)
|
|
704
|
+
};
|
|
705
|
+
}
|
|
600
706
|
}
|
|
601
|
-
}
|
|
707
|
+
}
|
|
602
708
|
};
|
|
603
709
|
}
|
|
604
710
|
//#endregion
|
package/dist/presets.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_presets = require("./presets-
|
|
2
|
+
const require_presets = require("./presets-D4jrt194.cjs");
|
|
3
3
|
exports.asyncStorage = require_presets.asyncStorage;
|
|
4
4
|
exports.expo = require_presets.expo;
|
|
5
5
|
exports.gestureHandler = require_presets.gestureHandler;
|
package/dist/presets.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as navigation, c as reanimated, i as asyncStorage, n as expo, o as safeAreaContext, r as screens, s as gestureHandler } from "./presets-
|
|
1
|
+
import { a as navigation, c as reanimated, i as asyncStorage, n as expo, o as safeAreaContext, r as screens, s as gestureHandler } from "./presets-C9tAPD15.mjs";
|
|
2
2
|
export { asyncStorage, expo, gestureHandler, navigation, reanimated, safeAreaContext, screens };
|
package/dist/setup.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_presets = require("./presets-
|
|
2
|
-
const require_preset_map = require("./preset-map-
|
|
1
|
+
const require_presets = require("./presets-D4jrt194.cjs");
|
|
2
|
+
const require_preset_map = require("./preset-map-Bt4dXkZO.cjs");
|
|
3
3
|
const require_serializer = require("./serializer.cjs");
|
|
4
4
|
let node_path = require("node:path");
|
|
5
5
|
node_path = require_presets.__toESM(node_path);
|
package/dist/setup.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as __require } from "./chunk-CjcI7cDX.mjs";
|
|
2
|
-
import { t as AUTO_DETECT_PRESETS } from "./preset-map-
|
|
3
|
-
import { t as presets_exports } from "./presets-
|
|
2
|
+
import { t as AUTO_DETECT_PRESETS } from "./preset-map-D224CC5w.mjs";
|
|
3
|
+
import { t as presets_exports } from "./presets-C9tAPD15.mjs";
|
|
4
4
|
import { serializer } from "./serializer.mjs";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import path from "node:path";
|