vitest-native 0.8.0 → 0.10.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 +1063 -0
- package/README.md +47 -2
- package/dist/cli.cjs +642 -0
- package/dist/cli.d.cts +4 -0
- package/dist/cli.d.mts +4 -0
- package/dist/cli.mjs +638 -0
- package/dist/ecosystem-CO5vqExO.mjs +318 -0
- package/dist/ecosystem-IuZ-Gv0R.cjs +356 -0
- package/dist/errors-Dm5yLNTF.mjs +64 -0
- package/dist/errors-flXDIeWk.cjs +75 -0
- package/dist/errors.d.mts +46 -0
- package/dist/errors.mjs +78 -0
- package/dist/helpers.cjs +6 -23
- package/dist/helpers.d.cts +0 -6
- package/dist/helpers.d.mts +0 -6
- package/dist/helpers.mjs +6 -23
- package/dist/{index-vlK4zxuK.d.mts → index-BJL4cQ-l.d.cts} +22 -7
- package/dist/{index-YjjYELG7.d.cts → index-CvCU0cLl.d.mts} +20 -9
- package/dist/index.d.mts +8 -6
- package/dist/index.mjs +563 -232
- package/dist/jest-compat/interop.mjs +15 -0
- package/dist/jest-compat/setup.mjs +164 -5
- package/dist/matchers.cjs +16 -7
- package/dist/matchers.mjs +16 -7
- package/dist/native/boundary.mjs +108 -30
- package/dist/native/compile-cache.mjs +10 -5
- package/dist/native/explain.mjs +69 -0
- package/dist/native/hooks.mjs +151 -4
- package/dist/native/loader.mjs +61 -12
- package/dist/native/match.mjs +107 -8
- package/dist/native/module-reset.mjs +63 -0
- package/dist/native/registry.mjs +540 -0
- package/dist/native/reset.mjs +18 -12
- package/dist/native/resolve.d.mts +22 -0
- package/dist/native/resolve.mjs +21 -13
- package/dist/native/runner.mjs +34 -7
- package/dist/native/setup.mjs +19 -3
- package/dist/native/transform.mjs +195 -21
- package/dist/native/worker.mjs +69 -17
- package/dist/pool-Bcxp4Qrg.mjs +118 -0
- package/dist/pool-CFND7plG.cjs +122 -0
- package/dist/{preset-map-DCWaM08s.mjs → preset-map-BpDG_D5m.mjs} +1 -1
- package/dist/{preset-map-BY9zk9Pj.cjs → preset-map-DxilQ4pI.cjs} +1 -1
- package/dist/{presets-7eMfp7o2.cjs → presets-BGTqVH6C.cjs} +227 -52
- package/dist/{presets-23FJ76O4.mjs → presets-CK85x8ey.mjs} +222 -53
- package/dist/presets.d.mts +2 -2
- package/dist/presets.mjs +2 -2
- package/dist/rntl-matchers.d.ts +35 -0
- package/dist/serializer.cjs +33 -3
- package/dist/serializer.mjs +33 -3
- package/dist/setup.mjs +544 -193
- package/docs/hot-default-design.md +129 -0
- package/docs/migrating-from-jest.md +43 -7
- package/docs/migrating-from-vitest-react-native.md +1 -1
- package/docs/release-readiness.md +24 -6
- package/docs/versioning.md +133 -0
- package/package.json +40 -38
- package/dist/index.cjs +0 -643
- package/dist/index.d.cts +0 -14
- package/dist/pool-B7LBfcMQ.mjs +0 -67
- package/dist/pool-p54QV1dQ.cjs +0 -69
- package/dist/presets.cjs +0 -17
- package/dist/presets.d.cts +0 -2
- package/dist/setup.cjs +0 -2514
- package/dist/setup.d.cts +0 -1
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
const require_chunk = require("./chunk-CZWwpsFl.cjs");
|
|
2
|
+
const require_errors = require("./errors-flXDIeWk.cjs");
|
|
3
|
+
let node_path = require("node:path");
|
|
4
|
+
node_path = require_chunk.__toESM(node_path, 1);
|
|
5
|
+
let node_module = require("node:module");
|
|
6
|
+
let node_os = require("node:os");
|
|
7
|
+
node_os = require_chunk.__toESM(node_os, 1);
|
|
8
|
+
let vitest_node = require("vitest/node");
|
|
9
|
+
//#region src/native/pool.ts
|
|
10
|
+
function deepEqual(a, b) {
|
|
11
|
+
if (a === b) return true;
|
|
12
|
+
if (a == null || b == null || typeof a !== "object" || typeof b !== "object") return false;
|
|
13
|
+
const ka = Object.keys(a);
|
|
14
|
+
const kb = Object.keys(b);
|
|
15
|
+
if (ka.length !== kb.length) return false;
|
|
16
|
+
return ka.every((k) => kb.includes(k) && deepEqual(a[k], b[k]));
|
|
17
|
+
}
|
|
18
|
+
var NativePoolWorker = class extends vitest_node.ThreadsPoolWorker {
|
|
19
|
+
name = "vitest-native";
|
|
20
|
+
reportMemory;
|
|
21
|
+
entrypoint;
|
|
22
|
+
environment;
|
|
23
|
+
recycleAfterFiles;
|
|
24
|
+
memoryLimit;
|
|
25
|
+
diagnostics;
|
|
26
|
+
filesRun = 0;
|
|
27
|
+
lastHeapUsed = 0;
|
|
28
|
+
memoryListenerAttached = false;
|
|
29
|
+
batchWarningShown = false;
|
|
30
|
+
constructor(options, native) {
|
|
31
|
+
super(options);
|
|
32
|
+
this.entrypoint = node_path.default.resolve(native.workerEntry);
|
|
33
|
+
this.environment = options.environment;
|
|
34
|
+
this.recycleAfterFiles = native.recycleAfterFiles ?? 0;
|
|
35
|
+
this.memoryLimit = native.memoryLimit ?? 0;
|
|
36
|
+
this.diagnostics = native.diagnostics ?? false;
|
|
37
|
+
this.reportMemory = this.memoryLimit > 0;
|
|
38
|
+
}
|
|
39
|
+
async start() {
|
|
40
|
+
await super.start();
|
|
41
|
+
if (this.reportMemory && !this.memoryListenerAttached) {
|
|
42
|
+
this.memoryListenerAttached = true;
|
|
43
|
+
this.on("message", (message) => {
|
|
44
|
+
if (message?.__vitest_worker_response__ && typeof message.usedMemory === "number") this.lastHeapUsed = message.usedMemory;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
send(message) {
|
|
49
|
+
if (message.type === "run" || message.type === "collect") {
|
|
50
|
+
if (!this.batchWarningShown && message.context.files.length > 1 && (this.recycleAfterFiles > 0 || this.memoryLimit > 0)) {
|
|
51
|
+
this.batchWarningShown = true;
|
|
52
|
+
console.warn(`[vitest-native] hotRuntime recycling (memoryLimit/recycleAfterFiles) is INACTIVE here: Vitest batched ${message.context.files.length} files into one task, which happens in single-worker mode (maxWorkers: 1) — so a worker can never be retired between files and the memory bound cannot be enforced. Run with maxWorkers >= 2 (or remove maxWorkers/fileParallelism: false) so each file is its own task and recycling can fire.`);
|
|
53
|
+
}
|
|
54
|
+
this.filesRun += message.context.files.length;
|
|
55
|
+
}
|
|
56
|
+
super.send(message);
|
|
57
|
+
}
|
|
58
|
+
canReuse(task) {
|
|
59
|
+
if (this.recycleAfterFiles > 0 && this.filesRun >= this.recycleAfterFiles) return false;
|
|
60
|
+
if (this.memoryLimit > 0 && this.lastHeapUsed >= this.memoryLimit) return false;
|
|
61
|
+
const env = task.context.environment;
|
|
62
|
+
return env.name === this.environment.name && deepEqual(env.options, this.environment.options);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const HOT_MEMORY_MIN_BYTES = 768 * 1024 * 1024;
|
|
66
|
+
const HOT_MEMORY_MAX_BYTES = 1536 * 1024 * 1024;
|
|
67
|
+
const HOT_MEMORY_FRACTION = .25;
|
|
68
|
+
/**
|
|
69
|
+
* Default per-worker hot `memoryLimit` (bytes): `clamp(totalmem * 0.25, 768MB, 1.5GB)`.
|
|
70
|
+
* Applied only when hot is enabled and neither `memoryLimit` nor
|
|
71
|
+
* `recycleAfterFiles` was set explicitly. `totalmem` is injectable for tests.
|
|
72
|
+
*/
|
|
73
|
+
function defaultHotMemoryLimit(totalmem = node_os.default.totalmem()) {
|
|
74
|
+
const budget = Math.floor(totalmem * HOT_MEMORY_FRACTION);
|
|
75
|
+
return Math.min(HOT_MEMORY_MAX_BYTES, Math.max(HOT_MEMORY_MIN_BYTES, budget));
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Fail fast when the hot worker would load a different Vitest VERSION from the
|
|
79
|
+
* project's.
|
|
80
|
+
*
|
|
81
|
+
* The worker entry ships inside this package, so its `import 'vitest/worker'`
|
|
82
|
+
* resolves from THIS package's location rather than the project's. Where a monorepo
|
|
83
|
+
* has more than one Vitest install — a linked package, a hoisted `node_modules`,
|
|
84
|
+
* mixed versions across workspaces — the two can differ, and a version difference is
|
|
85
|
+
* invisible at runtime: the start handshake succeeds, the run request is accepted,
|
|
86
|
+
* and no result is ever reported. Vitest then prints "No test files found" with no
|
|
87
|
+
* error at all, and on some paths still exits 0 — a green run that tested nothing.
|
|
88
|
+
*
|
|
89
|
+
* Only a VERSION difference is an error. Two installs of the same version are two
|
|
90
|
+
* module registries but identical code, and they talk to each other perfectly well;
|
|
91
|
+
* failing on the paths alone would block working monorepos where the same version is
|
|
92
|
+
* simply installed twice.
|
|
93
|
+
*/
|
|
94
|
+
function assertWorkerVitestMatchesProject(workerEntry, projectRoot) {
|
|
95
|
+
const resolveVitest = (from) => {
|
|
96
|
+
try {
|
|
97
|
+
const require_ = (0, node_module.createRequire)(from);
|
|
98
|
+
const pkgPath = require_.resolve("vitest/package.json");
|
|
99
|
+
return {
|
|
100
|
+
path: pkgPath,
|
|
101
|
+
version: require_(pkgPath).version
|
|
102
|
+
};
|
|
103
|
+
} catch {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const worker = resolveVitest(workerEntry);
|
|
108
|
+
const project = resolveVitest(node_path.default.join(projectRoot, "package.json"));
|
|
109
|
+
if (worker === null || project === null || worker.version === project.version) return;
|
|
110
|
+
throw new require_errors.VitestNativeError("HOT_RUNTIME_UNAVAILABLE", `'hotRuntime' cannot run: its worker would load vitest@${worker.version}, but this run is driven by vitest@${project.version}. They talk over Vitest's worker protocol, and a version mismatch reports no results at all rather than failing.\n worker would load: ${worker.path}\n project resolves: ${project.path}\nThis happens when vitest-native and vitest resolve to different node_modules trees (linked packages, hoisted monorepo installs, mixed Vitest versions). Install one Vitest version reachable from vitest-native, or set 'hotRuntime: false'.`);
|
|
111
|
+
}
|
|
112
|
+
/** Pool initializer for `test.pool` — keeps RN-hot workers alive across files. */
|
|
113
|
+
function nativePool(options) {
|
|
114
|
+
assertWorkerVitestMatchesProject(node_path.default.resolve(options.workerEntry), options.projectRoot);
|
|
115
|
+
return {
|
|
116
|
+
name: "vitest-native",
|
|
117
|
+
createPoolWorker: (poolOptions) => new NativePoolWorker(poolOptions, options)
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
//#endregion
|
|
121
|
+
exports.defaultHotMemoryLimit = defaultHotMemoryLimit;
|
|
122
|
+
exports.nativePool = nativePool;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
const AUTO_DETECT_PRESETS = {
|
|
7
7
|
"react-native-reanimated": "reanimated",
|
|
8
|
+
"react-native-worklets": "worklets",
|
|
8
9
|
"react-native-gesture-handler": "gestureHandler",
|
|
9
10
|
"react-native-safe-area-context": "safeAreaContext",
|
|
10
11
|
"@react-navigation/native": "navigation",
|
|
@@ -20,7 +21,6 @@ const AUTO_DETECT_PRESETS = {
|
|
|
20
21
|
"react-native-svg": "svg",
|
|
21
22
|
"react-native-webview": "webview",
|
|
22
23
|
"@react-native-vector-icons/common": "vectorIcons",
|
|
23
|
-
"react-native-vector-icons": "vectorIcons",
|
|
24
24
|
"@shopify/flash-list": "flashList",
|
|
25
25
|
"@gorhom/bottom-sheet": "bottomSheet",
|
|
26
26
|
"react-native-keyboard-controller": "keyboardController"
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
const AUTO_DETECT_PRESETS = {
|
|
7
7
|
"react-native-reanimated": "reanimated",
|
|
8
|
+
"react-native-worklets": "worklets",
|
|
8
9
|
"react-native-gesture-handler": "gestureHandler",
|
|
9
10
|
"react-native-safe-area-context": "safeAreaContext",
|
|
10
11
|
"@react-navigation/native": "navigation",
|
|
@@ -20,7 +21,6 @@ const AUTO_DETECT_PRESETS = {
|
|
|
20
21
|
"react-native-svg": "svg",
|
|
21
22
|
"react-native-webview": "webview",
|
|
22
23
|
"@react-native-vector-icons/common": "vectorIcons",
|
|
23
|
-
"react-native-vector-icons": "vectorIcons",
|
|
24
24
|
"@shopify/flash-list": "flashList",
|
|
25
25
|
"@gorhom/bottom-sheet": "bottomSheet",
|
|
26
26
|
"react-native-keyboard-controller": "keyboardController"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-CZWwpsFl.cjs");
|
|
2
|
+
const require_errors = require("./errors-flXDIeWk.cjs");
|
|
2
3
|
let node_path = require("node:path");
|
|
3
4
|
node_path = require_chunk.__toESM(node_path, 1);
|
|
4
5
|
let node_module = require("node:module");
|
|
@@ -49,11 +50,6 @@ function reanimated() {
|
|
|
49
50
|
"addWhitelistedUIProps",
|
|
50
51
|
"addWhitelistedNativeProps",
|
|
51
52
|
"configureProps",
|
|
52
|
-
"View",
|
|
53
|
-
"Text",
|
|
54
|
-
"Image",
|
|
55
|
-
"ScrollView",
|
|
56
|
-
"FlatList",
|
|
57
53
|
"Easing",
|
|
58
54
|
"FadeIn",
|
|
59
55
|
"FadeOut",
|
|
@@ -233,7 +229,7 @@ function reanimated() {
|
|
|
233
229
|
function makeAnimatedHost(name) {
|
|
234
230
|
const Comp = react.default.forwardRef((props, ref) => {
|
|
235
231
|
const Base = getRN()[name];
|
|
236
|
-
if (!Base) throw new
|
|
232
|
+
if (!Base) throw new require_errors.VitestNativeError("PRESET_UNAVAILABLE", `The reanimated preset needs React Native's '${name}' component to build Animated.${name}, and react-native did not provide it.\nThis usually means react-native resolved to something unexpected — a partially installed copy, or a mock replacing the whole module. Check that 'react-native' resolves in your project and that no vi.mock replaces it wholesale.`);
|
|
237
233
|
return react.default.createElement(Base, {
|
|
238
234
|
...props,
|
|
239
235
|
ref
|
|
@@ -280,11 +276,6 @@ function reanimated() {
|
|
|
280
276
|
addWhitelistedUIProps,
|
|
281
277
|
addWhitelistedNativeProps,
|
|
282
278
|
configureProps,
|
|
283
|
-
View,
|
|
284
|
-
Text,
|
|
285
|
-
Image,
|
|
286
|
-
ScrollView,
|
|
287
|
-
FlatList,
|
|
288
279
|
useSharedValue,
|
|
289
280
|
useAnimatedStyle,
|
|
290
281
|
useAnimatedProps,
|
|
@@ -442,7 +433,26 @@ function buildPressableHostProps(props, ref) {
|
|
|
442
433
|
//#endregion
|
|
443
434
|
//#region src/mocks/components/Pressable.ts
|
|
444
435
|
function createPressableMock() {
|
|
445
|
-
const Pressable = react.default.forwardRef((props, ref) =>
|
|
436
|
+
const Pressable = react.default.forwardRef((props, ref) => {
|
|
437
|
+
const { style, children, onPressIn, onPressOut, ...rest } = props;
|
|
438
|
+
const [pressed, setPressed] = react.default.useState(false);
|
|
439
|
+
const state = { pressed };
|
|
440
|
+
const resolvedStyle = typeof style === "function" ? style(state) : style;
|
|
441
|
+
const resolvedChildren = typeof children === "function" ? children(state) : children;
|
|
442
|
+
const hostProps = buildPressableHostProps({
|
|
443
|
+
...rest,
|
|
444
|
+
style: resolvedStyle,
|
|
445
|
+
onPressIn: (e) => {
|
|
446
|
+
setPressed(true);
|
|
447
|
+
onPressIn?.(e);
|
|
448
|
+
},
|
|
449
|
+
onPressOut: (e) => {
|
|
450
|
+
setPressed(false);
|
|
451
|
+
onPressOut?.(e);
|
|
452
|
+
}
|
|
453
|
+
}, ref);
|
|
454
|
+
return react.default.createElement("Pressable", hostProps, resolvedChildren);
|
|
455
|
+
});
|
|
446
456
|
Pressable.displayName = "Pressable";
|
|
447
457
|
return Pressable;
|
|
448
458
|
}
|
|
@@ -625,10 +635,7 @@ function safeAreaContext() {
|
|
|
625
635
|
"useSafeAreaFrame",
|
|
626
636
|
"withSafeAreaInsets",
|
|
627
637
|
"initialWindowMetrics",
|
|
628
|
-
"initialWindowSafeAreaInsets"
|
|
629
|
-
"EdgeInsets",
|
|
630
|
-
"Rect",
|
|
631
|
-
"Metrics"
|
|
638
|
+
"initialWindowSafeAreaInsets"
|
|
632
639
|
],
|
|
633
640
|
factory: () => {
|
|
634
641
|
const defaultInsets = {
|
|
@@ -1246,12 +1253,29 @@ function screens() {
|
|
|
1246
1253
|
"screensEnabled",
|
|
1247
1254
|
"enableFreeze",
|
|
1248
1255
|
"freezeEnabled",
|
|
1256
|
+
"featureFlags",
|
|
1257
|
+
"compatibilityFlags",
|
|
1258
|
+
"executeNativeBackPress",
|
|
1259
|
+
"isSearchBarAvailableForCurrentPlatform",
|
|
1260
|
+
"useTransitionProgress",
|
|
1249
1261
|
"Screen",
|
|
1262
|
+
"InnerScreen",
|
|
1250
1263
|
"ScreenContainer",
|
|
1264
|
+
"ScreenContentWrapper",
|
|
1265
|
+
"ScreenContext",
|
|
1266
|
+
"ScreenFooter",
|
|
1251
1267
|
"ScreenStack",
|
|
1268
|
+
"ScreenStackItem",
|
|
1252
1269
|
"ScreenStackHeaderConfig",
|
|
1270
|
+
"ScreenStackHeaderBackButtonImage",
|
|
1271
|
+
"ScreenStackHeaderCenterView",
|
|
1272
|
+
"ScreenStackHeaderLeftView",
|
|
1273
|
+
"ScreenStackHeaderRightView",
|
|
1274
|
+
"ScreenStackHeaderSearchBarView",
|
|
1275
|
+
"ScreenStackHeaderSubview",
|
|
1253
1276
|
"SearchBar",
|
|
1254
1277
|
"FullWindowOverlay",
|
|
1278
|
+
"Tabs",
|
|
1255
1279
|
"NativeScreen",
|
|
1256
1280
|
"NativeScreenContainer"
|
|
1257
1281
|
],
|
|
@@ -1282,6 +1306,24 @@ function screens() {
|
|
|
1282
1306
|
const FullWindowOverlay = createScreenComponent("FullWindowOverlay");
|
|
1283
1307
|
const NativeScreen = createScreenComponent("NativeScreen");
|
|
1284
1308
|
const NativeScreenContainer = createScreenComponent("NativeScreenContainer");
|
|
1309
|
+
const InnerScreen = createScreenComponent("InnerScreen");
|
|
1310
|
+
const ScreenContentWrapper = createScreenComponent("ScreenContentWrapper");
|
|
1311
|
+
const ScreenFooter = createScreenComponent("ScreenFooter");
|
|
1312
|
+
const ScreenStackItem = createScreenComponent("ScreenStackItem");
|
|
1313
|
+
const ScreenStackHeaderBackButtonImage = createScreenComponent("ScreenStackHeaderBackButtonImage");
|
|
1314
|
+
const ScreenStackHeaderCenterView = createScreenComponent("ScreenStackHeaderCenterView");
|
|
1315
|
+
const ScreenStackHeaderLeftView = createScreenComponent("ScreenStackHeaderLeftView");
|
|
1316
|
+
const ScreenStackHeaderRightView = createScreenComponent("ScreenStackHeaderRightView");
|
|
1317
|
+
const ScreenStackHeaderSearchBarView = createScreenComponent("ScreenStackHeaderSearchBarView");
|
|
1318
|
+
const ScreenStackHeaderSubview = createScreenComponent("ScreenStackHeaderSubview");
|
|
1319
|
+
const Tabs = createScreenComponent("Tabs");
|
|
1320
|
+
const ScreenContext = react.default.createContext(Screen);
|
|
1321
|
+
const useTransitionProgress = vitest.vi.fn(() => ({
|
|
1322
|
+
progress: 1,
|
|
1323
|
+
closing: 0,
|
|
1324
|
+
goingForward: 0
|
|
1325
|
+
}));
|
|
1326
|
+
const executeNativeBackPress = vitest.vi.fn(() => true);
|
|
1285
1327
|
return {
|
|
1286
1328
|
default: {
|
|
1287
1329
|
Screen,
|
|
@@ -1300,7 +1342,27 @@ function screens() {
|
|
|
1300
1342
|
SearchBar,
|
|
1301
1343
|
FullWindowOverlay,
|
|
1302
1344
|
NativeScreen,
|
|
1303
|
-
NativeScreenContainer
|
|
1345
|
+
NativeScreenContainer,
|
|
1346
|
+
InnerScreen,
|
|
1347
|
+
ScreenContentWrapper,
|
|
1348
|
+
ScreenContext,
|
|
1349
|
+
ScreenFooter,
|
|
1350
|
+
ScreenStackItem,
|
|
1351
|
+
ScreenStackHeaderBackButtonImage,
|
|
1352
|
+
ScreenStackHeaderCenterView,
|
|
1353
|
+
ScreenStackHeaderLeftView,
|
|
1354
|
+
ScreenStackHeaderRightView,
|
|
1355
|
+
ScreenStackHeaderSearchBarView,
|
|
1356
|
+
ScreenStackHeaderSubview,
|
|
1357
|
+
Tabs,
|
|
1358
|
+
useTransitionProgress,
|
|
1359
|
+
executeNativeBackPress,
|
|
1360
|
+
isSearchBarAvailableForCurrentPlatform: true,
|
|
1361
|
+
featureFlags: {
|
|
1362
|
+
experiment: {},
|
|
1363
|
+
flags: {}
|
|
1364
|
+
},
|
|
1365
|
+
compatibilityFlags: {}
|
|
1304
1366
|
};
|
|
1305
1367
|
}
|
|
1306
1368
|
} }
|
|
@@ -1314,42 +1376,44 @@ function expo() {
|
|
|
1314
1376
|
modules: {
|
|
1315
1377
|
"expo-constants": {
|
|
1316
1378
|
exports: [
|
|
1317
|
-
"
|
|
1318
|
-
"
|
|
1319
|
-
"
|
|
1320
|
-
"isDevice",
|
|
1321
|
-
"platform",
|
|
1322
|
-
"manifest",
|
|
1323
|
-
"manifest2",
|
|
1324
|
-
"expoGoConfig",
|
|
1325
|
-
"easConfig",
|
|
1326
|
-
"experienceUrl",
|
|
1327
|
-
"linkingUri",
|
|
1328
|
-
"getWebViewUserAgentAsync"
|
|
1379
|
+
"AppOwnership",
|
|
1380
|
+
"ExecutionEnvironment",
|
|
1381
|
+
"UserInterfaceIdiom"
|
|
1329
1382
|
],
|
|
1330
1383
|
factory: () => {
|
|
1331
|
-
const Constants = {
|
|
1332
|
-
expoConfig: {
|
|
1333
|
-
name: "test-app",
|
|
1334
|
-
slug: "test-app",
|
|
1335
|
-
version: "1.0.0",
|
|
1336
|
-
extra: {}
|
|
1337
|
-
},
|
|
1338
|
-
executionEnvironment: "storeClient",
|
|
1339
|
-
appOwnership: "standalone",
|
|
1340
|
-
isDevice: true,
|
|
1341
|
-
platform: {},
|
|
1342
|
-
manifest: null,
|
|
1343
|
-
manifest2: null,
|
|
1344
|
-
expoGoConfig: null,
|
|
1345
|
-
easConfig: null,
|
|
1346
|
-
experienceUrl: "",
|
|
1347
|
-
linkingUri: "",
|
|
1348
|
-
getWebViewUserAgentAsync: vitest.vi.fn(async () => "test-user-agent")
|
|
1349
|
-
};
|
|
1350
1384
|
return {
|
|
1351
|
-
default:
|
|
1352
|
-
|
|
1385
|
+
default: {
|
|
1386
|
+
expoConfig: {
|
|
1387
|
+
name: "test-app",
|
|
1388
|
+
slug: "test-app",
|
|
1389
|
+
version: "1.0.0",
|
|
1390
|
+
extra: {}
|
|
1391
|
+
},
|
|
1392
|
+
executionEnvironment: "storeClient",
|
|
1393
|
+
appOwnership: "standalone",
|
|
1394
|
+
isDevice: true,
|
|
1395
|
+
platform: {},
|
|
1396
|
+
manifest: null,
|
|
1397
|
+
manifest2: null,
|
|
1398
|
+
expoGoConfig: null,
|
|
1399
|
+
easConfig: null,
|
|
1400
|
+
experienceUrl: "",
|
|
1401
|
+
linkingUri: "",
|
|
1402
|
+
getWebViewUserAgentAsync: vitest.vi.fn(async () => "test-user-agent")
|
|
1403
|
+
},
|
|
1404
|
+
AppOwnership: { Expo: "expo" },
|
|
1405
|
+
ExecutionEnvironment: {
|
|
1406
|
+
Bare: "bare",
|
|
1407
|
+
Standalone: "standalone",
|
|
1408
|
+
StoreClient: "storeClient"
|
|
1409
|
+
},
|
|
1410
|
+
UserInterfaceIdiom: {
|
|
1411
|
+
Handset: "handset",
|
|
1412
|
+
Tablet: "tablet",
|
|
1413
|
+
Desktop: "desktop",
|
|
1414
|
+
TV: "tv",
|
|
1415
|
+
Unsupported: "unsupported"
|
|
1416
|
+
}
|
|
1353
1417
|
};
|
|
1354
1418
|
}
|
|
1355
1419
|
},
|
|
@@ -1811,7 +1875,6 @@ function flashList() {
|
|
|
1811
1875
|
"FlashList",
|
|
1812
1876
|
"AnimatedFlashList",
|
|
1813
1877
|
"LayoutCommitObserver",
|
|
1814
|
-
"ViewToken",
|
|
1815
1878
|
"RenderTargetOptions",
|
|
1816
1879
|
"useRecyclingState",
|
|
1817
1880
|
"useLayoutState",
|
|
@@ -2432,6 +2495,111 @@ function keyboardController() {
|
|
|
2432
2495
|
};
|
|
2433
2496
|
}
|
|
2434
2497
|
//#endregion
|
|
2498
|
+
//#region src/presets/worklets.ts
|
|
2499
|
+
const RuntimeKind = {
|
|
2500
|
+
ReactNative: 1,
|
|
2501
|
+
UI: 2,
|
|
2502
|
+
Worker: 3
|
|
2503
|
+
};
|
|
2504
|
+
const NOOP = () => {};
|
|
2505
|
+
const ID = (value) => value;
|
|
2506
|
+
const invoke = (callback) => callback();
|
|
2507
|
+
function worklets() {
|
|
2508
|
+
return {
|
|
2509
|
+
name: "worklets",
|
|
2510
|
+
modules: { "react-native-worklets": {
|
|
2511
|
+
exports: [
|
|
2512
|
+
"runOnJS",
|
|
2513
|
+
"runOnUI",
|
|
2514
|
+
"runOnUIAsync",
|
|
2515
|
+
"runOnUISync",
|
|
2516
|
+
"scheduleOnRN",
|
|
2517
|
+
"scheduleOnUI",
|
|
2518
|
+
"runOnRuntime",
|
|
2519
|
+
"runOnRuntimeAsync",
|
|
2520
|
+
"runOnRuntimeSync",
|
|
2521
|
+
"scheduleOnRuntime",
|
|
2522
|
+
"executeOnUIRuntimeSync",
|
|
2523
|
+
"createWorkletRuntime",
|
|
2524
|
+
"getRuntimeKind",
|
|
2525
|
+
"isRNRuntime",
|
|
2526
|
+
"isUIRuntime",
|
|
2527
|
+
"isWorkerRuntime",
|
|
2528
|
+
"isWorkletRuntime",
|
|
2529
|
+
"RuntimeKind",
|
|
2530
|
+
"makeShareable",
|
|
2531
|
+
"makeShareableCloneRecursive",
|
|
2532
|
+
"makeShareableCloneOnUIRecursive",
|
|
2533
|
+
"isShareable",
|
|
2534
|
+
"isShareableRef",
|
|
2535
|
+
"createShareable",
|
|
2536
|
+
"shareableMappingCache",
|
|
2537
|
+
"createSerializable",
|
|
2538
|
+
"isSerializableRef",
|
|
2539
|
+
"registerCustomSerializable",
|
|
2540
|
+
"serializableMappingCache",
|
|
2541
|
+
"createSynchronizable",
|
|
2542
|
+
"isSynchronizable",
|
|
2543
|
+
"getStaticFeatureFlag",
|
|
2544
|
+
"getDynamicFeatureFlag",
|
|
2545
|
+
"setDynamicFeatureFlag",
|
|
2546
|
+
"callMicrotasks",
|
|
2547
|
+
"isWorkletFunction",
|
|
2548
|
+
"WorkletsModule",
|
|
2549
|
+
"UIRuntimeId"
|
|
2550
|
+
],
|
|
2551
|
+
factory: () => {
|
|
2552
|
+
const runOnJS = (fn) => fn;
|
|
2553
|
+
const runOnUI = (fn) => fn;
|
|
2554
|
+
const runOnUIAsync = (worklet, ...args) => Promise.resolve(worklet(...args));
|
|
2555
|
+
const api = {
|
|
2556
|
+
__esModule: true,
|
|
2557
|
+
runOnJS,
|
|
2558
|
+
runOnUI,
|
|
2559
|
+
runOnUIAsync,
|
|
2560
|
+
runOnUISync: invoke,
|
|
2561
|
+
scheduleOnRN: (fn, ...args) => fn(...args),
|
|
2562
|
+
scheduleOnUI: (worklet, ...args) => worklet(...args),
|
|
2563
|
+
runOnRuntime: ID,
|
|
2564
|
+
runOnRuntimeAsync: (_runtime, worklet, ...args) => Promise.resolve(worklet(...args)),
|
|
2565
|
+
runOnRuntimeSync: (_runtime, worklet, ...args) => worklet(...args),
|
|
2566
|
+
scheduleOnRuntime: invoke,
|
|
2567
|
+
executeOnUIRuntimeSync: ID,
|
|
2568
|
+
callMicrotasks: NOOP,
|
|
2569
|
+
createWorkletRuntime: () => ({}),
|
|
2570
|
+
getRuntimeKind: () => RuntimeKind.ReactNative,
|
|
2571
|
+
RuntimeKind,
|
|
2572
|
+
isRNRuntime: () => true,
|
|
2573
|
+
isUIRuntime: () => false,
|
|
2574
|
+
isWorkerRuntime: () => false,
|
|
2575
|
+
isWorkletRuntime: () => false,
|
|
2576
|
+
UIRuntimeId: 1,
|
|
2577
|
+
makeShareable: ID,
|
|
2578
|
+
makeShareableCloneRecursive: ID,
|
|
2579
|
+
makeShareableCloneOnUIRecursive: ID,
|
|
2580
|
+
createShareable: ID,
|
|
2581
|
+
isShareable: () => false,
|
|
2582
|
+
isShareableRef: () => true,
|
|
2583
|
+
shareableMappingCache: /* @__PURE__ */ new Map(),
|
|
2584
|
+
createSerializable: ID,
|
|
2585
|
+
isSerializableRef: ID,
|
|
2586
|
+
registerCustomSerializable: NOOP,
|
|
2587
|
+
serializableMappingCache: /* @__PURE__ */ new Map(),
|
|
2588
|
+
createSynchronizable: ID,
|
|
2589
|
+
isSynchronizable: () => false,
|
|
2590
|
+
getStaticFeatureFlag: () => false,
|
|
2591
|
+
getDynamicFeatureFlag: () => false,
|
|
2592
|
+
setDynamicFeatureFlag: NOOP,
|
|
2593
|
+
isWorkletFunction: () => false,
|
|
2594
|
+
WorkletsModule: {}
|
|
2595
|
+
};
|
|
2596
|
+
api.default = api;
|
|
2597
|
+
return api;
|
|
2598
|
+
}
|
|
2599
|
+
} }
|
|
2600
|
+
};
|
|
2601
|
+
}
|
|
2602
|
+
//#endregion
|
|
2435
2603
|
//#region src/presets/index.ts
|
|
2436
2604
|
var presets_exports = /* @__PURE__ */ require_chunk.__exportAll({
|
|
2437
2605
|
asyncStorage: () => asyncStorage,
|
|
@@ -2448,7 +2616,8 @@ var presets_exports = /* @__PURE__ */ require_chunk.__exportAll({
|
|
|
2448
2616
|
screens: () => screens,
|
|
2449
2617
|
svg: () => svg,
|
|
2450
2618
|
vectorIcons: () => vectorIcons,
|
|
2451
|
-
webview: () => webview
|
|
2619
|
+
webview: () => webview,
|
|
2620
|
+
worklets: () => worklets
|
|
2452
2621
|
});
|
|
2453
2622
|
//#endregion
|
|
2454
2623
|
Object.defineProperty(exports, "asyncStorage", {
|
|
@@ -2613,3 +2782,9 @@ Object.defineProperty(exports, "webview", {
|
|
|
2613
2782
|
return webview;
|
|
2614
2783
|
}
|
|
2615
2784
|
});
|
|
2785
|
+
Object.defineProperty(exports, "worklets", {
|
|
2786
|
+
enumerable: true,
|
|
2787
|
+
get: function() {
|
|
2788
|
+
return worklets;
|
|
2789
|
+
}
|
|
2790
|
+
});
|