@zusehq/serve 0.1.4 → 0.1.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.
package/dist/bin.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as runServeCli } from "./cli-
|
|
2
|
+
import { t as runServeCli } from "./cli-BKZzhoKT.mjs";
|
|
3
3
|
//#region src/bin.ts
|
|
4
4
|
runServeCli(process.argv.slice(2), process.env).catch((cause) => {
|
|
5
5
|
console.error(cause instanceof Error ? cause.message : String(cause));
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { readFile, stat } from "node:fs/promises";
|
|
3
|
+
import { homedir } from "node:os";
|
|
3
4
|
import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
4
5
|
import { Data, Effect, Layer, ManagedRuntime, Schema, Scope, Struct } from "effect";
|
|
5
6
|
import { Rpc, RpcClient, RpcGroup, RpcSerialization } from "effect/unstable/rpc";
|
|
6
7
|
import { Socket } from "effect/unstable/socket";
|
|
7
8
|
//#region package.json
|
|
8
|
-
var version = "0.1.
|
|
9
|
+
var version = "0.1.5";
|
|
9
10
|
//#endregion
|
|
10
11
|
//#region ../client-runtime/src/connection.ts
|
|
11
12
|
var WireProtocolMismatchError = class extends Data.TaggedError("WireProtocolMismatchError") {};
|
|
@@ -8259,9 +8260,16 @@ const promptFor = async (args, message = false) => {
|
|
|
8259
8260
|
if (file === void 0) return "";
|
|
8260
8261
|
return file === "-" ? readStdin() : readFile(resolve(file), "utf8");
|
|
8261
8262
|
};
|
|
8262
|
-
const
|
|
8263
|
+
const installedCliAccessCandidates = (env, platform = process.platform) => {
|
|
8264
|
+
const configured = env.ZUSE_USER_DATA_DIR?.trim();
|
|
8265
|
+
if (configured) return [join(resolve(configured), "cli-access.json")];
|
|
8266
|
+
if (platform === "darwin") return [join(homedir(), "Library", "Application Support", "Zuse Alpha", "cli-access.json")];
|
|
8267
|
+
if (platform === "win32" && env.APPDATA?.trim()) return [join(resolve(env.APPDATA), "Zuse Alpha", "cli-access.json")];
|
|
8268
|
+
return [join(resolve(env.XDG_CONFIG_HOME?.trim() || join(homedir(), ".config")), "Zuse Alpha", "cli-access.json")];
|
|
8269
|
+
};
|
|
8270
|
+
const localCliAccess = async (env) => {
|
|
8263
8271
|
const explicit = env.ZUSE_DEV_CLI_ACCESS_FILE?.trim();
|
|
8264
|
-
const candidates = explicit ? [resolve(explicit)] : [];
|
|
8272
|
+
const candidates = explicit ? [resolve(explicit)] : [...installedCliAccessCandidates(env)];
|
|
8265
8273
|
let cursor = resolve(process.cwd());
|
|
8266
8274
|
while (true) {
|
|
8267
8275
|
const instance = env.ZUSE_DEV_INSTANCE?.trim() || "default";
|
|
@@ -8279,7 +8287,7 @@ const devCliAccess = async (env) => {
|
|
|
8279
8287
|
const endpoint = async (args, env) => {
|
|
8280
8288
|
const computer = one(args, "computer") ?? "local";
|
|
8281
8289
|
if (computer !== "local" && one(args, "ws-url") === void 0) throw new CliError("computer_unavailable", "A connected computer requires --ws-url and, when protected, --token.", { computer });
|
|
8282
|
-
const access = one(args, "ws-url") === void 0 && env.ZUSE_WS_URL === void 0 ? await
|
|
8290
|
+
const access = one(args, "ws-url") === void 0 && env.ZUSE_WS_URL === void 0 ? await localCliAccess(env) : null;
|
|
8283
8291
|
const raw = one(args, "ws-url") ?? env.ZUSE_WS_URL ?? access?.wsUrl ?? `ws://127.0.0.1:${env.ZUSE_PORT ?? "47837"}/rpc`;
|
|
8284
8292
|
const url = new URL(raw);
|
|
8285
8293
|
if (url.pathname === "/") url.pathname = "/rpc";
|
|
@@ -8913,4 +8921,4 @@ const runServeCli = async (argv, env = process.env) => {
|
|
|
8913
8921
|
//#endregion
|
|
8914
8922
|
export { runServeCli as t };
|
|
8915
8923
|
|
|
8916
|
-
//# sourceMappingURL=cli-
|
|
8924
|
+
//# sourceMappingURL=cli-BKZzhoKT.mjs.map
|