@moku-labs/common 0.1.0 → 0.2.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/index.d.mts CHANGED
@@ -137,6 +137,12 @@ type LogApi = {
137
137
  */
138
138
  addSink(sink: LogSink): void; /** Clear all recorded entries while keeping registered sinks. */
139
139
  reset(): void;
140
+ /**
141
+ * Remove all registered output sinks. The in-memory trace (`entries`) is
142
+ * unaffected, so `trace()`/`expect()` keep working — used to replace the default
143
+ * console sink (e.g. a CLI plugin swapping in a branded sink from `@moku-labs/common/cli`).
144
+ */
145
+ clearSinks(): void;
140
146
  };
141
147
  //#endregion
142
148
  //#region src/plugins/log/index.d.ts
@@ -383,4 +389,4 @@ declare function processEnv(): EnvProvider;
383
389
  */
384
390
  declare function cloudflareBindings(): EnvProvider;
385
391
  //#endregion
386
- export { types_d_exports as Env, types_d_exports$1 as Log, browserEnv, cloudflareBindings, dotenv, envPlugin, logPlugin, processEnv };
392
+ export { types_d_exports as Env, type EnvApi, type EnvConfig, type EnvProvider, type EnvState, type EnvVarSpec, type ExpectChain, types_d_exports$1 as Log, type LogApi, type LogConfig, type LogEntry, type LogLevel, type LogSink, type LogState, browserEnv, cloudflareBindings, dotenv, envPlugin, logPlugin, processEnv };
package/dist/index.mjs CHANGED
@@ -394,6 +394,19 @@ function createLogApi(ctx) {
394
394
  */
395
395
  reset() {
396
396
  state.entries.length = 0;
397
+ },
398
+ /**
399
+ * Remove all registered output sinks; the in-memory trace (`entries`) is
400
+ * unaffected, so `trace()`/`expect()` keep working.
401
+ *
402
+ * @example
403
+ * ```ts
404
+ * log.clearSinks();
405
+ * log.addSink(brandedSink()); // from @moku-labs/common/cli
406
+ * ```
407
+ */
408
+ clearSinks() {
409
+ state.sinks.length = 0;
397
410
  }
398
411
  };
399
412
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moku-labs/common",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Shared framework plugins for the Moku family, built on @moku-labs/core.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -17,6 +17,16 @@
17
17
  "default": "./dist/index.cjs"
18
18
  }
19
19
  },
20
+ "./cli": {
21
+ "import": {
22
+ "types": "./dist/cli.d.mts",
23
+ "default": "./dist/cli.mjs"
24
+ },
25
+ "require": {
26
+ "types": "./dist/cli.d.cts",
27
+ "default": "./dist/cli.cjs"
28
+ }
29
+ },
20
30
  "./browser": {
21
31
  "import": {
22
32
  "types": "./dist/browser.d.mts",
@@ -25,8 +35,15 @@
25
35
  }
26
36
  },
27
37
  "sideEffects": false,
28
- "files": ["dist", "LICENSE", "README.md"],
29
- "engines": { "node": ">=24.0.0", "bun": ">=1.3.14" },
38
+ "files": [
39
+ "dist",
40
+ "LICENSE",
41
+ "README.md"
42
+ ],
43
+ "engines": {
44
+ "node": ">=24.0.0",
45
+ "bun": ">=1.3.14"
46
+ },
30
47
  "author": "Oleksandr Kucherenko",
31
48
  "license": "MIT",
32
49
  "repository": {
@@ -43,7 +60,8 @@
43
60
  "framework",
44
61
  "typescript",
45
62
  "logging",
46
- "env"
63
+ "env",
64
+ "cli"
47
65
  ],
48
66
  "publishConfig": {
49
67
  "access": "public",