@bentopdf/pymupdf-wasm 0.1.9 → 0.1.10

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.
Files changed (2) hide show
  1. package/dist/index.js +14 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1946,6 +1946,20 @@ for chunk in chunks:
1946
1946
  else:
1947
1947
  result.append({"text": str(chunk), "metadata": {"file_name": "${filename.replace(/"/g, '\\"')}"}})
1948
1948
 
1949
+ def make_json_safe(obj):
1950
+ if isinstance(obj, pymupdf.Rect):
1951
+ return list(obj)
1952
+ elif isinstance(obj, dict):
1953
+ return {k: make_json_safe(v) for k, v in obj.items()}
1954
+ elif isinstance(obj, list):
1955
+ return [make_json_safe(v) for v in obj]
1956
+ elif isinstance(obj, tuple):
1957
+ return [make_json_safe(v) for v in obj]
1958
+ else:
1959
+ return obj
1960
+
1961
+ result = make_json_safe(result)
1962
+
1949
1963
  json.dumps(result)
1950
1964
  `);
1951
1965
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bentopdf/pymupdf-wasm",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "PyMuPDF compiled to WebAssembly - Full PDF manipulation in the browser",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",