@moku-labs/worker 0.2.0 → 0.3.0

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/cli.cjs CHANGED
@@ -22,6 +22,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
22
  }) : target, mod));
23
23
  //#endregion
24
24
  const require_storage = require("./storage-CgXl-dUA.cjs");
25
+ let _moku_labs_common_cli = require("@moku-labs/common/cli");
25
26
  let node_child_process = require("node:child_process");
26
27
  let node_fs_promises = require("node:fs/promises");
27
28
  let node_path = require("node:path");
@@ -691,58 +692,59 @@ const createCliApi = (ctx) => ({
691
692
  //#endregion
692
693
  //#region src/plugins/cli/handlers.ts
693
694
  /**
694
- * Builds the hook handlers that turn global deploy events into a live progress TUI
695
- * via ctx.log. Pure observers print and return; never mutate state, never block
696
- * the deploy pipeline (fire-and-forget, spec/07 §3,§4).
695
+ * Builds the hook handlers that turn global deploy events into a live progress TUI.
696
+ * Each logs a clean, prefix-free message via `ctx.log`; the branded log sink (installed
697
+ * by the cli plugin's onInit from `@moku-labs/common/cli`) adds the `›` marker, brand
698
+ * color, and stderr routing. Pure observers — print and return; never mutate state,
699
+ * never block the deploy pipeline (fire-and-forget, spec/07 §3,§4).
697
700
  *
698
701
  * @param ctx - CLI plugin context with injected log core API.
699
702
  * @returns Hook map for the three global deploy events.
700
703
  * @example
701
704
  * ```ts
702
705
  * const hooks = createCliHooks(ctx);
703
- * hooks["deploy:phase"]({ phase: "detect" }); // logs "> detect"
704
- * hooks["provision:resource"]({ kind: "kv", name: "KV" }); // logs " + kv KV"
705
- * hooks["deploy:complete"]({ url: "https://x.workers.dev" }); // logs "done -> https://x.workers.dev"
706
+ * hooks["deploy:phase"]({ phase: "detect" }); // logs "detect" → renders " › detect"
707
+ * hooks["provision:resource"]({ kind: "kv", name: "KV" }); // logs "kv KV" → " kv KV"
708
+ * hooks["deploy:complete"]({ url: "https://x.workers.dev" }); // "deployed https://x.workers.dev"
706
709
  * ```
707
710
  */
708
711
  const createCliHooks = (ctx) => ({
709
712
  /**
710
- * Print one line per pipeline phase: "> phase" or "> phase - detail".
713
+ * Log one clean line per pipeline phase: "phase" or "phase · detail".
711
714
  *
712
715
  * @param p - The deploy:phase event payload.
713
716
  * @example
714
717
  * ```ts
715
- * handler({ phase: "detect" }); // "> detect"
716
- * handler({ phase: "upload", detail: "3 files" }); // "> upload - 3 files"
718
+ * handler({ phase: "detect" }); // "detect"
719
+ * handler({ phase: "upload", detail: "3 files" }); // "upload · 3 files"
717
720
  * ```
718
721
  */
719
722
  "deploy:phase"(p) {
720
- const detail = p.detail ? ` - ${p.detail}` : "";
721
- ctx.log.info(`> ${p.phase}${detail}`);
723
+ ctx.log.info(p.detail ? `${p.phase} · ${p.detail}` : p.phase);
722
724
  },
723
725
  /**
724
- * Print one indented line per provisioned resource: " + kind name".
726
+ * Log one clean line per provisioned resource: "kind name".
725
727
  *
726
728
  * @param p - The provision:resource event payload.
727
729
  * @example
728
730
  * ```ts
729
- * handler({ kind: "kv", name: "KV" }); // " + kv KV"
731
+ * handler({ kind: "kv", name: "KV" }); // "kv KV"
730
732
  * ```
731
733
  */
732
734
  "provision:resource"(p) {
733
- ctx.log.info(` + ${p.kind} ${p.name}`);
735
+ ctx.log.info(`${p.kind} ${p.name}`);
734
736
  },
735
737
  /**
736
- * Print the terminal success line with the deployed URL.
738
+ * Log the terminal success line with the deployed URL.
737
739
  *
738
740
  * @param p - The deploy:complete event payload.
739
741
  * @example
740
742
  * ```ts
741
- * handler({ url: "https://my-worker.workers.dev" }); // "done -> https://my-worker.workers.dev"
743
+ * handler({ url: "https://my-worker.workers.dev" }); // "deployed https://my-worker.workers.dev"
742
744
  * ```
743
745
  */
744
746
  "deploy:complete"(p) {
745
- ctx.log.info(`done -> ${p.url}`);
747
+ ctx.log.info(`deployed ${p.url}`);
746
748
  }
747
749
  });
748
750
  /**
@@ -760,6 +762,10 @@ const createCliHooks = (ctx) => ({
760
762
  const cliPlugin = require_storage.createPlugin("cli", {
761
763
  depends: [deployPlugin],
762
764
  config: { port: 8787 },
765
+ onInit: (ctx) => {
766
+ ctx.log.clearSinks();
767
+ ctx.log.addSink((0, _moku_labs_common_cli.brandedSink)("info"));
768
+ },
763
769
  api: (ctx) => createCliApi(ctx),
764
770
  hooks: (ctx) => createCliHooks(ctx)
765
771
  });
package/dist/cli.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  import { i as durableObjectsPlugin, n as queuesPlugin, o as d1Plugin, r as kvPlugin, t as storagePlugin, u as createPlugin } from "./storage-COo-F38H.mjs";
2
+ import { brandedSink } from "@moku-labs/common/cli";
2
3
  import { spawn } from "node:child_process";
3
4
  import { readdir, stat, writeFile } from "node:fs/promises";
4
5
  import path from "node:path";
@@ -667,58 +668,59 @@ const createCliApi = (ctx) => ({
667
668
  //#endregion
668
669
  //#region src/plugins/cli/handlers.ts
669
670
  /**
670
- * Builds the hook handlers that turn global deploy events into a live progress TUI
671
- * via ctx.log. Pure observers print and return; never mutate state, never block
672
- * the deploy pipeline (fire-and-forget, spec/07 §3,§4).
671
+ * Builds the hook handlers that turn global deploy events into a live progress TUI.
672
+ * Each logs a clean, prefix-free message via `ctx.log`; the branded log sink (installed
673
+ * by the cli plugin's onInit from `@moku-labs/common/cli`) adds the `›` marker, brand
674
+ * color, and stderr routing. Pure observers — print and return; never mutate state,
675
+ * never block the deploy pipeline (fire-and-forget, spec/07 §3,§4).
673
676
  *
674
677
  * @param ctx - CLI plugin context with injected log core API.
675
678
  * @returns Hook map for the three global deploy events.
676
679
  * @example
677
680
  * ```ts
678
681
  * const hooks = createCliHooks(ctx);
679
- * hooks["deploy:phase"]({ phase: "detect" }); // logs "> detect"
680
- * hooks["provision:resource"]({ kind: "kv", name: "KV" }); // logs " + kv KV"
681
- * hooks["deploy:complete"]({ url: "https://x.workers.dev" }); // logs "done -> https://x.workers.dev"
682
+ * hooks["deploy:phase"]({ phase: "detect" }); // logs "detect" → renders " › detect"
683
+ * hooks["provision:resource"]({ kind: "kv", name: "KV" }); // logs "kv KV" → " kv KV"
684
+ * hooks["deploy:complete"]({ url: "https://x.workers.dev" }); // "deployed https://x.workers.dev"
682
685
  * ```
683
686
  */
684
687
  const createCliHooks = (ctx) => ({
685
688
  /**
686
- * Print one line per pipeline phase: "> phase" or "> phase - detail".
689
+ * Log one clean line per pipeline phase: "phase" or "phase · detail".
687
690
  *
688
691
  * @param p - The deploy:phase event payload.
689
692
  * @example
690
693
  * ```ts
691
- * handler({ phase: "detect" }); // "> detect"
692
- * handler({ phase: "upload", detail: "3 files" }); // "> upload - 3 files"
694
+ * handler({ phase: "detect" }); // "detect"
695
+ * handler({ phase: "upload", detail: "3 files" }); // "upload · 3 files"
693
696
  * ```
694
697
  */
695
698
  "deploy:phase"(p) {
696
- const detail = p.detail ? ` - ${p.detail}` : "";
697
- ctx.log.info(`> ${p.phase}${detail}`);
699
+ ctx.log.info(p.detail ? `${p.phase} · ${p.detail}` : p.phase);
698
700
  },
699
701
  /**
700
- * Print one indented line per provisioned resource: " + kind name".
702
+ * Log one clean line per provisioned resource: "kind name".
701
703
  *
702
704
  * @param p - The provision:resource event payload.
703
705
  * @example
704
706
  * ```ts
705
- * handler({ kind: "kv", name: "KV" }); // " + kv KV"
707
+ * handler({ kind: "kv", name: "KV" }); // "kv KV"
706
708
  * ```
707
709
  */
708
710
  "provision:resource"(p) {
709
- ctx.log.info(` + ${p.kind} ${p.name}`);
711
+ ctx.log.info(`${p.kind} ${p.name}`);
710
712
  },
711
713
  /**
712
- * Print the terminal success line with the deployed URL.
714
+ * Log the terminal success line with the deployed URL.
713
715
  *
714
716
  * @param p - The deploy:complete event payload.
715
717
  * @example
716
718
  * ```ts
717
- * handler({ url: "https://my-worker.workers.dev" }); // "done -> https://my-worker.workers.dev"
719
+ * handler({ url: "https://my-worker.workers.dev" }); // "deployed https://my-worker.workers.dev"
718
720
  * ```
719
721
  */
720
722
  "deploy:complete"(p) {
721
- ctx.log.info(`done -> ${p.url}`);
723
+ ctx.log.info(`deployed ${p.url}`);
722
724
  }
723
725
  });
724
726
  /**
@@ -736,6 +738,10 @@ const createCliHooks = (ctx) => ({
736
738
  const cliPlugin = createPlugin("cli", {
737
739
  depends: [deployPlugin],
738
740
  config: { port: 8787 },
741
+ onInit: (ctx) => {
742
+ ctx.log.clearSinks();
743
+ ctx.log.addSink(brandedSink("info"));
744
+ },
739
745
  api: (ctx) => createCliApi(ctx),
740
746
  hooks: (ctx) => createCliHooks(ctx)
741
747
  });
@@ -0,0 +1,63 @@
1
+ import { PluginCtx } from "@moku-labs/core";
2
+
3
+ //#region src/config.d.ts
4
+ /** Per-request Cloudflare bindings object (env). Framework-level shared type. */
5
+ type WorkerEnv = Record<string, unknown>;
6
+ /** Global framework config — flat, with complete defaults. */
7
+ type WorkerConfig = {
8
+ stage: "production" | "development" | "test";
9
+ name: string;
10
+ compatibilityDate: string;
11
+ };
12
+ /** Global framework events — declared once, visible to every plugin. */
13
+ type WorkerEvents = {
14
+ "request:start": {
15
+ method: string;
16
+ path: string;
17
+ requestId: string;
18
+ };
19
+ "request:end": {
20
+ method: string;
21
+ path: string;
22
+ status: number;
23
+ ms: number;
24
+ };
25
+ "deploy:phase": {
26
+ phase: string;
27
+ detail?: string;
28
+ };
29
+ "deploy:complete": {
30
+ url: string;
31
+ };
32
+ "provision:resource": {
33
+ kind: "kv" | "r2" | "d1" | "queue" | "do";
34
+ name: string;
35
+ };
36
+ };
37
+ /**
38
+ * Worker-bound plugin context for Layer-3 consumer plugins. Aliases the core
39
+ * {@link PluginCtx} with the global {@link WorkerEvents} pre-merged into the event
40
+ * map, so a consumer plugin types its own `config`/`state`/`emit` by passing only
41
+ * its OWN event map — never hand-merging `WorkerEvents`, and never importing from
42
+ * `@moku-labs/core` (a Layer-1 boundary the spec validator flags for consumers).
43
+ *
44
+ * A plugin that resolves sibling plugins also needs a `require` field; intersect the
45
+ * public `Server.RequireFn` for it, exactly as this framework's own plugins do. When
46
+ * you need the unaliased shape (e.g. a different global event map), use the raw
47
+ * re-exported {@link PluginCtx} instead.
48
+ *
49
+ * @template Config - This plugin's own flat configuration object.
50
+ * @template State - This plugin's mutable state (use `Record<string, never>` when stateless).
51
+ * @template Events - This plugin's own event map, merged on top of {@link WorkerEvents}; defaults to none.
52
+ * @example
53
+ * ```typescript
54
+ * import type { Server, WorkerPluginCtx } from "@moku-labs/worker";
55
+ * type MyEvents = { "my:done": { id: string } };
56
+ * export type MyCtx = WorkerPluginCtx<MyConfig, Record<string, never>, MyEvents> & {
57
+ * require: Server.RequireFn;
58
+ * };
59
+ * ```
60
+ */
61
+ type WorkerPluginCtx<Config, State, Events extends Record<string, unknown> = Record<never, never>> = PluginCtx<Config, State, WorkerEvents & Events>;
62
+ //#endregion
63
+ export { WorkerPluginCtx as i, WorkerEnv as n, WorkerEvents as r, WorkerConfig as t };
@@ -0,0 +1,63 @@
1
+ import { PluginCtx } from "@moku-labs/core";
2
+
3
+ //#region src/config.d.ts
4
+ /** Per-request Cloudflare bindings object (env). Framework-level shared type. */
5
+ type WorkerEnv = Record<string, unknown>;
6
+ /** Global framework config — flat, with complete defaults. */
7
+ type WorkerConfig = {
8
+ stage: "production" | "development" | "test";
9
+ name: string;
10
+ compatibilityDate: string;
11
+ };
12
+ /** Global framework events — declared once, visible to every plugin. */
13
+ type WorkerEvents = {
14
+ "request:start": {
15
+ method: string;
16
+ path: string;
17
+ requestId: string;
18
+ };
19
+ "request:end": {
20
+ method: string;
21
+ path: string;
22
+ status: number;
23
+ ms: number;
24
+ };
25
+ "deploy:phase": {
26
+ phase: string;
27
+ detail?: string;
28
+ };
29
+ "deploy:complete": {
30
+ url: string;
31
+ };
32
+ "provision:resource": {
33
+ kind: "kv" | "r2" | "d1" | "queue" | "do";
34
+ name: string;
35
+ };
36
+ };
37
+ /**
38
+ * Worker-bound plugin context for Layer-3 consumer plugins. Aliases the core
39
+ * {@link PluginCtx} with the global {@link WorkerEvents} pre-merged into the event
40
+ * map, so a consumer plugin types its own `config`/`state`/`emit` by passing only
41
+ * its OWN event map — never hand-merging `WorkerEvents`, and never importing from
42
+ * `@moku-labs/core` (a Layer-1 boundary the spec validator flags for consumers).
43
+ *
44
+ * A plugin that resolves sibling plugins also needs a `require` field; intersect the
45
+ * public `Server.RequireFn` for it, exactly as this framework's own plugins do. When
46
+ * you need the unaliased shape (e.g. a different global event map), use the raw
47
+ * re-exported {@link PluginCtx} instead.
48
+ *
49
+ * @template Config - This plugin's own flat configuration object.
50
+ * @template State - This plugin's mutable state (use `Record<string, never>` when stateless).
51
+ * @template Events - This plugin's own event map, merged on top of {@link WorkerEvents}; defaults to none.
52
+ * @example
53
+ * ```typescript
54
+ * import type { Server, WorkerPluginCtx } from "@moku-labs/worker";
55
+ * type MyEvents = { "my:done": { id: string } };
56
+ * export type MyCtx = WorkerPluginCtx<MyConfig, Record<string, never>, MyEvents> & {
57
+ * require: Server.RequireFn;
58
+ * };
59
+ * ```
60
+ */
61
+ type WorkerPluginCtx<Config, State, Events extends Record<string, unknown> = Record<never, never>> = PluginCtx<Config, State, WorkerEvents & Events>;
62
+ //#endregion
63
+ export { WorkerPluginCtx as i, WorkerEnv as n, WorkerEvents as r, WorkerConfig as t };
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { n as WorkerEnv, r as WorkerEvents, t as WorkerConfig } from "./config-AjH57AmD.cjs";
2
- import { PluginCtx, PluginInstance } from "@moku-labs/core";
1
+ import { i as WorkerPluginCtx, n as WorkerEnv, r as WorkerEvents, t as WorkerConfig } from "./config-Bj3GUJT_.cjs";
2
+ import { PluginCtx, PluginCtx as PluginCtx$1, PluginInstance } from "@moku-labs/core";
3
3
  import { envPlugin, logPlugin } from "@moku-labs/common";
4
4
 
5
5
  //#region \0rolldown/runtime.js
@@ -50,7 +50,7 @@ type BindingsApi = {
50
50
  * api-factory context. State slot is Record<string, never> — bindings holds NO
51
51
  * state (F4). Type-argument order is PluginCtx<Config, State, Events>.
52
52
  */
53
- type Context = PluginCtx<Config$4, Record<string, never>, WorkerEvents>;
53
+ type Context = PluginCtx$1<Config$4, Record<string, never>, WorkerEvents>;
54
54
  //#endregion
55
55
  //#region src/plugins/bindings/index.d.ts
56
56
  /**
@@ -186,7 +186,7 @@ type ServerEvents = {
186
186
  };
187
187
  };
188
188
  /** Full server plugin context (own config + state + merged events + cross-plugin reach). */
189
- type ServerCtx = PluginCtx<ServerConfig, ServerState, WorkerEvents & ServerEvents> & {
189
+ type ServerCtx = PluginCtx$1<ServerConfig, ServerState, WorkerEvents & ServerEvents> & {
190
190
  /** Cross-plugin require threaded into each RequestContext. */require: RequireFn; /** Presence check for an optional plugin. */
191
191
  has: (name: string) => boolean;
192
192
  };
@@ -417,7 +417,7 @@ type Api$2 = {
417
417
  * Internal context type — own config first, no state, no d1-local events.
418
418
  * Intersected with a narrow `require` typed to the one dependency d1 resolves.
419
419
  */
420
- type D1Ctx = PluginCtx<Config$3, Record<string, never>, WorkerEvents> & {
420
+ type D1Ctx = PluginCtx$1<Config$3, Record<string, never>, WorkerEvents> & {
421
421
  /**
422
422
  * Resolve a dependency plugin's api. d1 only ever resolves `bindingsPlugin`.
423
423
  *
@@ -493,7 +493,7 @@ type Api$1 = {
493
493
  * Internal context type — own config first, no state, no DO events.
494
494
  * Intersected with a narrow `require` typed to the one dependency durableObjects resolves.
495
495
  */
496
- type Ctx$1 = PluginCtx<Config$2, Record<string, never>, WorkerEvents> & {
496
+ type Ctx$1 = PluginCtx$1<Config$2, Record<string, never>, WorkerEvents> & {
497
497
  /**
498
498
  * Resolve a dependency plugin's api. durableObjects only ever resolves `bindingsPlugin`.
499
499
  *
@@ -732,7 +732,7 @@ type Api = {
732
732
  * (core's "advanced composition" note), typed to the one dependency queues resolves —
733
733
  * `require(bindingsPlugin)` → `BindingsApi`. Core does not export `RequireFunction`.
734
734
  */
735
- type Ctx = PluginCtx<Config$1, Record<string, never>, WorkerEvents & QueueEvents> & {
735
+ type Ctx = PluginCtx$1<Config$1, Record<string, never>, WorkerEvents & QueueEvents> & {
736
736
  /**
737
737
  * Resolve a dependency plugin's api. queues only ever resolves `bindingsPlugin`.
738
738
  *
@@ -878,7 +878,7 @@ type StorageApi = {
878
878
  * resolves — mirrors the kv/api.ts pattern (PluginCtx has no `require` by
879
879
  * default; core does not export a generic RequireFunction).
880
880
  */
881
- type StorageCtx = PluginCtx<StorageConfig, Record<string, never>, WorkerEvents> & {
881
+ type StorageCtx = PluginCtx$1<StorageConfig, Record<string, never>, WorkerEvents> & {
882
882
  /**
883
883
  * Resolve a dependency plugin's api. storage only ever resolves bindingsPlugin.
884
884
  *
@@ -1028,4 +1028,4 @@ declare const createApp: <const ExtraPlugins extends readonly import("@moku-labs
1028
1028
  current: () => "production" | "development" | "test";
1029
1029
  }>]>>;
1030
1030
  //#endregion
1031
- export { type types_d_exports as Bindings, type types_d_exports$1 as D1, type types_d_exports$2 as DurableObjects, type types_d_exports$3 as Queues, type types_d_exports$4 as Server, type StageApi, type types_d_exports$5 as Storage, type WorkerConfig, type WorkerEnv, type WorkerEvents, bindingsPlugin, createApp, createPlugin, d1Plugin, defineDurableObject, durableObjectsPlugin, endpoint, envPlugin, kvPlugin, logPlugin, queuesPlugin, serverPlugin, stagePlugin, storagePlugin };
1031
+ export { type types_d_exports as Bindings, type types_d_exports$1 as D1, type types_d_exports$2 as DurableObjects, type PluginCtx, type types_d_exports$3 as Queues, type types_d_exports$4 as Server, type StageApi, type types_d_exports$5 as Storage, type WorkerConfig, type WorkerEnv, type WorkerEvents, type WorkerPluginCtx, bindingsPlugin, createApp, createPlugin, d1Plugin, defineDurableObject, durableObjectsPlugin, endpoint, envPlugin, kvPlugin, logPlugin, queuesPlugin, serverPlugin, stagePlugin, storagePlugin };
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { n as WorkerEnv, r as WorkerEvents, t as WorkerConfig } from "./config-AjH57AmD.mjs";
1
+ import { i as WorkerPluginCtx, n as WorkerEnv, r as WorkerEvents, t as WorkerConfig } from "./config-Bj3GUJT_.mjs";
2
2
  import { envPlugin, logPlugin } from "@moku-labs/common";
3
- import { PluginCtx, PluginInstance } from "@moku-labs/core";
3
+ import { PluginCtx, PluginCtx as PluginCtx$1, PluginInstance } from "@moku-labs/core";
4
4
 
5
5
  //#region \0rolldown/runtime.js
6
6
  declare namespace types_d_exports {
@@ -50,7 +50,7 @@ type BindingsApi = {
50
50
  * api-factory context. State slot is Record<string, never> — bindings holds NO
51
51
  * state (F4). Type-argument order is PluginCtx<Config, State, Events>.
52
52
  */
53
- type Context = PluginCtx<Config$4, Record<string, never>, WorkerEvents>;
53
+ type Context = PluginCtx$1<Config$4, Record<string, never>, WorkerEvents>;
54
54
  //#endregion
55
55
  //#region src/plugins/bindings/index.d.ts
56
56
  /**
@@ -186,7 +186,7 @@ type ServerEvents = {
186
186
  };
187
187
  };
188
188
  /** Full server plugin context (own config + state + merged events + cross-plugin reach). */
189
- type ServerCtx = PluginCtx<ServerConfig, ServerState, WorkerEvents & ServerEvents> & {
189
+ type ServerCtx = PluginCtx$1<ServerConfig, ServerState, WorkerEvents & ServerEvents> & {
190
190
  /** Cross-plugin require threaded into each RequestContext. */require: RequireFn; /** Presence check for an optional plugin. */
191
191
  has: (name: string) => boolean;
192
192
  };
@@ -417,7 +417,7 @@ type Api$2 = {
417
417
  * Internal context type — own config first, no state, no d1-local events.
418
418
  * Intersected with a narrow `require` typed to the one dependency d1 resolves.
419
419
  */
420
- type D1Ctx = PluginCtx<Config$3, Record<string, never>, WorkerEvents> & {
420
+ type D1Ctx = PluginCtx$1<Config$3, Record<string, never>, WorkerEvents> & {
421
421
  /**
422
422
  * Resolve a dependency plugin's api. d1 only ever resolves `bindingsPlugin`.
423
423
  *
@@ -493,7 +493,7 @@ type Api$1 = {
493
493
  * Internal context type — own config first, no state, no DO events.
494
494
  * Intersected with a narrow `require` typed to the one dependency durableObjects resolves.
495
495
  */
496
- type Ctx$1 = PluginCtx<Config$2, Record<string, never>, WorkerEvents> & {
496
+ type Ctx$1 = PluginCtx$1<Config$2, Record<string, never>, WorkerEvents> & {
497
497
  /**
498
498
  * Resolve a dependency plugin's api. durableObjects only ever resolves `bindingsPlugin`.
499
499
  *
@@ -732,7 +732,7 @@ type Api = {
732
732
  * (core's "advanced composition" note), typed to the one dependency queues resolves —
733
733
  * `require(bindingsPlugin)` → `BindingsApi`. Core does not export `RequireFunction`.
734
734
  */
735
- type Ctx = PluginCtx<Config$1, Record<string, never>, WorkerEvents & QueueEvents> & {
735
+ type Ctx = PluginCtx$1<Config$1, Record<string, never>, WorkerEvents & QueueEvents> & {
736
736
  /**
737
737
  * Resolve a dependency plugin's api. queues only ever resolves `bindingsPlugin`.
738
738
  *
@@ -878,7 +878,7 @@ type StorageApi = {
878
878
  * resolves — mirrors the kv/api.ts pattern (PluginCtx has no `require` by
879
879
  * default; core does not export a generic RequireFunction).
880
880
  */
881
- type StorageCtx = PluginCtx<StorageConfig, Record<string, never>, WorkerEvents> & {
881
+ type StorageCtx = PluginCtx$1<StorageConfig, Record<string, never>, WorkerEvents> & {
882
882
  /**
883
883
  * Resolve a dependency plugin's api. storage only ever resolves bindingsPlugin.
884
884
  *
@@ -1028,4 +1028,4 @@ declare const createApp: <const ExtraPlugins extends readonly import("@moku-labs
1028
1028
  current: () => "production" | "development" | "test";
1029
1029
  }>]>>;
1030
1030
  //#endregion
1031
- export { type types_d_exports as Bindings, type types_d_exports$1 as D1, type types_d_exports$2 as DurableObjects, type types_d_exports$3 as Queues, type types_d_exports$4 as Server, type StageApi, type types_d_exports$5 as Storage, type WorkerConfig, type WorkerEnv, type WorkerEvents, bindingsPlugin, createApp, createPlugin, d1Plugin, defineDurableObject, durableObjectsPlugin, endpoint, envPlugin, kvPlugin, logPlugin, queuesPlugin, serverPlugin, stagePlugin, storagePlugin };
1031
+ export { type types_d_exports as Bindings, type types_d_exports$1 as D1, type types_d_exports$2 as DurableObjects, type PluginCtx, type types_d_exports$3 as Queues, type types_d_exports$4 as Server, type StageApi, type types_d_exports$5 as Storage, type WorkerConfig, type WorkerEnv, type WorkerEvents, type WorkerPluginCtx, bindingsPlugin, createApp, createPlugin, d1Plugin, defineDurableObject, durableObjectsPlugin, endpoint, envPlugin, kvPlugin, logPlugin, queuesPlugin, serverPlugin, stagePlugin, storagePlugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moku-labs/worker",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Cloudflare Worker framework for Moku — Durable Objects, Queues, R2, D1, and KV plugins that compose with Moku Web.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -62,7 +62,7 @@
62
62
  "test:coverage": "vitest run --project unit --project integration --coverage"
63
63
  },
64
64
  "dependencies": {
65
- "@moku-labs/common": "0.1.1",
65
+ "@moku-labs/common": "0.2.0",
66
66
  "@moku-labs/core": "0.1.4"
67
67
  },
68
68
  "devDependencies": {
@@ -1,36 +0,0 @@
1
- //#region src/config.d.ts
2
- /** Per-request Cloudflare bindings object (env). Framework-level shared type. */
3
- type WorkerEnv = Record<string, unknown>;
4
- /** Global framework config — flat, with complete defaults. */
5
- type WorkerConfig = {
6
- stage: "production" | "development" | "test";
7
- name: string;
8
- compatibilityDate: string;
9
- };
10
- /** Global framework events — declared once, visible to every plugin. */
11
- type WorkerEvents = {
12
- "request:start": {
13
- method: string;
14
- path: string;
15
- requestId: string;
16
- };
17
- "request:end": {
18
- method: string;
19
- path: string;
20
- status: number;
21
- ms: number;
22
- };
23
- "deploy:phase": {
24
- phase: string;
25
- detail?: string;
26
- };
27
- "deploy:complete": {
28
- url: string;
29
- };
30
- "provision:resource": {
31
- kind: "kv" | "r2" | "d1" | "queue" | "do";
32
- name: string;
33
- };
34
- };
35
- //#endregion
36
- export { WorkerEnv as n, WorkerEvents as r, WorkerConfig as t };
@@ -1,36 +0,0 @@
1
- //#region src/config.d.ts
2
- /** Per-request Cloudflare bindings object (env). Framework-level shared type. */
3
- type WorkerEnv = Record<string, unknown>;
4
- /** Global framework config — flat, with complete defaults. */
5
- type WorkerConfig = {
6
- stage: "production" | "development" | "test";
7
- name: string;
8
- compatibilityDate: string;
9
- };
10
- /** Global framework events — declared once, visible to every plugin. */
11
- type WorkerEvents = {
12
- "request:start": {
13
- method: string;
14
- path: string;
15
- requestId: string;
16
- };
17
- "request:end": {
18
- method: string;
19
- path: string;
20
- status: number;
21
- ms: number;
22
- };
23
- "deploy:phase": {
24
- phase: string;
25
- detail?: string;
26
- };
27
- "deploy:complete": {
28
- url: string;
29
- };
30
- "provision:resource": {
31
- kind: "kv" | "r2" | "d1" | "queue" | "do";
32
- name: string;
33
- };
34
- };
35
- //#endregion
36
- export { WorkerEnv as n, WorkerEvents as r, WorkerConfig as t };