serve-sim 0.1.23 → 0.1.24
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/README.md +54 -2
- package/Sources/SimCameraHelper/build.sh +32 -0
- package/Sources/SimCameraHelper/main.m +859 -0
- package/Sources/SimCameraInjector/SimCameraInjector.m +1160 -0
- package/Sources/SimCameraInjector/build.sh +33 -0
- package/Sources/SimCameraInjector/include/SimCamShared.h +55 -0
- package/bin/serve-sim-bin +0 -0
- package/dist/middleware.js +15 -15
- package/dist/serve-sim.js +74 -30
- package/dist/simcam/libSimCameraInjector.dylib +0 -0
- package/dist/simcam/serve-sim-camera-helper +0 -0
- package/package.json +9 -2
- package/src/middleware.ts +17 -0
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "serve-sim",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.24",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Evan Bacon",
|
|
@@ -27,11 +27,18 @@
|
|
|
27
27
|
"dist/serve-sim.js",
|
|
28
28
|
"dist/middleware.js",
|
|
29
29
|
"dist/middleware.cjs",
|
|
30
|
+
"dist/simcam/libSimCameraInjector.dylib",
|
|
31
|
+
"dist/simcam/serve-sim-camera-helper",
|
|
30
32
|
"src/ax-shared.ts",
|
|
31
33
|
"src/ax.ts",
|
|
32
34
|
"src/middleware.ts",
|
|
33
35
|
"src/state.ts",
|
|
34
|
-
"bin/serve-sim-bin"
|
|
36
|
+
"bin/serve-sim-bin",
|
|
37
|
+
"Sources/SimCameraInjector/SimCameraInjector.m",
|
|
38
|
+
"Sources/SimCameraInjector/include/SimCamShared.h",
|
|
39
|
+
"Sources/SimCameraInjector/build.sh",
|
|
40
|
+
"Sources/SimCameraHelper/main.m",
|
|
41
|
+
"Sources/SimCameraHelper/build.sh"
|
|
35
42
|
],
|
|
36
43
|
"exports": {
|
|
37
44
|
"./middleware": {
|
package/src/middleware.ts
CHANGED
|
@@ -383,6 +383,19 @@ function bridgeWsHost(_reqHost: string | undefined, bridgePort: number): string
|
|
|
383
383
|
}
|
|
384
384
|
|
|
385
385
|
let _html: string | null = null;
|
|
386
|
+
/**
|
|
387
|
+
* Best-effort absolute path to the running serve-sim entry script. Used so
|
|
388
|
+
* the in-page Camera tool can `node <path> camera ...` regardless of PATH.
|
|
389
|
+
* Falls back to the literal `serve-sim` if we can't determine a usable path.
|
|
390
|
+
*/
|
|
391
|
+
function serveSimBinPath(): string {
|
|
392
|
+
try {
|
|
393
|
+
const argv = process.argv;
|
|
394
|
+
if (argv[1] && existsSync(argv[1])) return argv[1];
|
|
395
|
+
} catch {}
|
|
396
|
+
return "serve-sim";
|
|
397
|
+
}
|
|
398
|
+
|
|
386
399
|
function loadHtml(): string {
|
|
387
400
|
if (!_html) {
|
|
388
401
|
_html = Buffer.from(__PREVIEW_HTML_B64__, "base64").toString("utf-8");
|
|
@@ -642,6 +655,10 @@ export function simMiddleware(options?: SimMiddlewareOptions) {
|
|
|
642
655
|
appStateEndpoint: endpoint(base, "/appstate", state.device),
|
|
643
656
|
axEndpoint: endpoint(base, "/ax", state.device),
|
|
644
657
|
devtoolsEndpoint: endpoint(base, "/devtools", state.device),
|
|
658
|
+
// Forward the absolute path of the running serve-sim entry script
|
|
659
|
+
// so the in-page Camera tool can shell out via `node <bin> camera`
|
|
660
|
+
// without depending on `serve-sim` being on PATH.
|
|
661
|
+
serveSimBin: serveSimBinPath(),
|
|
645
662
|
gridApiEndpoint: gridApiBase,
|
|
646
663
|
gridStartEndpoint: gridApiBase + "/start",
|
|
647
664
|
gridShutdownEndpoint: gridApiBase + "/shutdown",
|