@couch-kit/host 1.6.0 → 1.7.1
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/lib/assets.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/assets.ts +10 -8
- package/src/websocket.ts +3 -3
package/lib/assets.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../src/assets.ts"],"names":[],"mappings":"
|
|
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.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"prepublishOnly": "bun run build"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@couch-kit/core": "0.8.
|
|
58
|
+
"@couch-kit/core": "0.8.1",
|
|
59
59
|
"buffer": "^6.0.3",
|
|
60
60
|
"js-sha1": "^0.7.0",
|
|
61
61
|
"react-native-nitro-http-server": "^1.5.4"
|
|
@@ -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": ">=
|
|
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
|
|
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
|
-
//
|
|
82
|
-
//
|
|
83
|
-
|
|
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;
|
package/src/websocket.ts
CHANGED
|
@@ -11,7 +11,7 @@ import type {
|
|
|
11
11
|
WebSocketConnectionRequest,
|
|
12
12
|
} from "react-native-nitro-http-server";
|
|
13
13
|
import { EventEmitter } from "./event-emitter";
|
|
14
|
-
import { generateId } from "@couch-kit/core";
|
|
14
|
+
import { generateId, DEFAULT_WS_PATH } from "@couch-kit/core";
|
|
15
15
|
|
|
16
16
|
export interface WebSocketConfig {
|
|
17
17
|
port: number;
|
|
@@ -66,7 +66,7 @@ export class GameWebSocketServer extends EventEmitter<WebSocketServerEvents> {
|
|
|
66
66
|
|
|
67
67
|
// Register WebSocket handler for the /ws path
|
|
68
68
|
this.server.onWebSocket(
|
|
69
|
-
|
|
69
|
+
DEFAULT_WS_PATH,
|
|
70
70
|
(ws: ServerWebSocket, request: WebSocketConnectionRequest) => {
|
|
71
71
|
const socketId = generateId();
|
|
72
72
|
this.log(`[WebSocket] New connection: ${socketId}`, request);
|
|
@@ -135,7 +135,7 @@ export class GameWebSocketServer extends EventEmitter<WebSocketServerEvents> {
|
|
|
135
135
|
mounts: [
|
|
136
136
|
{
|
|
137
137
|
type: "websocket",
|
|
138
|
-
path:
|
|
138
|
+
path: DEFAULT_WS_PATH,
|
|
139
139
|
},
|
|
140
140
|
],
|
|
141
141
|
},
|