@alizarin/napi 2.0.0-alpha.94 → 2.0.0-alpha.96

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.
Binary file
Binary file
Binary file
Binary file
package/index.d.ts CHANGED
@@ -402,4 +402,8 @@ export declare class NapiStaticResourceRegistry {
402
402
  getFull(resourceId: string): any | null
403
403
  /** Get a summary for a resource (works for both summary and full entries), or null if unknown. */
404
404
  getSummary(resourceId: string): any | null
405
+ /** Get diagnostic stats about registry contents (entry counts, tile counts, etc.) */
406
+ memoryStats(): any
407
+ /** Get detailed stats including estimated byte sizes (expensive — re-serializes all data) */
408
+ memoryStatsDetailed(): any
405
409
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alizarin/napi",
3
- "version": "2.0.0-alpha.94",
3
+ "version": "2.0.0-alpha.96",
4
4
  "license": "AGPL-3.0-or-later",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,8 +30,8 @@
30
30
  "@napi-rs/cli": "^2.18.0"
31
31
  },
32
32
  "optionalDependencies": {
33
- "@alizarin/napi-win32-x64-msvc": "2.0.0-alpha.94",
34
- "@alizarin/napi-darwin-x64": "2.0.0-alpha.94",
35
- "@alizarin/napi-linux-x64-gnu": "2.0.0-alpha.94"
33
+ "@alizarin/napi-win32-x64-msvc": "2.0.0-alpha.96",
34
+ "@alizarin/napi-darwin-x64": "2.0.0-alpha.96",
35
+ "@alizarin/napi-linux-x64-gnu": "2.0.0-alpha.96"
36
36
  }
37
37
  }
package/src/lib.rs CHANGED
@@ -381,6 +381,22 @@ impl NapiStaticResourceRegistry {
381
381
  None => Ok(None),
382
382
  }
383
383
  }
384
+
385
+ /// Get diagnostic stats about registry contents (entry counts, tile counts, etc.)
386
+ #[napi]
387
+ pub fn memory_stats(&self) -> Result<serde_json::Value> {
388
+ let stats = self.inner.memory_stats();
389
+ serde_json::to_value(&stats)
390
+ .map_err(|e| napi::Error::from_reason(format!("Serialization failed: {}", e)))
391
+ }
392
+
393
+ /// Get detailed stats including estimated byte sizes (expensive — re-serializes all data)
394
+ #[napi]
395
+ pub fn memory_stats_detailed(&self) -> Result<serde_json::Value> {
396
+ let stats = self.inner.memory_stats_detailed();
397
+ serde_json::to_value(&stats)
398
+ .map_err(|e| napi::Error::from_reason(format!("Serialization failed: {}", e)))
399
+ }
384
400
  }
385
401
 
386
402
  // ============================================================================