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.
Files changed (43) hide show
  1. package/README.md +4 -1
  2. package/app.d.ts +6 -6
  3. package/build.zig.zon +1 -1
  4. package/index.js +477 -169
  5. package/package.json +7 -5
  6. package/{aws-lambda → platforms/aws-lambda}/index.js +1 -1
  7. package/platforms/cloudflare/app.d.ts +2 -0
  8. package/platforms/cloudflare/db.d.ts +6 -0
  9. package/{cloudflare → platforms/cloudflare}/do.d.ts +5 -5
  10. package/platforms/cloudflare/index.d.ts +4 -0
  11. package/{cloudflare → platforms/cloudflare}/index.js +1666 -1293
  12. package/platforms/cloudflare/kv.d.ts +5 -0
  13. package/platforms/cloudflare/worker.d.ts +3 -0
  14. package/{vercel → platforms/vercel}/index.js +1 -1
  15. package/runtime/db/extern.d.ts +38 -0
  16. package/runtime/db/sqlite.d.ts +7 -0
  17. package/runtime/db.d.ts +3 -0
  18. package/runtime/db.js +419 -0
  19. package/{fetch.d.ts → runtime/fetch.d.ts} +1 -1
  20. package/{runtime.d.ts → runtime/index.d.ts} +6 -15
  21. package/runtime/kv/extern.d.ts +11 -0
  22. package/runtime/kv/indexdb.d.ts +7 -0
  23. package/runtime/kv/localstorage.d.ts +6 -0
  24. package/runtime/kv/memory.d.ts +6 -0
  25. package/runtime/kv.d.ts +44 -0
  26. package/runtime/kv.js +542 -0
  27. package/wasm/core.d.ts +29 -27
  28. package/wasm/index.d.ts +13 -12
  29. package/wasm/index.js +431 -240
  30. package/wasm/init.dev.js +407 -238
  31. package/wasm/init.js +3 -3
  32. package/wasm/wasi.d.ts +1 -5
  33. package/browser/kv.d.ts +0 -13
  34. package/cloudflare/app.d.ts +0 -2
  35. package/cloudflare/db.d.ts +0 -2
  36. package/cloudflare/index.d.ts +0 -4
  37. package/cloudflare/kv.d.ts +0 -2
  38. package/cloudflare/worker.d.ts +0 -3
  39. package/db.d.ts +0 -22
  40. package/kv.d.ts +0 -42
  41. /package/{aws-lambda → platforms/aws-lambda}/index.d.ts +0 -0
  42. /package/{vercel → platforms/vercel}/index.d.ts +0 -0
  43. /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<PropsType>) zx.Component`
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 { D1Database } from "./db";
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 D1Database ? K : never;
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) => Record<string, Record<string, unknown>>;
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
- * D1 database bindings. Same shape as `kv`:
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.
package/build.zig.zon CHANGED
@@ -2,6 +2,6 @@
2
2
  .name = .ziex_js,
3
3
  .fingerprint = 3758452767932569023,
4
4
  .version = "0.1.0-dev",
5
- .minimum_zig_version = "0.17.0-dev.1158+1d1193aa7",
5
+ .minimum_zig_version = "0.17.0-dev.1465+8b2d0ce21",
6
6
  .paths = .{""},
7
7
  }