@react-three/test-renderer 10.0.0-alpha.6 → 10.0.0-beta.1

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/README.md CHANGED
@@ -32,11 +32,10 @@ Essentially, this package makes it easy to grab a snapshot of the Scene Graph re
32
32
 
33
33
  Choose the entry point that matches your `@react-three/fiber` import:
34
34
 
35
- | Your Fiber Import | Test Renderer Import | Use Case |
36
- | --------------------------- | ----------------------------------- | ------------------------------------- |
37
- | `@react-three/fiber` | `@react-three/test-renderer` | Default (WebGPU, mocked GPU context) |
38
- | `@react-three/fiber/legacy` | `@react-three/test-renderer/legacy` | WebGL only |
39
- | `@react-three/fiber/webgpu` | `@react-three/test-renderer/webgpu` | Deprecated, removed in the first beta |
35
+ | Your Fiber Import | Test Renderer Import | Use Case |
36
+ | --------------------------- | ----------------------------------- | ------------------------------------ |
37
+ | `@react-three/fiber` | `@react-three/test-renderer` | Default (WebGPU, mocked GPU context) |
38
+ | `@react-three/fiber/legacy` | `@react-three/test-renderer/legacy` | WebGL only |
40
39
 
41
40
  Whichever entry you pick, the root resolves JSX elements from the three namespace of the renderer it loads, exactly as in the app: node materials exist under WebGPU and not under WebGL.
42
41
 
@@ -77,7 +76,7 @@ const renderer = await ReactThreeTestRenderer.create(<MyScene />)
77
76
  ### TSL (Three Shading Language)
78
77
 
79
78
  The default entry renders with `WebGPURenderer`, so node materials and the TSL hooks work without
80
- any setup. `@react-three/test-renderer/webgpu` does the same and is deprecated.
79
+ any setup. It replaces `@react-three/test-renderer/webgpu`, which is removed.
81
80
 
