@couch-kit/host 1.6.0 → 1.7.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../src/assets.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,oFAAoF;IACpF,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,wCAAwC;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,yCAAyC;IACzC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,aAAa,GAAG,mBAAmB,CA6E7E"}
1
+ {"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../src/assets.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,oFAAoF;IACpF,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,wCAAwC;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,yCAAyC;IACzC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,aAAa,GAAG,mBAAmB,CAgF7E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@couch-kit/host",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -72,7 +72,7 @@
72
72
  "react-native": ">=0.72.0",
73
73
  "react-native-nitro-modules": ">=0.33.0",
74
74
  "expo": ">=51.0.0",
75
- "expo-file-system": ">=17.0.0",
75
+ "expo-file-system": ">=19.0.0",
76
76
  "expo-network": ">=7.0.0"
77
77
  }
78
78
  }
package/src/assets.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { useEffect, useState } from "react";
2
- import * as FileSystem from "expo-file-system";
3
- import { Paths, Directory } from "expo-file-system";
2
+ import { File, Paths, Directory } from "expo-file-system";
4
3
  import { Platform } from "react-native";
5
4
  import { toErrorMessage } from "@couch-kit/core";
6
5
 
@@ -63,9 +62,6 @@ export function useExtractAssets(manifest: AssetManifest): ExtractAssetsResult {
63
62
  for (const filePath of manifest.files) {
64
63
  if (cancelled) return;
65
64
 
66
- const sourceUri = `asset:///www/${filePath}`;
67
- const destUri = `${targetDir.uri}${filePath}`;
68
-
69
65
  // Ensure subdirectory exists (e.g., "assets/" in "assets/index.js")
70
66
  const lastSlash = filePath.lastIndexOf("/");
71
67
  if (lastSlash > 0) {
@@ -78,9 +74,15 @@ export function useExtractAssets(manifest: AssetManifest): ExtractAssetsResult {
78
74
  }
79
75
  }
80
76
 
81
- // Use legacy API the new File API doesn't support asset:// URIs
82
- // on Android because it bypasses the AssetManager
83
- await FileSystem.copyAsync({ from: sourceUri, to: destUri });
77
+ // Read from APK asset via the new File API.
78
+ // Note: File.copy() has a bug with asset:// URIs in expo-file-system@19
79
+ // (ClassCastException: AssetFile cannot be cast to java.io.File).
80
+ // Instead, we read bytes via the working inputStream path and write
81
+ // to the destination — this correctly uses Android's AssetManager.
82
+ const sourceFile = new File(`asset:///www/${filePath}`);
83
+ const destFile = new File(targetDir, filePath);
84
+ const content = sourceFile.bytesSync();
85
+ destFile.write(content);
84
86
  }
85
87
 
86
88
  if (cancelled) return;