react-native-consumet 1.0.1 → 1.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-consumet",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "React Native library providing access to entertainment media information (anime, movies, manga, etc.) from multiple sources, adapting the Consumet API for mobile applications.",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/commonjs/index.js",
@@ -249,11 +249,20 @@ export class ProviderManager {
249
249
  }
250
250
 
251
251
  const instance = factory(this.providerContext);
252
-
252
+ let providerInstance = instance;
253
253
  // Validate the instance has required methods
254
254
  this.validateProviderInstance(instance, metadata.category);
255
+ // Attempt to attach the prototype from local provider classes so instanceof works in app code
256
+ try {
257
+ // Prefer metadata.name (e.g., 'Zoro') to match local constructor map keys
258
+ const lookupKey = (metadata as any).name;
259
+ providerInstance = this.attachProviderPrototype(instance, lookupKey, metadata.category);
260
+ } catch (protoErr) {
261
+ // Non-fatal – if we can't attach prototype, just proceed with the plain instance
262
+ console.warn(`⚠️ Could not attach prototype for '${metadata.name}':`, protoErr);
263
+ }
255
264
 
256
- return instance;
265
+ return providerInstance;
257
266
  } catch (error) {
258
267
  throw new Error(`Failed to execute provider code: ${error instanceof Error ? error.message : String(error)}`);
259
268
  }