82
81
  ```tsx
83
82
  import ReactThreeTestRenderer from '@react-three/test-renderer'
package/dist/index.cjs CHANGED
@@ -387,6 +387,16 @@ function mockWebGPU() {
387
387
  ALL: 15
388
388
  };
389
389
  }
390
+ function unmockWebGPU() {
391
+ if (typeof globalThis.navigator !== "undefined") {
392
+ delete globalThis.navigator.gpu;
393
+ }
394
+ delete globalThis.GPUTextureUsage;
395
+ delete globalThis.GPUBufferUsage;
396
+ delete globalThis.GPUMapMode;
397
+ delete globalThis.GPUShaderStage;
398
+ delete globalThis.GPUColorWrite;
399
+ }
390
400
 
391
401
  const lowerCaseFirstLetter = (str) => `${str.charAt(0).toLowerCase()}${str.slice(1)}`;
392
402
  const toEventHandlerName = (eventName) => `on${eventName.charAt(0).toUpperCase()}${eventName.slice(1)}`;
@@ -1566,4 +1576,6 @@ exports.act = react.act;
1566
1576
  exports.ReactThreeTest = index$1;
1567
1577
  exports.create = create;
1568
1578
  exports.default = index;
1579
+ exports.mockWebGPU = mockWebGPU;
1580
+ exports.unmockWebGPU = unmockWebGPU;
1569
1581
  exports.waitFor = waitFor;
package/dist/index.d.cts CHANGED
@@ -88,6 +88,16 @@ interface WaitOptions {
88
88
  }
89
89
  declare function waitFor(callback: () => boolean | void, { interval, timeout }?: WaitOptions): Promise<void>;
90
90
 
91
+ /**
92
+ * Installs WebGPU mocks into the global scope
93
+ * Call this before running tests that use WebGPU
94
+ */
95
+ declare function mockWebGPU(): void;
96
+ /**
97
+ * Removes WebGPU mocks from the global scope
98
+ */
99
+ declare function unmockWebGPU(): void;
100
+
91
101
  declare const index_Act: typeof Act;
92
102
  type index_CreateOptions = CreateOptions;
93
103
  type index_MockSyntheticEvent = MockSyntheticEvent;
@@ -113,5 +123,5 @@ declare const _default: {
113
123
 
114
124
  // @ts-ignore
115
125
  export = _default;
116
- export { index as ReactThreeTest, create, waitFor };
126
+ export { index as ReactThreeTest, create, mockWebGPU, unmockWebGPU, waitFor };
117
127
  export type { WaitOptions };
package/dist/index.d.mts CHANGED
@@ -88,6 +88,16 @@ interface WaitOptions {
88
88
  }
89
89
  declare function waitFor(callback: () => boolean | void, { interval, timeout }?: WaitOptions): Promise<void>;
90
90
 
91
+ /**
92
+ * Installs WebGPU mocks into the global scope
93
+ * Call this before running tests that use WebGPU
94
+ */
95
+ declare function mockWebGPU(): void;
96
+ /**
97
+ * Removes WebGPU mocks from the global scope
98
+ */
99
+ declare function unmockWebGPU(): void;
100
+
91
101
  declare const index_Act: typeof Act;
92
102
  type index_CreateOptions = CreateOptions;
93
103
  type index_MockSyntheticEvent = MockSyntheticEvent;
@@ -111,5 +121,5 @@ declare const _default: {
111
121
  waitFor: typeof waitFor;
112
122
  };
113
123
 
114
- export { index as ReactThreeTest, create, _default as default, waitFor };
124
+ export { index as ReactThreeTest, create, _default as default, mockWebGPU, unmockWebGPU, waitFor };
115
125
  export type { WaitOptions };
package/dist/index.d.ts CHANGED
@@ -88,6 +88,16 @@ interface WaitOptions {
88
88
  }
89
89
  declare function waitFor(callback: () => boolean | void, { interval, timeout }?: WaitOptions): Promise<void>;
90
90
 
91
+ /**
92
+ * Installs WebGPU mocks into the global scope
93
+ * Call this before running tests that use WebGPU
94
+ */
95
+ declare function mockWebGPU(): void;
96
+ /**
97
+ * Removes WebGPU mocks from the global scope
98
+ */
99
+ declare function unmockWebGPU(): void;
100
+
91
101
  declare const index_Act: typeof Act;
92
102
  type index_CreateOptions = CreateOptions;
93
103
  type index_MockSyntheticEvent = MockSyntheticEvent;
@@ -113,5 +123,5 @@ declare const _default: {
113
123
 
114
124
  // @ts-ignore
115
125
  export = _default;
116
- export { index as ReactThreeTest, create, waitFor };
126
+ export { index as ReactThreeTest, create, mockWebGPU, unmockWebGPU, waitFor };
117
127
  export type { WaitOptions };
package/dist/index.mjs CHANGED
@@ -384,6 +384,16 @@ function mockWebGPU() {
384
384
  ALL: 15
385
385
  };
386
386
  }
387
+ function unmockWebGPU() {
388
+ if (typeof globalThis.navigator !== "undefined") {
389
+ delete globalThis.navigator.gpu;
390
+ }
391
+ delete globalThis.GPUTextureUsage;
392
+ delete globalThis.GPUBufferUsage;
393
+ delete globalThis.GPUMapMode;
394
+ delete globalThis.GPUShaderStage;
395
+ delete globalThis.GPUColorWrite;
396
+ }
387
397
 
388
398
  const lowerCaseFirstLetter = (str) => `${str.charAt(0).toLowerCase()}${str.slice(1)}`;
389
399
  const toEventHandlerName = (eventName) => `on${eventName.charAt(0).toUpperCase()}${eventName.slice(1)}`;
@@ -1559,4 +1569,4 @@ const renderer = createTestRenderer({
1559
1569
  const { create } = renderer;
1560
1570
  const index = { create, act, waitFor };
1561
1571
 
1562
- export { index$1 as ReactThreeTest, create, index as default, waitFor };
1572
+ export { index$1 as ReactThreeTest, create, index as default, mockWebGPU, unmockWebGPU, waitFor };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-three/test-renderer",
3
- "version": "10.0.0-alpha.6",
3
+ "version": "10.0.0-beta.1",
4
4
  "description": "Test Renderer for react-three-fiber",
5
5
  "author": "Josh Ellis",
6
6
  "license": "MIT",
@@ -19,11 +19,6 @@
19
19
  "import": "./dist/legacy.mjs",
20
20
  "require": "./dist/legacy.cjs"
21
21
  },
22
- "./webgpu": {
23
- "types": "./dist/webgpu/index.d.ts",
24
- "import": "./dist/webgpu/index.mjs",
25
- "require": "./dist/webgpu/index.cjs"
26
- },
27
22
  "./package.json": "./package.json"
28
23
  },
29
24
  "bugs": {
@@ -47,8 +42,8 @@
47
42
  "devDependencies": {
48
43
  "@webgpu/types": "^0.1.64",
49
44
  "three": ">=0.185.0",
50
- "@react-three/tsl": "10.0.0-alpha.6",
51
- "@react-three/fiber": "10.0.0-alpha.6"
45
+ "@react-three/fiber": "10.0.0-beta.1",
46
+ "@react-three/tsl": "10.0.0-beta.1"
52
47
  },
53
48
  "files": [
54
49
  "dist",