react-native-wgpu 0.5.3 → 0.5.4

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.
@@ -35,6 +35,7 @@
35
35
  #include "GPUSupportedLimits.h"
36
36
  #include "GPUTexture.h"
37
37
  #include "GPUTextureView.h"
38
+ #include "GPUUncapturedErrorEvent.h"
38
39
  #include "GPUValidationError.h"
39
40
 
40
41
  // Enums
@@ -60,7 +61,8 @@ RNWebGPUManager::RNWebGPUManager(
60
61
  BaseRuntimeAwareCache::setMainJsRuntime(_jsRuntime);
61
62
 
62
63
  auto gpu = std::make_shared<GPU>(*_jsRuntime);
63
- auto rnWebGPU = std::make_shared<RNWebGPU>(gpu, _platformContext, _jsCallInvoker);
64
+ auto rnWebGPU =
65
+ std::make_shared<RNWebGPU>(gpu, _platformContext, _jsCallInvoker);
64
66
  _gpu = gpu->get();
65
67
  _jsRuntime->global().setProperty(*_jsRuntime, "RNWebGPU",
66
68
  RNWebGPU::create(*_jsRuntime, rnWebGPU));
@@ -86,6 +88,7 @@ RNWebGPUManager::RNWebGPUManager(
86
88
  GPUInternalError::installConstructor(*_jsRuntime);
87
89
  GPUOutOfMemoryError::installConstructor(*_jsRuntime);
88
90
  GPUValidationError::installConstructor(*_jsRuntime);
91
+ GPUUncapturedErrorEvent::installConstructor(*_jsRuntime);
89
92
  GPUPipelineLayout::installConstructor(*_jsRuntime);
90
93
  GPUQuerySet::installConstructor(*_jsRuntime);
91
94
  GPUQueue::installConstructor(*_jsRuntime);
@@ -50,6 +50,8 @@ async::AsyncTaskHandle GPUAdapter::requestDevice(
50
50
  });
51
51
 
52
52
  // Set uncaptured error callback using new template API
53
+ // Note: This callback cannot capture variables, so we use a static registry
54
+ // to look up the GPUDevice from the wgpu::Device handle.
53
55
  aDescriptor.SetUncapturedErrorCallback([](const wgpu::Device &device,
54
56
  wgpu::ErrorType type,
55
57
  wgpu::StringView message) {
@@ -70,11 +72,16 @@ async::AsyncTaskHandle GPUAdapter::requestDevice(
70
72
  default:
71
73
  errorType = "Unknown";
72
74
  }
75
+ std::string msg =
76
+ message.length > 0 ? std::string(message.data, message.length) : "";
73
77
  std::string fullMessage =
74
- message.length > 0 ? std::string(errorType) + ": " +
75
- std::string(message.data, message.length)
76
- : "no message";
77
- fprintf(stderr, "%s", fullMessage.c_str());
78
+ msg.length() > 0 ? std::string(errorType) + ": " + msg : "no message";
79
+ fprintf(stderr, "%s\n", fullMessage.c_str());
80
+
81
+ // Look up the GPUDevice from the registry and notify it
82
+ if (auto gpuDevice = GPUDevice::lookupDevice(device.Get())) {
83
+ gpuDevice->notifyUncapturedError(type, std::move(msg));
84
+ }
78
85
  });
79
86
  std::string label =
80
87
  descriptor.has_value() ? descriptor.value()->label.value_or("") : "";
@@ -138,6 +145,11 @@ async::AsyncTaskHandle GPUAdapter::requestDevice(
138
145
  auto deviceHost = std::make_shared<GPUDevice>(std::move(device),
139
146
  asyncRunner, label);
140
147
  *deviceLostBinding = deviceHost;
148
+
149
+ // Register the device in the static registry so the uncaptured
150
+ // error callback can find it
151
+ GPUDevice::registerDevice(deviceHost->get().Get(), deviceHost);
152
+
141
153
  resolve([deviceHost = std::move(deviceHost)](
142
154
  jsi::Runtime &runtime) mutable {
143
155
  return JSIConverter<std::shared_ptr<GPUDevice>>::toJSI(
@@ -431,4 +431,62 @@ async::AsyncTaskHandle GPUDevice::getLost() {
431
431
  _lostHandle = handle;
432
432
  return handle;
433
433
  }
434
+ void GPUDevice::addEventListener(std::string type, jsi::Function callback) {
435
+ auto funcPtr = std::make_shared<jsi::Function>(std::move(callback));
436
+ _eventListeners[type].push_back(funcPtr);
437
+ }
438
+
439
+ void GPUDevice::removeEventListener(std::string type, jsi::Function callback) {
440
+ // Note: Since jsi::Function doesn't support equality comparison,
441
+ // we cannot reliably remove a specific listener. This is a no-op.
442
+ // Most use cases (like BabylonJS) only need addEventListener to work.
443
+ (void)type;
444
+ (void)callback;
445
+ }
446
+
447
+ void GPUDevice::notifyUncapturedError(wgpu::ErrorType type,
448
+ std::string message) {
449
+ auto it = _eventListeners.find("uncapturederror");
450
+ if (it == _eventListeners.end() || it->second.empty()) {
451
+ return;
452
+ }
453
+
454
+ auto runtime = getCreationRuntime();
455
+ if (runtime == nullptr) {
456
+ return;
457
+ }
458
+
459
+ // Create the appropriate error object based on type
460
+ GPUErrorVariant error;
461
+ switch (type) {
462
+ case wgpu::ErrorType::Validation:
463
+ error = std::make_shared<GPUValidationError>(message);
464
+ break;
465
+ case wgpu::ErrorType::OutOfMemory:
466
+ error = std::make_shared<GPUOutOfMemoryError>(message);
467
+ break;
468
+ case wgpu::ErrorType::Internal:
469
+ case wgpu::ErrorType::Unknown:
470
+ default:
471
+ error = std::make_shared<GPUInternalError>(message);
472
+ break;
473
+ }
474
+
475
+ // Create the event object
476
+ auto event = std::make_shared<GPUUncapturedErrorEvent>(std::move(error));
477
+ auto eventValue =
478
+ JSIConverter<std::shared_ptr<GPUUncapturedErrorEvent>>::toJSI(*runtime,
479
+ event);
480
+
481
+ // Call all registered listeners
482
+ for (const auto &listener : it->second) {
483
+ try {
484
+ listener->call(*runtime, eventValue);
485
+ } catch (const std::exception &e) {
486
+ // Log but don't throw - we don't want one listener to break others
487
+ fprintf(stderr, "Error in uncapturederror listener: %s\n", e.what());
488
+ }
489
+ }
490
+ }
491
+
434
492
  } // namespace rnwgpu
@@ -1,11 +1,15 @@
1
1
  #pragma once
2
2
 
3
+ #include <functional>
3
4
  #include <memory>
5
+ #include <mutex>
4
6
  #include <optional>
5
7
  #include <string>
8
+ #include <unordered_map>
6
9
  #include <unordered_set>
7
10
  #include <utility>
8
11
  #include <variant>
12
+ #include <vector>
9
13
 
10
14
  #include "Unions.h"
11
15
 
@@ -46,6 +50,7 @@
46
50
  #include "GPUSupportedLimits.h"
47
51
  #include "GPUTexture.h"
48
52
  #include "GPUTextureDescriptor.h"
53
+ #include "GPUUncapturedErrorEvent.h"
49
54
 
50
55
  namespace rnwgpu {
51
56
 
@@ -61,6 +66,44 @@ public:
61
66
  : NativeObject(CLASS_NAME), _instance(instance), _async(async),
62
67
  _label(label) {}
63
68
 
69
+ ~GPUDevice() override {
70
+ // Unregister from the static registry
71
+ unregisterDevice(_instance.Get());
72
+ }
73
+
74
+ // Static registry for looking up GPUDevice from wgpu::Device in callbacks
75
+ static void registerDevice(WGPUDevice handle,
76
+ std::weak_ptr<GPUDevice> device) {
77
+ std::lock_guard<std::mutex> lock(getRegistryMutex());
78
+ getRegistry()[handle] = device;
79
+ }
80
+
81
+ static void unregisterDevice(WGPUDevice handle) {
82
+ std::lock_guard<std::mutex> lock(getRegistryMutex());
83
+ getRegistry().erase(handle);
84
+ }
85
+
86
+ static std::shared_ptr<GPUDevice> lookupDevice(WGPUDevice handle) {
87
+ std::lock_guard<std::mutex> lock(getRegistryMutex());
88
+ auto it = getRegistry().find(handle);
89
+ if (it != getRegistry().end()) {
90
+ return it->second.lock();
91
+ }
92
+ return nullptr;
93
+ }
94
+
95
+ private:
96
+ static std::unordered_map<WGPUDevice, std::weak_ptr<GPUDevice>> &
97
+ getRegistry() {
98
+ static std::unordered_map<WGPUDevice, std::weak_ptr<GPUDevice>> registry;
99
+ return registry;
100
+ }
101
+
102
+ static std::mutex &getRegistryMutex() {
103
+ static std::mutex mutex;
104
+ return mutex;
105
+ }
106
+
64
107
  public:
65
108
  std::string getBrand() { return CLASS_NAME; }
66
109
 
@@ -103,8 +146,13 @@ public:
103
146
  std::shared_ptr<GPUQueue> getQueue();
104
147
  async::AsyncTaskHandle getLost();
105
148
  void notifyDeviceLost(wgpu::DeviceLostReason reason, std::string message);
149
+ void notifyUncapturedError(wgpu::ErrorType type, std::string message);
106
150
  void forceLossForTesting();
107
151
 
152
+ // EventTarget methods
153
+ void addEventListener(std::string type, jsi::Function callback);
154
+ void removeEventListener(std::string type, jsi::Function callback);
155
+
108
156
  std::string getLabel() { return _label; }
109
157
  void setLabel(const std::string &label) {
110
158
  _label = label;
@@ -155,6 +203,38 @@ public:
155
203
  &GPUDevice::setLabel);
156
204
  installMethod(runtime, prototype, "forceLossForTesting",
157
205
  &GPUDevice::forceLossForTesting);
206
+
207
+ // EventTarget methods - installed manually since they take jsi::Function
208
+ auto addEventListenerFunc = jsi::Function::createFromHostFunction(
209
+ runtime, jsi::PropNameID::forUtf8(runtime, "addEventListener"), 2,
210
+ [](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
211
+ size_t count) -> jsi::Value {
212
+ if (count < 2 || !args[0].isString() || !args[1].isObject() ||
213
+ !args[1].getObject(rt).isFunction(rt)) {
214
+ return jsi::Value::undefined();
215
+ }
216
+ auto native = GPUDevice::fromValue(rt, thisVal);
217
+ native->addEventListener(args[0].getString(rt).utf8(rt),
218
+ args[1].getObject(rt).getFunction(rt));
219
+ return jsi::Value::undefined();
220
+ });
221
+ prototype.setProperty(runtime, "addEventListener", addEventListenerFunc);
222
+
223
+ auto removeEventListenerFunc = jsi::Function::createFromHostFunction(
224
+ runtime, jsi::PropNameID::forUtf8(runtime, "removeEventListener"), 2,
225
+ [](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
226
+ size_t count) -> jsi::Value {
227
+ if (count < 2 || !args[0].isString() || !args[1].isObject() ||
228
+ !args[1].getObject(rt).isFunction(rt)) {
229
+ return jsi::Value::undefined();
230
+ }
231
+ auto native = GPUDevice::fromValue(rt, thisVal);
232
+ native->removeEventListener(args[0].getString(rt).utf8(rt),
233
+ args[1].getObject(rt).getFunction(rt));
234
+ return jsi::Value::undefined();
235
+ });
236
+ prototype.setProperty(runtime, "removeEventListener",
237
+ removeEventListenerFunc);
158
238
  }
159
239
 
160
240
  inline const wgpu::Device get() { return _instance; }
@@ -169,6 +249,11 @@ private:
169
249
  std::shared_ptr<GPUDeviceLostInfo> _lostInfo;
170
250
  bool _lostSettled = false;
171
251
  std::optional<async::AsyncTaskHandle::ResolveFunction> _lostResolve;
252
+
253
+ // Event listeners storage - keyed by event type
254
+ // Each entry contains a vector of shared_ptr to functions
255
+ std::unordered_map<std::string, std::vector<std::shared_ptr<jsi::Function>>>
256
+ _eventListeners;
172
257
  };
173
258
 
174
259
  } // namespace rnwgpu
@@ -0,0 +1,71 @@
1
+ #pragma once
2
+
3
+ #include <memory>
4
+ #include <string>
5
+ #include <variant>
6
+
7
+ #include "JSIConverter.h"
8
+ #include "NativeObject.h"
9
+
10
+ #include "GPUInternalError.h"
11
+ #include "GPUOutOfMemoryError.h"
12
+ #include "GPUValidationError.h"
13
+
14
+ namespace rnwgpu {
15
+
16
+ namespace jsi = facebook::jsi;
17
+
18
+ using GPUErrorVariant = std::variant<std::shared_ptr<GPUValidationError>,
19
+ std::shared_ptr<GPUOutOfMemoryError>,
20
+ std::shared_ptr<GPUInternalError>>;
21
+
22
+ class GPUUncapturedErrorEvent : public NativeObject<GPUUncapturedErrorEvent> {
23
+ public:
24
+ static constexpr const char *CLASS_NAME = "GPUUncapturedErrorEvent";
25
+
26
+ explicit GPUUncapturedErrorEvent(GPUErrorVariant error)
27
+ : NativeObject(CLASS_NAME), _error(std::move(error)) {}
28
+
29
+ public:
30
+ std::string getBrand() { return CLASS_NAME; }
31
+ std::string getType() { return "uncapturederror"; }
32
+
33
+ static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
34
+ installGetter(runtime, prototype, "__brand",
35
+ &GPUUncapturedErrorEvent::getBrand);
36
+ installGetter(runtime, prototype, "type",
37
+ &GPUUncapturedErrorEvent::getType);
38
+
39
+ // Custom getter for error that handles the variant conversion
40
+ auto errorGetter = jsi::Function::createFromHostFunction(
41
+ runtime, jsi::PropNameID::forUtf8(runtime, "get_error"), 0,
42
+ [](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
43
+ size_t count) -> jsi::Value {
44
+ auto native = GPUUncapturedErrorEvent::fromValue(rt, thisVal);
45
+ return std::visit(
46
+ [&rt](auto &&err) -> jsi::Value {
47
+ using T = std::decay_t<decltype(err)>;
48
+ return JSIConverter<T>::toJSI(rt, err);
49
+ },
50
+ native->_error);
51
+ });
52
+
53
+ auto objectCtor = runtime.global().getPropertyAsObject(runtime, "Object");
54
+ auto defineProperty =
55
+ objectCtor.getPropertyAsFunction(runtime, "defineProperty");
56
+
57
+ jsi::Object descriptor(runtime);
58
+ descriptor.setProperty(runtime, "get", errorGetter);
59
+ descriptor.setProperty(runtime, "enumerable", true);
60
+ descriptor.setProperty(runtime, "configurable", true);
61
+
62
+ defineProperty.call(runtime, prototype,
63
+ jsi::String::createFromUtf8(runtime, "error"),
64
+ descriptor);
65
+ }
66
+
67
+ private:
68
+ GPUErrorVariant _error;
69
+ };
70
+
71
+ } // namespace rnwgpu
@@ -20,7 +20,6 @@ const registerWebGPUForReanimated = () => {
20
20
  }
21
21
  isRegistered = true;
22
22
  try {
23
- // eslint-disable-next-line @typescript-eslint/no-var-requires
24
23
  const {
25
24
  registerCustomSerializable
26
25
  } = require("react-native-worklets");
@@ -1 +1 @@
1
- {"version":3,"names":["isRegistered","registerWebGPUForReanimated","registerCustomSerializable","require","name","determine","value","__webgpuIsWebGPUObject","pack","__webgpuBox","unpack","boxed","unbox","exports"],"sourceRoot":"../../../../src","sources":["external/reanimated/registerWebGPUForReanimated.ts"],"mappings":";;;;;;AAAA;;AAMA,IAAIA,YAAY,GAAG,KAAK;;AAExB;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,2BAA2B,GAAGA,CAAA,KAAM;EAC/C,IAAID,YAAY,EAAE;IAChB;EACF;EACAA,YAAY,GAAG,IAAI;EAEnB,IAAI;IACF;IACA,MAAM;MAAEE;IAA2B,CAAC,GAAGC,OAAO,CAAC,uBAAuB,CAAC;IAEvED,0BAA0B,CAAC;MACzBE,IAAI,EAAE,QAAQ;MACdC,SAAS,EAAGC,KAAa,IAAsB;QAC7C,SAAS;;QACT,OAAOC,sBAAsB,CAACD,KAAK,CAAC;MACtC,CAAC;MACDE,IAAI,EAAGF,KAAa,IAAK;QACvB,SAAS;;QACT,OAAOG,WAAW,CAACH,KAAK,CAAC;MAC3B,CAAC;MACDI,MAAM,EAAGC,KAA8B,IAAK;QAC1C,SAAS;;QACT,OAAOA,KAAK,CAACC,KAAK,CAAC,CAAC;MACtB;IACF,CAAC,CAAC;EACJ,CAAC,CAAC,MAAM;IACN;EAAA;AAEJ,CAAC;AAACC,OAAA,CAAAZ,2BAAA,GAAAA,2BAAA","ignoreList":[]}
1
+ {"version":3,"names":["isRegistered","registerWebGPUForReanimated","registerCustomSerializable","require","name","determine","value","__webgpuIsWebGPUObject","pack","__webgpuBox","unpack","boxed","unbox","exports"],"sourceRoot":"../../../../src","sources":["external/reanimated/registerWebGPUForReanimated.ts"],"mappings":";;;;;;AAAA;;AAOA,IAAIA,YAAY,GAAG,KAAK;;AAExB;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,2BAA2B,GAAGA,CAAA,KAAM;EAC/C,IAAID,YAAY,EAAE;IAChB;EACF;EACAA,YAAY,GAAG,IAAI;EAEnB,IAAI;IACF,MAAM;MAAEE;IAA2B,CAAC,GAAGC,OAAO,CAAC,uBAAuB,CAAC;IAEvED,0BAA0B,CAAC;MACzBE,IAAI,EAAE,QAAQ;MACdC,SAAS,EAAGC,KAAa,IAAsB;QAC7C,SAAS;;QACT,OAAOC,sBAAsB,CAACD,KAAK,CAAC;MACtC,CAAC;MACDE,IAAI,EAAGF,KAAa,IAAK;QACvB,SAAS;;QACT,OAAOG,WAAW,CAACH,KAAK,CAAC;MAC3B,CAAC;MACDI,MAAM,EAAGC,KAA8B,IAAK;QAC1C,SAAS;;QACT,OAAOA,KAAK,CAACC,KAAK,CAAC,CAAC;MACtB;IACF,CAAC,CAAC;EACJ,CAAC,CAAC,MAAM;IACN;EAAA;AAEJ,CAAC;AAACC,OAAA,CAAAZ,2BAAA,GAAAA,2BAAA","ignoreList":[]}
@@ -14,7 +14,6 @@ export const registerWebGPUForReanimated = () => {
14
14
  }
15
15
  isRegistered = true;
16
16
  try {
17
- // eslint-disable-next-line @typescript-eslint/no-var-requires
18
17
  const {
19
18
  registerCustomSerializable
20
19
  } = require("react-native-worklets");
@@ -1 +1 @@
1
- {"version":3,"names":["isRegistered","registerWebGPUForReanimated","registerCustomSerializable","require","name","determine","value","__webgpuIsWebGPUObject","pack","__webgpuBox","unpack","boxed","unbox"],"sourceRoot":"../../../../src","sources":["external/reanimated/registerWebGPUForReanimated.ts"],"mappings":"AAAA;;AAMA,IAAIA,YAAY,GAAG,KAAK;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,2BAA2B,GAAGA,CAAA,KAAM;EAC/C,IAAID,YAAY,EAAE;IAChB;EACF;EACAA,YAAY,GAAG,IAAI;EAEnB,IAAI;IACF;IACA,MAAM;MAAEE;IAA2B,CAAC,GAAGC,OAAO,CAAC,uBAAuB,CAAC;IAEvED,0BAA0B,CAAC;MACzBE,IAAI,EAAE,QAAQ;MACdC,SAAS,EAAGC,KAAa,IAAsB;QAC7C,SAAS;;QACT,OAAOC,sBAAsB,CAACD,KAAK,CAAC;MACtC,CAAC;MACDE,IAAI,EAAGF,KAAa,IAAK;QACvB,SAAS;;QACT,OAAOG,WAAW,CAACH,KAAK,CAAC;MAC3B,CAAC;MACDI,MAAM,EAAGC,KAA8B,IAAK;QAC1C,SAAS;;QACT,OAAOA,KAAK,CAACC,KAAK,CAAC,CAAC;MACtB;IACF,CAAC,CAAC;EACJ,CAAC,CAAC,MAAM;IACN;EAAA;AAEJ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["isRegistered","registerWebGPUForReanimated","registerCustomSerializable","require","name","determine","value","__webgpuIsWebGPUObject","pack","__webgpuBox","unpack","boxed","unbox"],"sourceRoot":"../../../../src","sources":["external/reanimated/registerWebGPUForReanimated.ts"],"mappings":"AAAA;;AAOA,IAAIA,YAAY,GAAG,KAAK;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,2BAA2B,GAAGA,CAAA,KAAM;EAC/C,IAAID,YAAY,EAAE;IAChB;EACF;EACAA,YAAY,GAAG,IAAI;EAEnB,IAAI;IACF,MAAM;MAAEE;IAA2B,CAAC,GAAGC,OAAO,CAAC,uBAAuB,CAAC;IAEvED,0BAA0B,CAAC;MACzBE,IAAI,EAAE,QAAQ;MACdC,SAAS,EAAGC,KAAa,IAAsB;QAC7C,SAAS;;QACT,OAAOC,sBAAsB,CAACD,KAAK,CAAC;MACtC,CAAC;MACDE,IAAI,EAAGF,KAAa,IAAK;QACvB,SAAS;;QACT,OAAOG,WAAW,CAACH,KAAK,CAAC;MAC3B,CAAC;MACDI,MAAM,EAAGC,KAA8B,IAAK;QAC1C,SAAS;;QACT,OAAOA,KAAK,CAACC,KAAK,CAAC,CAAC;MACtB;IACF,CAAC,CAAC;EACJ,CAAC,CAAC,MAAM;IACN;EAAA;AAEJ,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"registerWebGPUForReanimated.d.ts","sourceRoot":"","sources":["../../../../../commonjs/external/reanimated/registerWebGPUForReanimated.js"],"names":[],"mappings":";AAUA;;;;;GAKG;AACH,oDA+BC"}
1
+ {"version":3,"file":"registerWebGPUForReanimated.d.ts","sourceRoot":"","sources":["../../../../../commonjs/external/reanimated/registerWebGPUForReanimated.js"],"names":[],"mappings":";AAUA;;;;;GAKG;AACH,oDA8BC"}
@@ -1 +1 @@
1
- {"version":3,"file":"registerWebGPUForReanimated.d.ts","sourceRoot":"","sources":["../../../../../module/external/reanimated/registerWebGPUForReanimated.js"],"names":[],"mappings":"AAUO,oDA+BN"}
1
+ {"version":3,"file":"registerWebGPUForReanimated.d.ts","sourceRoot":"","sources":["../../../../../module/external/reanimated/registerWebGPUForReanimated.js"],"names":[],"mappings":"AAUO,oDA8BN"}
@@ -1 +1 @@
1
- {"version":3,"file":"registerWebGPUForReanimated.d.ts","sourceRoot":"","sources":["../../../../../src/external/reanimated/registerWebGPUForReanimated.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,YA4BvC,CAAC"}
1
+ {"version":3,"file":"registerWebGPUForReanimated.d.ts","sourceRoot":"","sources":["../../../../../src/external/reanimated/registerWebGPUForReanimated.ts"],"names":[],"mappings":"AASA;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,YA2BvC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-wgpu",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "React Native WebGPU",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -6,7 +6,7 @@ type ImportType = ReturnType<typeof require>;
6
6
  * This is useful for lazily requiring optional dependencies.
7
7
  */
8
8
  export const createModuleProxy = <TModule>(
9
- getModule: () => ImportType
9
+ getModule: () => ImportType,
10
10
  ): TModule => {
11
11
  const holder: { module: TModule | undefined } = { module: undefined };
12
12
 
@@ -1,8 +1,9 @@
1
1
  // Declare global WebGPU worklet helper functions (installed by native module)
2
2
  declare function __webgpuIsWebGPUObject(obj: unknown): boolean;
3
- declare function __webgpuBox(
4
- obj: object
5
- ): { unbox: () => object; __boxedWebGPU: true };
3
+ declare function __webgpuBox(obj: object): {
4
+ unbox: () => object;
5
+ __boxedWebGPU: true;
6
+ };
6
7
 
7
8
  let isRegistered = false;
8
9
 
@@ -19,7 +20,6 @@ export const registerWebGPUForReanimated = () => {
19
20
  isRegistered = true;
20
21
 
21
22
  try {
22
- // eslint-disable-next-line @typescript-eslint/no-var-requires
23
23
  const { registerCustomSerializable } = require("react-native-worklets");
24
24
 
25
25
  registerCustomSerializable({