@air-jam/sdk 0.1.3 → 0.1.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.
- package/dist/index.cjs +12 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/package.json +10 -7
- package/src/components/host-shell.tsx +0 -1
- package/src/components/player-avatar.tsx +0 -1
- package/src/context/air-jam-context.tsx +21 -1
- package/src/context/socket-manager.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@air-jam/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "The core SDK for building Air Jam games and controllers",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
"directory": "packages/sdk"
|
|
12
12
|
},
|
|
13
13
|
"homepage": "https://github.com/vucinatim/air-jam#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/vucinatim/air-jam/issues"
|
|
16
|
+
},
|
|
14
17
|
"publishConfig": {
|
|
15
18
|
"access": "public"
|
|
16
19
|
},
|
|
@@ -47,11 +50,6 @@
|
|
|
47
50
|
"dist",
|
|
48
51
|
"src"
|
|
49
52
|
],
|
|
50
|
-
"scripts": {
|
|
51
|
-
"build": "tsup",
|
|
52
|
-
"typecheck": "tsc --noEmit",
|
|
53
|
-
"dev": "tsup --watch"
|
|
54
|
-
},
|
|
55
53
|
"dependencies": {
|
|
56
54
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
57
55
|
"@radix-ui/react-slider": "^1.3.6",
|
|
@@ -81,5 +79,10 @@
|
|
|
81
79
|
"tailwindcss": "^4.1.17",
|
|
82
80
|
"tsup": "^8.5.1",
|
|
83
81
|
"typescript": "~5.9.3"
|
|
82
|
+
},
|
|
83
|
+
"scripts": {
|
|
84
|
+
"build": "tsup",
|
|
85
|
+
"typecheck": "tsc --noEmit",
|
|
86
|
+
"dev": "tsup --watch"
|
|
84
87
|
}
|
|
85
|
-
}
|
|
88
|
+
}
|
|
@@ -182,6 +182,7 @@ const AirJamContext = createContext<AirJamContextValue | null>(null);
|
|
|
182
182
|
interface ImportMetaEnv {
|
|
183
183
|
VITE_AIR_JAM_SERVER_URL?: string;
|
|
184
184
|
VITE_AIR_JAM_API_KEY?: string;
|
|
185
|
+
VITE_AIR_JAM_PUBLIC_HOST?: string;
|
|
185
186
|
}
|
|
186
187
|
|
|
187
188
|
const getViteEnv = (): ImportMetaEnv | undefined => {
|
|
@@ -236,6 +237,25 @@ const getEnvApiKey = (): string | undefined => {
|
|
|
236
237
|
return undefined;
|
|
237
238
|
};
|
|
238
239
|
|
|
240
|
+
/**
|
|
241
|
+
* Attempts to read public host from various environment variable formats
|
|
242
|
+
*/
|
|
243
|
+
const getEnvPublicHost = (): string | undefined => {
|
|
244
|
+
// Vite
|
|
245
|
+
const viteEnv = getViteEnv();
|
|
246
|
+
if (viteEnv?.VITE_AIR_JAM_PUBLIC_HOST) {
|
|
247
|
+
return viteEnv.VITE_AIR_JAM_PUBLIC_HOST;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// Next.js / Node
|
|
251
|
+
if (typeof process !== "undefined" && process.env) {
|
|
252
|
+
const nextHost = process.env.NEXT_PUBLIC_AIR_JAM_PUBLIC_HOST;
|
|
253
|
+
if (nextHost) return nextHost;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
return undefined;
|
|
257
|
+
};
|
|
258
|
+
|
|
239
259
|
// ============================================================================
|
|
240
260
|
// Provider Component
|
|
241
261
|
// ============================================================================
|
|
@@ -310,7 +330,7 @@ export const AirJamProvider = <TSchema extends z.ZodSchema = z.ZodSchema>({
|
|
|
310
330
|
serverUrl: serverUrl ?? getEnvServerUrl(),
|
|
311
331
|
apiKey: apiKey ?? getEnvApiKey(),
|
|
312
332
|
maxPlayers,
|
|
313
|
-
publicHost,
|
|
333
|
+
publicHost: publicHost ?? getEnvPublicHost(),
|
|
314
334
|
}),
|
|
315
335
|
[serverUrl, apiKey, maxPlayers, publicHost],
|
|
316
336
|
);
|