@ziex/cli 0.1.0-dev.866 → 0.1.0-dev.928
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 +19 -186
- package/bin/zx +25 -0
- package/package.json +12 -48
- package/app.d.ts +0 -112
- package/aws-lambda/index.d.ts +0 -96
- package/aws-lambda/index.js +0 -126
- package/bin/ziex +0 -61
- package/build.zig +0 -5
- package/build.zig.zon +0 -7
- package/cloudflare/app.d.ts +0 -2
- package/cloudflare/do.d.ts +0 -48
- package/cloudflare/index.d.ts +0 -4
- package/cloudflare/index.js +0 -1707
- package/cloudflare/kv.d.ts +0 -2
- package/cloudflare/worker.d.ts +0 -3
- package/index.d.ts +0 -2
- package/index.js +0 -739
- package/install.cjs +0 -218
- package/kv.d.ts +0 -27
- package/react/dom.d.ts +0 -21
- package/react/index.d.ts +0 -2
- package/react/index.js +0 -144
- package/react/types.d.ts +0 -190
- package/runtime.d.ts +0 -70
- package/vercel/index.d.ts +0 -26
- package/vercel/index.js +0 -18
- package/wasi.d.ts +0 -61
- package/wasm/core.d.ts +0 -78
- package/wasm/dom.d.ts +0 -4
- package/wasm/index.d.ts +0 -46
- package/wasm/index.js +0 -895
- package/wasm/init.d.ts +0 -1
- package/wasm/init.js +0 -873
- package/wasm/types.d.ts +0 -1
- package/wasm/wasi.d.ts +0 -28
- package/zx.d.ts +0 -1
package/bin/ziex
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// Stub that delegates to the native zx binary.
|
|
4
|
-
// The postinstall script copies it to bin/zx, but if that hasn't run
|
|
5
|
-
// (e.g. bunx), we resolve the platform package's binary directly.
|
|
6
|
-
|
|
7
|
-
import { execFileSync } from "child_process";
|
|
8
|
-
import { existsSync } from "fs";
|
|
9
|
-
import { createRequire } from "module";
|
|
10
|
-
import { dirname, join } from "path";
|
|
11
|
-
import { fileURLToPath } from "url";
|
|
12
|
-
|
|
13
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
14
|
-
const require = createRequire(import.meta.url);
|
|
15
|
-
const isWindows = process.platform === "win32";
|
|
16
|
-
const ext = isWindows ? ".exe" : "";
|
|
17
|
-
|
|
18
|
-
function findBinary() {
|
|
19
|
-
// 1. Check if postinstall already placed the binary
|
|
20
|
-
const localBin = join(__dirname, `zx${ext}`);
|
|
21
|
-
if (existsSync(localBin)) return localBin;
|
|
22
|
-
|
|
23
|
-
// 2. Resolve from the platform-specific optional dependency
|
|
24
|
-
const platformPkgs = {
|
|
25
|
-
"darwin-arm64": "@ziex/cli-darwin-arm64",
|
|
26
|
-
"darwin-x64": "@ziex/cli-darwin-x64",
|
|
27
|
-
"linux-x64": "@ziex/cli-linux-x64",
|
|
28
|
-
"linux-arm64": "@ziex/cli-linux-arm64",
|
|
29
|
-
"win32-x64": "@ziex/cli-win32-x64",
|
|
30
|
-
"win32-arm64": "@ziex/cli-win32-arm64",
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const pkg = platformPkgs[`${process.platform}-${process.arch}`];
|
|
34
|
-
if (pkg) {
|
|
35
|
-
try {
|
|
36
|
-
const pkgDir = dirname(require.resolve(`${pkg}/package.json`));
|
|
37
|
-
const bin = join(pkgDir, "bin", `zx${ext}`);
|
|
38
|
-
if (existsSync(bin)) return bin;
|
|
39
|
-
} catch {}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const bin = findBinary();
|
|
46
|
-
if (!bin) {
|
|
47
|
-
console.error(
|
|
48
|
-
"Error: ziex native binary not found. The postinstall script may not have run.",
|
|
49
|
-
);
|
|
50
|
-
console.error("Try reinstalling: npm install -g ziex");
|
|
51
|
-
process.exit(1);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
try {
|
|
55
|
-
execFileSync(bin, process.argv.slice(2), { stdio: "inherit" });
|
|
56
|
-
} catch (e) {
|
|
57
|
-
if (e.status !== undefined) {
|
|
58
|
-
process.exit(e.status);
|
|
59
|
-
}
|
|
60
|
-
throw e;
|
|
61
|
-
}
|
package/build.zig
DELETED
package/build.zig.zon
DELETED
package/cloudflare/app.d.ts
DELETED
package/cloudflare/do.d.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { WsState } from "../runtime";
|
|
2
|
-
import type { KVNamespace } from "../kv";
|
|
3
|
-
type ConnState = WsState & {
|
|
4
|
-
topics: Set<string>;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Create a Durable Object class that handles WebSocket connections for a ZX app.
|
|
8
|
-
*
|
|
9
|
-
* Each DO instance corresponds to one "room" (keyed by pathname). All clients
|
|
10
|
-
* connecting to the same route share a DO instance, enabling pub/sub via
|
|
11
|
-
* `ctx.socket.subscribe()` / `ctx.socket.publish()`.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```ts
|
|
15
|
-
* // worker.ts
|
|
16
|
-
* import { Ziex } from "ziex";
|
|
17
|
-
* import { createWebSocketDO } from "ziex/cloudflare";
|
|
18
|
-
* import module from "./app.wasm";
|
|
19
|
-
*
|
|
20
|
-
* export const ZxWS = createWebSocketDO(module);
|
|
21
|
-
*
|
|
22
|
-
* export default new Ziex({
|
|
23
|
-
* module,
|
|
24
|
-
* websocket: (env) => env.ZxWS,
|
|
25
|
-
* });
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export declare function createWebSocketDO(module: WebAssembly.Module, options?: {
|
|
29
|
-
/**
|
|
30
|
-
* KV namespace bindings for the DO. Pass a factory that receives the DO's
|
|
31
|
-
* `env` so bindings are resolved at runtime:
|
|
32
|
-
*
|
|
33
|
-
* ```ts
|
|
34
|
-
* createWebSocketDO(module, { kv: (env) => ({ default: env.KV }) })
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
kv?: (env: any) => Record<string, KVNamespace>;
|
|
38
|
-
imports?: (mem: () => WebAssembly.Memory) => Record<string, Record<string, unknown>>;
|
|
39
|
-
}): {
|
|
40
|
-
new (state: any, env: any): {
|
|
41
|
-
readonly doState: any;
|
|
42
|
-
readonly env: any;
|
|
43
|
-
/** All active connections in this room, keyed by their server-side WebSocket. */
|
|
44
|
-
readonly connections: Map<WebSocket, ConnState>;
|
|
45
|
-
fetch(request: Request): Promise<Response>;
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
export {};
|
package/cloudflare/index.d.ts
DELETED