ziex 0.1.0-dev.1387 → 0.1.0-dev.1458
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 +4 -1
- package/app.d.ts +6 -6
- package/build.zig.zon +1 -1
- package/index.js +477 -169
- package/package.json +7 -5
- package/{aws-lambda → platforms/aws-lambda}/index.js +1 -1
- package/platforms/cloudflare/app.d.ts +2 -0
- package/platforms/cloudflare/db.d.ts +6 -0
- package/{cloudflare → platforms/cloudflare}/do.d.ts +5 -5
- package/platforms/cloudflare/index.d.ts +4 -0
- package/{cloudflare → platforms/cloudflare}/index.js +1666 -1293
- package/platforms/cloudflare/kv.d.ts +5 -0
- package/platforms/cloudflare/worker.d.ts +3 -0
- package/{vercel → platforms/vercel}/index.js +1 -1
- package/runtime/db/extern.d.ts +38 -0
- package/runtime/db/sqlite.d.ts +7 -0
- package/runtime/db.d.ts +3 -0
- package/runtime/db.js +419 -0
- package/{fetch.d.ts → runtime/fetch.d.ts} +1 -1
- package/{runtime.d.ts → runtime/index.d.ts} +6 -15
- package/runtime/kv/extern.d.ts +11 -0
- package/runtime/kv/indexdb.d.ts +7 -0
- package/runtime/kv/localstorage.d.ts +6 -0
- package/runtime/kv/memory.d.ts +6 -0
- package/runtime/kv.d.ts +44 -0
- package/runtime/kv.js +542 -0
- package/wasm/core.d.ts +29 -27
- package/wasm/index.d.ts +13 -12
- package/wasm/index.js +431 -240
- package/wasm/init.dev.js +407 -238
- package/wasm/init.js +3 -3
- package/wasm/wasi.d.ts +1 -5
- package/browser/kv.d.ts +0 -13
- package/cloudflare/app.d.ts +0 -2
- package/cloudflare/db.d.ts +0 -2
- package/cloudflare/index.d.ts +0 -4
- package/cloudflare/kv.d.ts +0 -2
- package/cloudflare/worker.d.ts +0 -3
- package/db.d.ts +0 -22
- package/kv.d.ts +0 -42
- /package/{aws-lambda → platforms/aws-lambda}/index.d.ts +0 -0
- /package/{vercel → platforms/vercel}/index.d.ts +0 -0
- /package/{wasi.d.ts → runtime/wasi.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -29,6 +29,9 @@ powershell -c "irm ziex.dev/install.ps1 | iex"
|
|
|
29
29
|
zx init
|
|
30
30
|
# or
|
|
31
31
|
npm init ziex
|
|
32
|
+
# or
|
|
33
|
+
git clone https://github.com/ziex-dev/template-starter my-app
|
|
34
|
+
cd my-app && zig build dev
|
|
32
35
|
```
|
|
33
36
|
|
|
34
37
|
You will need [compatible](#versions) Zig version when using zx CLI or you can use the `Node` template from `npm init ziex`
|
|
@@ -120,7 +123,7 @@ pub fn Playground(allocator: zx.Allocator) zx.Component {
|
|
|
120
123
|
// A Ziex Component is a Zig function that returns a `zx.Component`.
|
|
121
124
|
// It can have signatures like:
|
|
122
125
|
// - `pub fn ComponentName(allocator: zx.Allocator) zx.Component`
|
|
123
|
-
// - `pub fn ComponentName(ctx: *zx.ComponentCtx
|
|
126
|
+
// - `pub fn ComponentName(ctx: *zx.ComponentCtx(PropsType)) zx.Component`
|
|
124
127
|
// - `pub fn ComponentName(allocator: zx.Allocator, props: PropsType) zx.Component`
|
|
125
128
|
fn Profile(ctx: *zx.ComponentCtx(User)) zx.Component {
|
|
126
129
|
return (
|
package/app.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DurableObjectNamespace } from "./runtime";
|
|
2
|
-
import type { KVNamespace } from "./kv";
|
|
3
|
-
import type {
|
|
4
|
-
import type { WASI } from "./wasi";
|
|
2
|
+
import type { KVNamespace } from "./runtime/kv";
|
|
3
|
+
import type { Database } from "./runtime/db";
|
|
4
|
+
import type { WASI } from "./runtime/wasi";
|
|
5
5
|
/**
|
|
6
6
|
* Anything that can be resolved to a `WebAssembly.Module`:
|
|
7
7
|
* - `WebAssembly.Module` - already compiled (Cloudflare Workers, wrangler)
|
|
@@ -25,7 +25,7 @@ type DOKey<Env> = {
|
|
|
25
25
|
[K in keyof Env]: Env[K] extends DurableObjectNamespace ? K : never;
|
|
26
26
|
}[keyof Env];
|
|
27
27
|
type DBKey<Env> = {
|
|
28
|
-
[K in keyof Env]: Env[K] extends
|
|
28
|
+
[K in keyof Env]: Env[K] extends Database ? K : never;
|
|
29
29
|
}[keyof Env];
|
|
30
30
|
type ZiexOptions<Env> = {
|
|
31
31
|
/** WASM module - accepts any {@link WasmInput}. Resolved and cached on first request. */
|
|
@@ -33,7 +33,7 @@ type ZiexOptions<Env> = {
|
|
|
33
33
|
/** Optional pre-configured WASI instance. */
|
|
34
34
|
wasi?: WASI;
|
|
35
35
|
/** Extra WASM import namespaces. */
|
|
36
|
-
imports?: (mem: () => WebAssembly.Memory) =>
|
|
36
|
+
imports?: (mem: () => WebAssembly.Memory) => WebAssembly.Imports;
|
|
37
37
|
/**
|
|
38
38
|
* KV namespace bindings. Two forms are supported:
|
|
39
39
|
*
|
|
@@ -51,7 +51,7 @@ type ZiexOptions<Env> = {
|
|
|
51
51
|
*/
|
|
52
52
|
kv?: KVKey<Env> | Record<string, KVKey<Env>>;
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
54
|
+
* SQL database bindings (D1 / Postgres / etc. via the same interface). Same shape as `kv`:
|
|
55
55
|
*
|
|
56
56
|
* - `"DB"` maps `env.DB` to the `"default"` database binding.
|
|
57
57
|
* - `{ default: "DB", analytics: "ANALYTICS_DB" }` maps multiple bindings.
|