@react-native-harness/runtime 1.0.0-alpha.24 → 1.0.0-alpha.25

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.
Files changed (34) hide show
  1. package/dist/globals.d.ts +1 -0
  2. package/dist/globals.d.ts.map +1 -1
  3. package/dist/jsx/jsx-dev-runtime.d.ts +3 -0
  4. package/dist/jsx/jsx-dev-runtime.d.ts.map +1 -0
  5. package/dist/jsx/jsx-dev-runtime.js +11 -0
  6. package/dist/jsx/jsx-runtime.d.ts +4 -0
  7. package/dist/jsx/jsx-runtime.d.ts.map +1 -0
  8. package/dist/jsx/jsx-runtime.js +19 -0
  9. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  10. package/dist/utils/hmr.d.ts +2 -0
  11. package/dist/utils/hmr.d.ts.map +1 -0
  12. package/dist/utils/hmr.js +3 -0
  13. package/dist/utils/parse-error-stack.d.ts +9 -0
  14. package/dist/utils/parse-error-stack.d.ts.map +1 -0
  15. package/dist/utils/parse-error-stack.js +56 -0
  16. package/out-tsc/vitest/src/client/getDeviceDescriptor.d.ts +1 -1
  17. package/out-tsc/vitest/src/client/getDeviceDescriptor.d.ts.map +1 -1
  18. package/out-tsc/vitest/src/disableHMRWhenReady.d.ts.map +1 -1
  19. package/out-tsc/vitest/src/expect/matchers/toMatchImageSnapshot.d.ts +0 -5
  20. package/out-tsc/vitest/src/expect/matchers/toMatchImageSnapshot.d.ts.map +1 -1
  21. package/out-tsc/vitest/src/globals.d.ts +10 -0
  22. package/out-tsc/vitest/src/globals.d.ts.map +1 -1
  23. package/out-tsc/vitest/src/index.d.ts +1 -1
  24. package/out-tsc/vitest/src/index.d.ts.map +1 -1
  25. package/out-tsc/vitest/src/render/TestComponentOverlay.d.ts.map +1 -1
  26. package/out-tsc/vitest/src/render/index.d.ts.map +1 -1
  27. package/out-tsc/vitest/src/symbolicate.d.ts +14 -0
  28. package/out-tsc/vitest/src/symbolicate.d.ts.map +1 -1
  29. package/out-tsc/vitest/src/utils/dev-server.d.ts.map +1 -1
  30. package/out-tsc/vitest/tsconfig.spec.tsbuildinfo +1 -1
  31. package/package.json +12 -2
  32. package/src/globals.ts +1 -0
  33. package/src/jsx/jsx-dev-runtime.ts +29 -0
  34. package/src/jsx/jsx-runtime.ts +38 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@react-native-harness/runtime",
3
3
  "description": "The core test runtime that executes on React Native devices, providing Jest-compatible APIs (describe, it, expect) and managing test collection, execution, and result reporting in native environments.",
4
- "version": "1.0.0-alpha.24",
4
+ "version": "1.0.0-alpha.25",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
@@ -23,6 +23,16 @@
23
23
  "types": "./dist/entry-point.d.ts",
24
24
  "import": "./dist/entry-point.js",
25
25
  "default": "./dist/entry-point.js"
26
+ },
27
+ "./jsx-runtime": {
28
+ "development": "./src/jsx/jsx-runtime.ts",
29
+ "import": "./dist/jsx/jsx-runtime.js",
30
+ "default": "./dist/jsx/jsx-runtime.js"
31
+ },
32
+ "./jsx-dev-runtime": {
33
+ "development": "./src/jsx/jsx-dev-runtime.ts",
34
+ "import": "./dist/jsx/jsx-dev-runtime.js",
35
+ "default": "./dist/jsx/jsx-dev-runtime.js"
26
36
  }
27
37
  },
28
38
  "peerDependencies": {
@@ -36,7 +46,7 @@
36
46
  "event-target-shim": "^6.0.2",
37
47
  "use-sync-external-store": "^1.6.0",
38
48
  "zustand": "^5.0.5",
39
- "@react-native-harness/bridge": "1.0.0-alpha.24"
49
+ "@react-native-harness/bridge": "1.0.0-alpha.25"
40
50
  },
41
51
  "devDependencies": {
42
52
  "@types/chai": "^5.2.2"
package/src/globals.ts CHANGED
@@ -3,6 +3,7 @@ import type { ImageSnapshotOptions } from '@react-native-harness/bridge';
3
3
  export type HarnessGlobal = {
4
4
  appRegistryComponentName: string;
5
5
  webSocketPort?: number;
6
+ disableViewFlattening?: boolean;
6
7
  };
7
8
 
8
9
  declare global {
@@ -0,0 +1,29 @@
1
+ import * as ReactJSXRuntimeDev from 'react/jsx-dev-runtime';
2
+
3
+ export const Fragment = ReactJSXRuntimeDev.Fragment;
4
+
5
+ export function jsxDEV(
6
+ type: any,
7
+ props: any,
8
+ key: any,
9
+ isStaticChildren: any,
10
+ source: any,
11
+ self: any
12
+ ) {
13
+ if (
14
+ type &&
15
+ (type.displayName === 'View' || type.name === 'View') &&
16
+ props &&
17
+ props.collapsable === undefined
18
+ ) {
19
+ props = { ...props, collapsable: true };
20
+ }
21
+ return ReactJSXRuntimeDev.jsxDEV(
22
+ type,
23
+ props,
24
+ key,
25
+ isStaticChildren,
26
+ source,
27
+ self
28
+ );
29
+ }
@@ -0,0 +1,38 @@
1
+ import { View } from 'react-native';
2
+ import * as ReactJSXRuntime from 'react/jsx-runtime';
3
+ import { getHarnessGlobal } from '../globals.js';
4
+
5
+ export const Fragment = ReactJSXRuntime.Fragment;
6
+
7
+ function wrap(
8
+ type: React.ElementType,
9
+ props: unknown,
10
+ key: React.Key | undefined,
11
+ isStatic: boolean,
12
+ ): React.ReactElement {
13
+ const disableViewFlattening = getHarnessGlobal().disableViewFlattening;
14
+
15
+ if (disableViewFlattening && type === View) {
16
+ props = { ...(props as Record<string, unknown>), collapsable: false };
17
+ }
18
+
19
+ return isStatic
20
+ ? ReactJSXRuntime.jsxs(type, props, key)
21
+ : ReactJSXRuntime.jsx(type, props, key);
22
+ }
23
+
24
+ export function jsx(
25
+ type: React.ElementType,
26
+ props: unknown,
27
+ key?: React.Key,
28
+ ): React.ReactElement {
29
+ return wrap(type, props, key, false);
30
+ }
31
+
32
+ export function jsxs(
33
+ type: React.ElementType,
34
+ props: unknown,
35
+ key?: React.Key,
36
+ ): React.ReactElement {
37
+ return wrap(type, props, key, true);
38
+ }