react-native-wgpu 0.4.2 → 0.5.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 +31 -0
- package/android/CMakeLists.txt +3 -3
- package/cpp/jsi/{RNFEnumMapper.h → EnumMapper.h} +2 -6
- package/cpp/jsi/{RNFJSIConverter.h → JSIConverter.h} +27 -110
- package/cpp/jsi/NativeObject.h +607 -0
- package/cpp/jsi/{RNFPromise.cpp → Promise.cpp} +3 -6
- package/cpp/jsi/{RNFPromise.h → Promise.h} +2 -5
- package/cpp/jsi/RuntimeAwareCache.cpp +7 -0
- package/cpp/jsi/RuntimeAwareCache.h +100 -0
- package/cpp/jsi/RuntimeLifecycleMonitor.cpp +72 -0
- package/cpp/jsi/RuntimeLifecycleMonitor.h +32 -0
- package/cpp/rnwgpu/ArrayBuffer.h +8 -12
- package/cpp/rnwgpu/RNWebGPUManager.cpp +187 -28
- package/cpp/rnwgpu/RNWebGPUManager.h +7 -0
- package/cpp/rnwgpu/api/Canvas.h +14 -12
- package/cpp/rnwgpu/api/GPU.cpp +4 -6
- package/cpp/rnwgpu/api/GPU.h +13 -11
- package/cpp/rnwgpu/api/GPUAdapter.cpp +9 -9
- package/cpp/rnwgpu/api/GPUAdapter.h +14 -11
- package/cpp/rnwgpu/api/GPUAdapterInfo.h +17 -15
- package/cpp/rnwgpu/api/GPUBindGroup.h +11 -10
- package/cpp/rnwgpu/api/GPUBindGroupLayout.h +12 -11
- package/cpp/rnwgpu/api/GPUBuffer.h +19 -16
- package/cpp/rnwgpu/api/GPUCanvasContext.h +17 -13
- package/cpp/rnwgpu/api/GPUCommandBuffer.h +12 -10
- package/cpp/rnwgpu/api/GPUCommandEncoder.h +35 -32
- package/cpp/rnwgpu/api/GPUCompilationInfo.h +19 -19
- package/cpp/rnwgpu/api/GPUCompilationMessage.h +10 -7
- package/cpp/rnwgpu/api/GPUComputePassEncoder.h +28 -27
- package/cpp/rnwgpu/api/GPUComputePipeline.h +14 -13
- package/cpp/rnwgpu/api/GPUDevice.cpp +111 -95
- package/cpp/rnwgpu/api/GPUDevice.h +51 -43
- package/cpp/rnwgpu/api/GPUDeviceLostInfo.h +12 -10
- package/cpp/rnwgpu/api/GPUError.h +19 -29
- package/cpp/rnwgpu/api/GPUExtent3D.h +7 -10
- package/cpp/rnwgpu/api/GPUExternalTexture.h +12 -11
- package/cpp/rnwgpu/api/GPUInternalError.h +31 -0
- package/cpp/rnwgpu/api/GPUOrigin2D.h +6 -10
- package/cpp/rnwgpu/api/GPUOrigin3D.h +6 -10
- package/cpp/rnwgpu/api/GPUOutOfMemoryError.h +33 -0
- package/cpp/rnwgpu/api/GPUPipelineLayout.h +12 -10
- package/cpp/rnwgpu/api/GPUQuerySet.h +14 -12
- package/cpp/rnwgpu/api/GPUQueue.h +18 -17
- package/cpp/rnwgpu/api/GPURenderBundle.h +11 -10
- package/cpp/rnwgpu/api/GPURenderBundleEncoder.h +36 -33
- package/cpp/rnwgpu/api/GPURenderPassEncoder.h +49 -47
- package/cpp/rnwgpu/api/GPURenderPipeline.h +14 -12
- package/cpp/rnwgpu/api/GPUSampler.h +11 -10
- package/cpp/rnwgpu/api/GPUShaderModule.cpp +7 -8
- package/cpp/rnwgpu/api/GPUShaderModule.h +13 -12
- package/cpp/rnwgpu/api/GPUSupportedLimits.h +73 -93
- package/cpp/rnwgpu/api/GPUTexture.h +24 -20
- package/cpp/rnwgpu/api/GPUTextureView.h +11 -10
- package/cpp/rnwgpu/api/GPUValidationError.h +32 -0
- package/cpp/rnwgpu/api/ImageBitmap.h +10 -6
- package/cpp/rnwgpu/api/RNWebGPU.h +21 -21
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +7 -11
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUBlendState.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h +28 -32
- package/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUColor.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUColorWrite.h +18 -20
- package/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUFragmentState.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUMapMode.h +11 -14
- package/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUShaderStage.h +14 -16
- package/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h +18 -29
- package/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +3 -8
- package/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h +3 -7
- package/cpp/rnwgpu/api/descriptors/GPUVertexState.h +3 -7
- package/cpp/rnwgpu/api/descriptors/Unions.h +3 -3
- package/cpp/rnwgpu/async/AsyncTaskHandle.cpp +10 -10
- package/cpp/rnwgpu/async/AsyncTaskHandle.h +2 -2
- package/lib/commonjs/external/ModuleProxy.js +36 -0
- package/lib/commonjs/external/ModuleProxy.js.map +1 -0
- package/lib/commonjs/external/index.js +17 -0
- package/lib/commonjs/external/index.js.map +1 -0
- package/lib/commonjs/external/reanimated/ReanimatedProxy.js +18 -0
- package/lib/commonjs/external/reanimated/ReanimatedProxy.js.map +1 -0
- package/lib/commonjs/external/reanimated/index.js +21 -0
- package/lib/commonjs/external/reanimated/index.js.map +1 -0
- package/lib/commonjs/external/reanimated/registerWebGPUForReanimated.js +50 -0
- package/lib/commonjs/external/reanimated/registerWebGPUForReanimated.js.map +1 -0
- package/lib/commonjs/main/index.js +2 -142
- package/lib/commonjs/main/index.js.map +1 -1
- package/lib/module/external/ModuleProxy.js +28 -0
- package/lib/module/external/ModuleProxy.js.map +1 -0
- package/lib/module/external/index.js +2 -0
- package/lib/module/external/index.js.map +1 -0
- package/lib/module/external/reanimated/ReanimatedProxy.js +12 -0
- package/lib/module/external/reanimated/ReanimatedProxy.js.map +1 -0
- package/lib/module/external/reanimated/index.js +3 -0
- package/lib/module/external/reanimated/index.js.map +1 -0
- package/lib/module/external/reanimated/registerWebGPUForReanimated.js +43 -0
- package/lib/module/external/reanimated/registerWebGPUForReanimated.js.map +1 -0
- package/lib/module/main/index.js +2 -141
- package/lib/module/main/index.js.map +1 -1
- package/lib/typescript/babel.config.d.ts +1 -0
- package/lib/typescript/lib/commonjs/external/ModuleProxy.d.ts +12 -0
- package/lib/typescript/lib/commonjs/external/ModuleProxy.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/external/index.d.ts +2 -0
- package/lib/typescript/lib/commonjs/external/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/external/reanimated/ReanimatedProxy.d.ts +6 -0
- package/lib/typescript/lib/commonjs/external/reanimated/ReanimatedProxy.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/external/reanimated/index.d.ts +4 -0
- package/lib/typescript/lib/commonjs/external/reanimated/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/external/reanimated/registerWebGPUForReanimated.d.ts +9 -0
- package/lib/typescript/lib/commonjs/external/reanimated/registerWebGPUForReanimated.d.ts.map +1 -0
- package/lib/typescript/lib/module/external/ModuleProxy.d.ts +7 -0
- package/lib/typescript/lib/module/external/ModuleProxy.d.ts.map +1 -0
- package/lib/typescript/lib/module/external/index.d.ts +2 -0
- package/lib/typescript/lib/module/external/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/external/reanimated/ReanimatedProxy.d.ts +5 -0
- package/lib/typescript/lib/module/external/reanimated/ReanimatedProxy.d.ts.map +1 -0
- package/lib/typescript/lib/module/external/reanimated/index.d.ts +3 -0
- package/lib/typescript/lib/module/external/reanimated/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/external/reanimated/registerWebGPUForReanimated.d.ts +2 -0
- package/lib/typescript/lib/module/external/reanimated/registerWebGPUForReanimated.d.ts.map +1 -0
- package/lib/typescript/src/external/ModuleProxy.d.ts +11 -0
- package/lib/typescript/src/external/ModuleProxy.d.ts.map +1 -0
- package/lib/typescript/src/external/index.d.ts +2 -0
- package/lib/typescript/src/external/index.d.ts.map +1 -0
- package/lib/typescript/src/external/reanimated/ReanimatedProxy.d.ts +4 -0
- package/lib/typescript/src/external/reanimated/ReanimatedProxy.d.ts.map +1 -0
- package/lib/typescript/src/external/reanimated/index.d.ts +3 -0
- package/lib/typescript/src/external/reanimated/index.d.ts.map +1 -0
- package/lib/typescript/src/external/reanimated/registerWebGPUForReanimated.d.ts +8 -0
- package/lib/typescript/src/external/reanimated/registerWebGPUForReanimated.d.ts.map +1 -0
- package/package.json +16 -3
- package/src/external/ModuleProxy.ts +30 -0
- package/src/external/index.ts +1 -0
- package/src/external/reanimated/ReanimatedProxy.ts +19 -0
- package/src/external/reanimated/index.ts +2 -0
- package/src/external/reanimated/registerWebGPUForReanimated.ts +43 -0
- package/src/main/index.tsx +3 -170
- package/cpp/jsi/RNFHybridObject.cpp +0 -150
- package/cpp/jsi/RNFHybridObject.h +0 -181
- package/cpp/jsi/RNFJSIHelper.h +0 -51
- package/cpp/jsi/RNFPointerHolder.h +0 -95
- package/cpp/jsi/RNFRuntimeState.cpp +0 -18
- package/cpp/jsi/RNFRuntimeState.h +0 -106
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_external","require","_NativeWebGPUModule","_interopRequireDefault","_Canvas","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_Offscreen","_WebGPUViewNativeComponent","_hooks","e","__esModule","default","WebGPUModule","install","registerWebGPUForReanimated","navigator","gpu","RNWebGPU","userAgent","global","createImageBitmap","params","Promise","resolve"],"sourceRoot":"../../../src","sources":["main/index.tsx"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// https://github.com/mrousavy/react-native-vision-camera/blob/main/package/src/dependencies/ModuleProxy.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Create a lazily-imported module proxy.
|
|
5
|
+
* This is useful for lazily requiring optional dependencies.
|
|
6
|
+
*/
|
|
7
|
+
export const createModuleProxy = getModule => {
|
|
8
|
+
const holder = {
|
|
9
|
+
module: undefined
|
|
10
|
+
};
|
|
11
|
+
const proxy = new Proxy(holder, {
|
|
12
|
+
get: (target, property) => {
|
|
13
|
+
if (target.module == null) {
|
|
14
|
+
// lazy initialize module via require()
|
|
15
|
+
// caller needs to make sure the require() call is wrapped in a try/catch
|
|
16
|
+
target.module = getModule();
|
|
17
|
+
}
|
|
18
|
+
return target.module[property];
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return proxy;
|
|
22
|
+
};
|
|
23
|
+
export class OptionalDependencyNotInstalledError extends Error {
|
|
24
|
+
constructor(name) {
|
|
25
|
+
super(`${name} is not installed!`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=ModuleProxy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createModuleProxy","getModule","holder","module","undefined","proxy","Proxy","get","target","property","OptionalDependencyNotInstalledError","Error","constructor","name"],"sourceRoot":"../../../src","sources":["external/ModuleProxy.ts"],"mappings":"AAAA;;AAGA;AACA;AACA;AACA;AACA,OAAO,MAAMA,iBAAiB,GAC5BC,SAA2B,IACf;EACZ,MAAMC,MAAuC,GAAG;IAAEC,MAAM,EAAEC;EAAU,CAAC;EAErE,MAAMC,KAAK,GAAG,IAAIC,KAAK,CAACJ,MAAM,EAAE;IAC9BK,GAAG,EAAEA,CAACC,MAAM,EAAEC,QAAQ,KAAK;MACzB,IAAID,MAAM,CAACL,MAAM,IAAI,IAAI,EAAE;QACzB;QACA;QACAK,MAAM,CAACL,MAAM,GAAGF,SAAS,CAAC,CAAY;MACxC;MACA,OAAOO,MAAM,CAACL,MAAM,CAACM,QAAQ,CAA+B;IAC9D;EACF,CAAC,CAAC;EACF,OAAOJ,KAAK;AACd,CAAC;AAED,OAAO,MAAMK,mCAAmC,SAASC,KAAK,CAAC;EAC7DC,WAAWA,CAACC,IAAY,EAAE;IACxB,KAAK,CAAC,GAAGA,IAAI,oBAAoB,CAAC;EACpC;AACF","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["external/index.ts"],"mappings":"AAAA,cAAc,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { OptionalDependencyNotInstalledError, createModuleProxy } from "../ModuleProxy";
|
|
2
|
+
const Reanimated = createModuleProxy(() => {
|
|
3
|
+
try {
|
|
4
|
+
return require("react-native-reanimated");
|
|
5
|
+
} catch (e) {
|
|
6
|
+
throw new OptionalDependencyNotInstalledError("react-native-reanimated");
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
// eslint-disable-next-line import/no-default-export
|
|
11
|
+
export default Reanimated;
|
|
12
|
+
//# sourceMappingURL=ReanimatedProxy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["OptionalDependencyNotInstalledError","createModuleProxy","Reanimated","require","e"],"sourceRoot":"../../../../src","sources":["external/reanimated/ReanimatedProxy.ts"],"mappings":"AAEA,SACEA,mCAAmC,EACnCC,iBAAiB,QACZ,gBAAgB;AAIvB,MAAMC,UAAU,GAAGD,iBAAiB,CAAc,MAAM;EACtD,IAAI;IACF,OAAOE,OAAO,CAAC,yBAAyB,CAAC;EAC3C,CAAC,CAAC,OAAOC,CAAC,EAAE;IACV,MAAM,IAAIJ,mCAAmC,CAAC,yBAAyB,CAAC;EAC1E;AACF,CAAC,CAAC;;AAEF;AACA,eAAeE,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["registerWebGPUForReanimated","default","Reanimated"],"sourceRoot":"../../../../src","sources":["external/reanimated/index.ts"],"mappings":"AAAA,SAASA,2BAA2B,QAAQ,+BAA+B;AAC3E,SAASC,OAAO,IAAIC,UAAU,QAAQ,mBAAmB","ignoreList":[]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Declare global WebGPU worklet helper functions (installed by native module)
|
|
2
|
+
|
|
3
|
+
let isRegistered = false;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Register WebGPU objects for Worklets serialization.
|
|
7
|
+
* This allows GPUDevice, GPUCanvasContext, etc. to be passed to worklets.
|
|
8
|
+
*
|
|
9
|
+
* This is called automatically when the module loads if react-native-worklets is installed.
|
|
10
|
+
*/
|
|
11
|
+
export const registerWebGPUForReanimated = () => {
|
|
12
|
+
if (isRegistered) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
isRegistered = true;
|
|
16
|
+
try {
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
18
|
+
const {
|
|
19
|
+
registerCustomSerializable
|
|
20
|
+
} = require("react-native-worklets");
|
|
21
|
+
registerCustomSerializable({
|
|
22
|
+
name: "WebGPU",
|
|
23
|
+
determine: value => {
|
|
24
|
+
"worklet";
|
|
25
|
+
|
|
26
|
+
return __webgpuIsWebGPUObject(value);
|
|
27
|
+
},
|
|
28
|
+
pack: value => {
|
|
29
|
+
"worklet";
|
|
30
|
+
|
|
31
|
+
return __webgpuBox(value);
|
|
32
|
+
},
|
|
33
|
+
unpack: boxed => {
|
|
34
|
+
"worklet";
|
|
35
|
+
|
|
36
|
+
return boxed.unbox();
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
} catch {
|
|
40
|
+
// react-native-worklets not installed, skip registration
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=registerWebGPUForReanimated.js.map
|
|
@@ -0,0 +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":[]}
|
package/lib/module/main/index.js
CHANGED
|
@@ -1,151 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import { registerWebGPUForReanimated } from "../external";
|
|
2
2
|
import WebGPUModule from "../NativeWebGPUModule";
|
|
3
3
|
export * from "../Canvas";
|
|
4
4
|
export * from "../Offscreen";
|
|
5
5
|
export * from "../WebGPUViewNativeComponent";
|
|
6
6
|
export * from "../hooks";
|
|
7
7
|
export { default as WebGPUModule } from "../NativeWebGPUModule";
|
|
8
|
-
const GPU = {};
|
|
9
|
-
GPU[Symbol.hasInstance] = function (instance) {
|
|
10
|
-
return "__brand" in instance && instance.__brand === "GPU";
|
|
11
|
-
};
|
|
12
|
-
const GPUAdapter = {};
|
|
13
|
-
GPUAdapter[Symbol.hasInstance] = function (instance) {
|
|
14
|
-
return "__brand" in instance && instance.__brand === "GPUAdapter";
|
|
15
|
-
};
|
|
16
|
-
const GPUAdapterInfo = {};
|
|
17
|
-
GPUAdapterInfo[Symbol.hasInstance] = function (instance) {
|
|
18
|
-
return "__brand" in instance && instance.__brand === "GPUAdapterInfo";
|
|
19
|
-
};
|
|
20
|
-
const GPUBindGroup = {};
|
|
21
|
-
GPUBindGroup[Symbol.hasInstance] = function (instance) {
|
|
22
|
-
return "__brand" in instance && instance.__brand === "GPUBindGroup";
|
|
23
|
-
};
|
|
24
|
-
const GPUBindGroupLayout = {};
|
|
25
|
-
GPUBindGroupLayout[Symbol.hasInstance] = function (instance) {
|
|
26
|
-
return "__brand" in instance && instance.__brand === "GPUBindGroupLayout";
|
|
27
|
-
};
|
|
28
|
-
const GPUBuffer = {};
|
|
29
|
-
GPUBuffer[Symbol.hasInstance] = function (instance) {
|
|
30
|
-
return "__brand" in instance && instance.__brand === "GPUBuffer";
|
|
31
|
-
};
|
|
32
|
-
const GPUCanvasContext = {};
|
|
33
|
-
GPUCanvasContext[Symbol.hasInstance] = function (instance) {
|
|
34
|
-
return "__brand" in instance && instance.__brand === "GPUCanvasContext";
|
|
35
|
-
};
|
|
36
|
-
const GPUCommandBuffer = {};
|
|
37
|
-
GPUCommandBuffer[Symbol.hasInstance] = function (instance) {
|
|
38
|
-
return "__brand" in instance && instance.__brand === "GPUCommandBuffer";
|
|
39
|
-
};
|
|
40
|
-
const GPUCommandEncoder = {};
|
|
41
|
-
GPUCommandEncoder[Symbol.hasInstance] = function (instance) {
|
|
42
|
-
return "__brand" in instance && instance.__brand === "GPUCommandEncoder";
|
|
43
|
-
};
|
|
44
|
-
const GPUCompilationInfo = {};
|
|
45
|
-
GPUCompilationInfo[Symbol.hasInstance] = function (instance) {
|
|
46
|
-
return "__brand" in instance && instance.__brand === "GPUCompilationInfo";
|
|
47
|
-
};
|
|
48
|
-
const GPUCompilationMessage = {};
|
|
49
|
-
GPUCompilationMessage[Symbol.hasInstance] = function (instance) {
|
|
50
|
-
return "__brand" in instance && instance.__brand === "GPUCompilationMessage";
|
|
51
|
-
};
|
|
52
|
-
const GPUComputePassEncoder = {};
|
|
53
|
-
GPUComputePassEncoder[Symbol.hasInstance] = function (instance) {
|
|
54
|
-
return "__brand" in instance && instance.__brand === "GPUComputePassEncoder";
|
|
55
|
-
};
|
|
56
|
-
const GPUComputePipeline = {};
|
|
57
|
-
GPUComputePipeline[Symbol.hasInstance] = function (instance) {
|
|
58
|
-
return "__brand" in instance && instance.__brand === "GPUComputePipeline";
|
|
59
|
-
};
|
|
60
|
-
const GPUDevice = {};
|
|
61
|
-
GPUDevice[Symbol.hasInstance] = function (instance) {
|
|
62
|
-
return "__brand" in instance && instance.__brand === "GPUDevice";
|
|
63
|
-
};
|
|
64
|
-
const GPUDeviceLostInfo = {};
|
|
65
|
-
GPUDeviceLostInfo[Symbol.hasInstance] = function (instance) {
|
|
66
|
-
return "__brand" in instance && instance.__brand === "GPUDeviceLostInfo";
|
|
67
|
-
};
|
|
68
|
-
const GPUError = {};
|
|
69
|
-
GPUError[Symbol.hasInstance] = function (instance) {
|
|
70
|
-
return "__brand" in instance && instance.__brand === "GPUError";
|
|
71
|
-
};
|
|
72
|
-
const GPUExternalTexture = {};
|
|
73
|
-
GPUExternalTexture[Symbol.hasInstance] = function (instance) {
|
|
74
|
-
return "__brand" in instance && instance.__brand === "GPUExternalTexture";
|
|
75
|
-
};
|
|
76
|
-
const GPUPipelineLayout = {};
|
|
77
|
-
GPUPipelineLayout[Symbol.hasInstance] = function (instance) {
|
|
78
|
-
return "__brand" in instance && instance.__brand === "GPUPipelineLayout";
|
|
79
|
-
};
|
|
80
|
-
const GPUQuerySet = {};
|
|
81
|
-
GPUQuerySet[Symbol.hasInstance] = function (instance) {
|
|
82
|
-
return "__brand" in instance && instance.__brand === "GPUQuerySet";
|
|
83
|
-
};
|
|
84
|
-
const GPUQueue = {};
|
|
85
|
-
GPUQueue[Symbol.hasInstance] = function (instance) {
|
|
86
|
-
return "__brand" in instance && instance.__brand === "GPUQueue";
|
|
87
|
-
};
|
|
88
|
-
const GPURenderBundle = {};
|
|
89
|
-
GPURenderBundle[Symbol.hasInstance] = function (instance) {
|
|
90
|
-
return "__brand" in instance && instance.__brand === "GPURenderBundle";
|
|
91
|
-
};
|
|
92
|
-
const GPURenderBundleEncoder = {};
|
|
93
|
-
GPURenderBundleEncoder[Symbol.hasInstance] = function (instance) {
|
|
94
|
-
return "__brand" in instance && instance.__brand === "GPURenderBundleEncoder";
|
|
95
|
-
};
|
|
96
|
-
const GPURenderPassEncoder = {};
|
|
97
|
-
GPURenderPassEncoder[Symbol.hasInstance] = function (instance) {
|
|
98
|
-
return "__brand" in instance && instance.__brand === "GPURenderPassEncoder";
|
|
99
|
-
};
|
|
100
|
-
const GPURenderPipeline = {};
|
|
101
|
-
GPURenderPipeline[Symbol.hasInstance] = function (instance) {
|
|
102
|
-
return "__brand" in instance && instance.__brand === "GPURenderPipeline";
|
|
103
|
-
};
|
|
104
|
-
const GPUSampler = {};
|
|
105
|
-
GPUSampler[Symbol.hasInstance] = function (instance) {
|
|
106
|
-
return "__brand" in instance && instance.__brand === "GPUSampler";
|
|
107
|
-
};
|
|
108
|
-
const GPUShaderModule = {};
|
|
109
|
-
GPUShaderModule[Symbol.hasInstance] = function (instance) {
|
|
110
|
-
return "__brand" in instance && instance.__brand === "GPUShaderModule";
|
|
111
|
-
};
|
|
112
|
-
const GPUTexture = {};
|
|
113
|
-
GPUTexture[Symbol.hasInstance] = function (instance) {
|
|
114
|
-
return "__brand" in instance && instance.__brand === "GPUTexture";
|
|
115
|
-
};
|
|
116
|
-
const GPUTextureView = {};
|
|
117
|
-
GPUTextureView[Symbol.hasInstance] = function (instance) {
|
|
118
|
-
return "__brand" in instance && instance.__brand === "GPUTextureView";
|
|
119
|
-
};
|
|
120
|
-
global.GPU = GPU;
|
|
121
|
-
global.GPUAdapter = GPUAdapter;
|
|
122
|
-
global.GPUAdapterInfo = GPUAdapterInfo;
|
|
123
|
-
global.GPUBindGroup = GPUBindGroup;
|
|
124
|
-
global.GPUBindGroupLayout = GPUBindGroupLayout;
|
|
125
|
-
global.GPUBuffer = GPUBuffer;
|
|
126
|
-
global.GPUCanvasContext = GPUCanvasContext;
|
|
127
|
-
global.GPUCommandBuffer = GPUCommandBuffer;
|
|
128
|
-
global.GPUCommandEncoder = GPUCommandEncoder;
|
|
129
|
-
global.GPUCompilationInfo = GPUCompilationInfo;
|
|
130
|
-
global.GPUCompilationMessage = GPUCompilationMessage;
|
|
131
|
-
global.GPUComputePassEncoder = GPUComputePassEncoder;
|
|
132
|
-
global.GPUComputePipeline = GPUComputePipeline;
|
|
133
|
-
global.GPUDevice = GPUDevice;
|
|
134
|
-
global.GPUDeviceLostInfo = GPUDeviceLostInfo;
|
|
135
|
-
global.GPUError = GPUError;
|
|
136
|
-
global.GPUExternalTexture = GPUExternalTexture;
|
|
137
|
-
global.GPUPipelineLayout = GPUPipelineLayout;
|
|
138
|
-
global.GPUQuerySet = GPUQuerySet;
|
|
139
|
-
global.GPUQueue = GPUQueue;
|
|
140
|
-
global.GPURenderBundle = GPURenderBundle;
|
|
141
|
-
global.GPURenderBundleEncoder = GPURenderBundleEncoder;
|
|
142
|
-
global.GPURenderPassEncoder = GPURenderPassEncoder;
|
|
143
|
-
global.GPURenderPipeline = GPURenderPipeline;
|
|
144
|
-
global.GPUSampler = GPUSampler;
|
|
145
|
-
global.GPUShaderModule = GPUShaderModule;
|
|
146
|
-
global.GPUTexture = GPUTexture;
|
|
147
|
-
global.GPUTextureView = GPUTextureView;
|
|
148
8
|
WebGPUModule.install();
|
|
9
|
+
registerWebGPUForReanimated();
|
|
149
10
|
if (!navigator) {
|
|
150
11
|
// @ts-expect-error Navigation object is more complex than this, setting it to an empty object to add gpu property
|
|
151
12
|
navigator = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["registerWebGPUForReanimated","WebGPUModule","default","install","navigator","gpu","RNWebGPU","userAgent","global","createImageBitmap","params","Promise","resolve"],"sourceRoot":"../../../src","sources":["main/index.tsx"],"mappings":"AAAA,SAASA,2BAA2B,QAAQ,aAAa;AACzD,OAAOC,YAAY,MAAM,uBAAuB;AAEhD,cAAc,WAAW;AACzB,cAAc,cAAc;AAC5B,cAAc,8BAA8B;AAC5C,cAAc,UAAU;AAExB,SAASC,OAAO,IAAID,YAAY,QAAQ,uBAAuB;AAE/DA,YAAY,CAACE,OAAO,CAAC,CAAC;AAEtBH,2BAA2B,CAAC,CAAC;AAE7B,IAAI,CAACI,SAAS,EAAE;EACd;EACAA,SAAS,GAAG;IACVC,GAAG,EAAEC,QAAQ,CAACD,GAAG;IACjBE,SAAS,EAAE;EACb,CAAC;AACH,CAAC,MAAM;EACLH,SAAS,CAACC,GAAG,GAAGC,QAAQ,CAACD,GAAG;EAC5B,IAAI,OAAOD,SAAS,CAACG,SAAS,KAAK,QAAQ,EAAE;IAC3C,IAAI;MACF;MACA;MACAH,SAAS,CAACG,SAAS,GAAG,cAAc;IACtC,CAAC,CAAC,MAAM;MACN;IAAA;EAEJ;AACF;AAEAC,MAAM,CAACC,iBAAiB,GACtBD,MAAM,CAACC,iBAAiB,KACvB,CAAC,GAAGC,MAA4C,KAC/C,IAAIC,OAAO,CAAEC,OAAO,IAAKA,OAAO,CAACN,QAAQ,CAACG,iBAAiB,CAAC,GAAGC,MAAM,CAAC,CAAC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const __esModule: boolean;
|
|
2
|
+
/**
|
|
3
|
+
* Create a lazily-imported module proxy.
|
|
4
|
+
* This is useful for lazily requiring optional dependencies.
|
|
5
|
+
*/
|
|
6
|
+
export function createModuleProxy(getModule: any): {
|
|
7
|
+
module: undefined;
|
|
8
|
+
};
|
|
9
|
+
export class OptionalDependencyNotInstalledError extends Error {
|
|
10
|
+
constructor(name: any);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=ModuleProxy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModuleProxy.d.ts","sourceRoot":"","sources":["../../../../commonjs/external/ModuleProxy.js"],"names":[],"mappings":";AAQA;;;GAGG;AACH;;EAeC;AAED;IACE,uBAEC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../commonjs/external/index.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReanimatedProxy.d.ts","sourceRoot":"","sources":["../../../../../commonjs/external/reanimated/ReanimatedProxy.js"],"names":[],"mappings":";;AAOA;;EAMG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../commonjs/external/reanimated/index.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const __esModule: boolean;
|
|
2
|
+
/**
|
|
3
|
+
* Register WebGPU objects for Worklets serialization.
|
|
4
|
+
* This allows GPUDevice, GPUCanvasContext, etc. to be passed to worklets.
|
|
5
|
+
*
|
|
6
|
+
* This is called automatically when the module loads if react-native-worklets is installed.
|
|
7
|
+
*/
|
|
8
|
+
export function registerWebGPUForReanimated(): void;
|
|
9
|
+
//# sourceMappingURL=registerWebGPUForReanimated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerWebGPUForReanimated.d.ts","sourceRoot":"","sources":["../../../../../commonjs/external/reanimated/registerWebGPUForReanimated.js"],"names":[],"mappings":";AAUA;;;;;GAKG;AACH,oDA+BC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModuleProxy.d.ts","sourceRoot":"","sources":["../../../../module/external/ModuleProxy.js"],"names":[],"mappings":"AAMO;;EAeN;AACD;IACE,uBAEC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../module/external/index.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReanimatedProxy.d.ts","sourceRoot":"","sources":["../../../../../module/external/reanimated/ReanimatedProxy.js"],"names":[],"mappings":";AACA;;EAMG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../module/external/reanimated/index.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerWebGPUForReanimated.d.ts","sourceRoot":"","sources":["../../../../../module/external/reanimated/registerWebGPUForReanimated.js"],"names":[],"mappings":"AAUO,oDA+BN"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type ImportType = ReturnType<typeof require>;
|
|
2
|
+
/**
|
|
3
|
+
* Create a lazily-imported module proxy.
|
|
4
|
+
* This is useful for lazily requiring optional dependencies.
|
|
5
|
+
*/
|
|
6
|
+
export declare const createModuleProxy: <TModule>(getModule: () => ImportType) => TModule;
|
|
7
|
+
export declare class OptionalDependencyNotInstalledError extends Error {
|
|
8
|
+
constructor(name: string);
|
|
9
|
+
}
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=ModuleProxy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModuleProxy.d.ts","sourceRoot":"","sources":["../../../../src/external/ModuleProxy.ts"],"names":[],"mappings":"AACA,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAE7C;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,EACvC,WAAW,MAAM,UAAU,KAC1B,OAcF,CAAC;AAEF,qBAAa,mCAAoC,SAAQ,KAAK;gBAChD,IAAI,EAAE,MAAM;CAGzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/external/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReanimatedProxy.d.ts","sourceRoot":"","sources":["../../../../../src/external/reanimated/ReanimatedProxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,WAAW,MAAM,yBAAyB,CAAC;AAS5D,QAAA,MAAM,UAAU,oBAMd,CAAC;AAGH,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/external/reanimated/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Register WebGPU objects for Worklets serialization.
|
|
3
|
+
* This allows GPUDevice, GPUCanvasContext, etc. to be passed to worklets.
|
|
4
|
+
*
|
|
5
|
+
* This is called automatically when the module loads if react-native-worklets is installed.
|
|
6
|
+
*/
|
|
7
|
+
export declare const registerWebGPUForReanimated: () => void;
|
|
8
|
+
//# sourceMappingURL=registerWebGPUForReanimated.d.ts.map
|
|
@@ -0,0 +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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-wgpu",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "React Native WebGPU",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"@types/seedrandom": "^3.0.8",
|
|
66
66
|
"@types/ws": "^8.5.10",
|
|
67
67
|
"@webgpu/types": "0.1.65",
|
|
68
|
+
"baseline-browser-mapping": "^2.9.14",
|
|
68
69
|
"clang-format": "^1.8.0",
|
|
69
70
|
"del-cli": "^5.1.0",
|
|
70
71
|
"eslint": "9.35.0",
|
|
@@ -81,7 +82,9 @@
|
|
|
81
82
|
"react": "19.1.0",
|
|
82
83
|
"react-native": "0.81.4",
|
|
83
84
|
"react-native-builder-bob": "^0.23.2",
|
|
85
|
+
"react-native-reanimated": "^4.2.1",
|
|
84
86
|
"react-native-web": "^0.21.2",
|
|
87
|
+
"react-native-worklets": "^0.7.0",
|
|
85
88
|
"rimraf": "^5.0.7",
|
|
86
89
|
"seedrandom": "^3.0.5",
|
|
87
90
|
"teapot": "^1.0.0",
|
|
@@ -94,7 +97,17 @@
|
|
|
94
97
|
},
|
|
95
98
|
"peerDependencies": {
|
|
96
99
|
"react": "*",
|
|
97
|
-
"react-native": "*"
|
|
100
|
+
"react-native": "*",
|
|
101
|
+
"react-native-reanimated": ">=4.2.1",
|
|
102
|
+
"react-native-worklets": ">=0.7.2"
|
|
103
|
+
},
|
|
104
|
+
"peerDependenciesMeta": {
|
|
105
|
+
"react-native-reanimated": {
|
|
106
|
+
"optional": true
|
|
107
|
+
},
|
|
108
|
+
"react-native-worklets": {
|
|
109
|
+
"optional": true
|
|
110
|
+
}
|
|
98
111
|
},
|
|
99
112
|
"react-native-builder-bob": {
|
|
100
113
|
"source": "src",
|
|
@@ -123,4 +136,4 @@
|
|
|
123
136
|
}
|
|
124
137
|
}
|
|
125
138
|
}
|
|
126
|
-
}
|
|
139
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// https://github.com/mrousavy/react-native-vision-camera/blob/main/package/src/dependencies/ModuleProxy.ts
|
|
2
|
+
type ImportType = ReturnType<typeof require>;
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Create a lazily-imported module proxy.
|
|
6
|
+
* This is useful for lazily requiring optional dependencies.
|
|
7
|
+
*/
|
|
8
|
+
export const createModuleProxy = <TModule>(
|
|
9
|
+
getModule: () => ImportType
|
|
10
|
+
): TModule => {
|
|
11
|
+
const holder: { module: TModule | undefined } = { module: undefined };
|
|
12
|
+
|
|
13
|
+
const proxy = new Proxy(holder, {
|
|
14
|
+
get: (target, property) => {
|
|
15
|
+
if (target.module == null) {
|
|
16
|
+
// lazy initialize module via require()
|
|
17
|
+
// caller needs to make sure the require() call is wrapped in a try/catch
|
|
18
|
+
target.module = getModule() as TModule;
|
|
19
|
+
}
|
|
20
|
+
return target.module[property as keyof typeof holder.module];
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
return proxy as unknown as TModule;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export class OptionalDependencyNotInstalledError extends Error {
|
|
27
|
+
constructor(name: string) {
|
|
28
|
+
super(`${name} is not installed!`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./reanimated";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type * as ReanimatedT from "react-native-reanimated";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
OptionalDependencyNotInstalledError,
|
|
5
|
+
createModuleProxy,
|
|
6
|
+
} from "../ModuleProxy";
|
|
7
|
+
|
|
8
|
+
type TReanimated = typeof ReanimatedT;
|
|
9
|
+
|
|
10
|
+
const Reanimated = createModuleProxy<TReanimated>(() => {
|
|
11
|
+
try {
|
|
12
|
+
return require("react-native-reanimated");
|
|
13
|
+
} catch (e) {
|
|
14
|
+
throw new OptionalDependencyNotInstalledError("react-native-reanimated");
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// eslint-disable-next-line import/no-default-export
|
|
19
|
+
export default Reanimated;
|