@couch-kit/host 1.2.4 → 1.2.5

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":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,kBAAkB;;;;CAgEzD,CAAC"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,kBAAkB;;;;CAyEzD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@couch-kit/host",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
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/server.ts CHANGED
@@ -51,9 +51,18 @@ export const useStaticServer = (config: CouchKitHostConfig) => {
51
51
  try {
52
52
  // Use staticDir if provided (required on Android where bundle path is undefined),
53
53
  // otherwise fall back to the iOS bundle directory via expo-file-system
54
- const bundleUri = Paths.bundle.uri;
55
- const path =
56
- config.staticDir || `${bundleUri.replace(/^file:\/\//, "")}www`;
54
+ let path = config.staticDir;
55
+
56
+ if (!path) {
57
+ const bundleUri = Paths.bundle?.uri;
58
+ if (!bundleUri) {
59
+ throw new Error(
60
+ "No staticDir provided and Paths.bundle is unavailable. " +
61
+ "On Android, you must pass staticDir from useExtractAssets.",
62
+ );
63
+ }
64
+ path = `${bundleUri.replace(/^file:\/\//, "")}www`;
65
+ }
57
66
  const port = config.port || DEFAULT_HTTP_PORT;
58
67
 
59
68
  server = new StaticServer();