@couch-kit/host 1.2.2 → 1.2.4

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":"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,CAyE7E"}
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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@couch-kit/host",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "React Native host for local multiplayer party games on Android TV — WebSocket server, state management, and static file serving",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/assets.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { useEffect, useState } from "react";
2
- import { Paths, Directory, File } from "expo-file-system/next";
2
+ import * as FileSystem from "expo-file-system";
3
+ import { Paths, Directory } from "expo-file-system/next";
3
4
  import { Platform } from "react-native";
4
5
  import { toErrorMessage } from "@couch-kit/core";
5
6
 
@@ -56,14 +57,14 @@ export function useExtractAssets(manifest: AssetManifest): ExtractAssetsResult {
56
57
  }
57
58
 
58
59
  // Create the root target directory
59
- targetDir.create({ intermediates: true });
60
+ targetDir.create();
60
61
 
61
62
  // Copy each file from APK assets to filesystem
62
63
  for (const filePath of manifest.files) {
63
64
  if (cancelled) return;
64
65
 
65
- const sourceFile = new File(`asset:///www/${filePath}`);
66
- const destFile = new File(targetDir, filePath);
66
+ const sourceUri = `asset:///www/${filePath}`;
67
+ const destUri = `${targetDir.uri}${filePath}`;
67
68
 
68
69
  // Ensure subdirectory exists (e.g., "assets/" in "assets/index.js")
69
70
  const lastSlash = filePath.lastIndexOf("/");
@@ -72,10 +73,14 @@ export function useExtractAssets(manifest: AssetManifest): ExtractAssetsResult {
72
73
  targetDir,
73
74
  filePath.substring(0, lastSlash),
74
75
  );
75
- subDir.create({ intermediates: true, idempotent: true });
76
+ if (!subDir.exists) {
77
+ subDir.create();
78
+ }
76
79
  }
77
80
 
78
- sourceFile.copy(destFile);
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 });
79
84
  }
80
85
 
81
86
  if (cancelled) return;