@trebired/logger 2.5.9 → 2.5.12
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/CHANGELOG.md +13 -0
- package/README.md +265 -247
- package/dist/package-metadata.d.ts.map +1 -1
- package/dist/package-metadata.js +24 -4
- package/dist/package-metadata.js.map +1 -1
- package/dist/storage/partitions/files.d.ts.map +1 -1
- package/dist/storage/partitions/files.js.map +1 -1
- package/dist/storage/partitions/public.d.ts.map +1 -1
- package/dist/storage/partitions/public.js.map +1 -1
- package/package.json +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,19 @@ All notable changes to `@trebired/logger` will be documented here.
|
|
|
4
4
|
|
|
5
5
|
This project follows semantic versioning once published.
|
|
6
6
|
|
|
7
|
+
## 2.5.12
|
|
8
|
+
|
|
9
|
+
- Updated Code Discipline configuration to the `imports` rule with dead import removal enabled.
|
|
10
|
+
- Updated logger package metadata fallback so package-owned notices stay under the organization root when package metadata is unavailable.
|
|
11
|
+
- Updated internal package dependency ranges to the current published sibling releases.
|
|
12
|
+
|
|
13
|
+
## 2.5.11
|
|
14
|
+
|
|
15
|
+
- Fixed a broken published-package build: a fresh checkout has no committed `.code-discipline/generated/` output, and nothing regenerated it before `typecheck`/`build`, so every internal `#hash` import failed to resolve. `typecheck` and `build` now run `prepare:generated` first.
|
|
16
|
+
- Standardized package metadata (author field, config-driven organization name, dropped the Node engine constraint) and migrated `.code-discipline/config.ts` to `defineCodeDisciplineConfig`.
|
|
17
|
+
- Normalized README structure and removed the license footer.
|
|
18
|
+
- Updated the `@trebired/code-discipline` devDependency to 4.8.0.
|
|
19
|
+
|
|
7
20
|
## 2.5.9
|
|
8
21
|
|
|
9
22
|
- Added package-owned organization metadata and derived logger package notices from `package.json`.
|
package/README.md
CHANGED
|
@@ -6,28 +6,14 @@ Local-first JSONL logger with human-browsable group folders, durable writes, ret
|
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
9
|
-
Runtime support: Bun 1
|
|
10
|
-
|
|
11
|
-
The package can use bundled native binaries for supported Linux and macOS targets to speed up large storage/export workloads. Consumers still install a single package:
|
|
12
|
-
|
|
13
|
-
```txt
|
|
14
|
-
@trebired/logger
|
|
15
|
-
dist/
|
|
16
|
-
native/
|
|
17
|
-
linux-x64-gnu.node
|
|
18
|
-
linux-arm64-gnu.node
|
|
19
|
-
darwin-arm64.node
|
|
20
|
-
darwin-x64.node
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
At runtime the JS wrapper always tries the matching `.node` file first when one is bundled for the current platform, and falls back to the built-in JS backend if native loading is unavailable or fails. Bundled native binaries are currently published for Linux GNU (`x64` and `arm64`) and macOS targets. End users do not need Rust installed.
|
|
24
|
-
|
|
25
|
-
Set `TB_LOGGER_DISABLE_NATIVE=1` only when you explicitly want to force the JS backend.
|
|
9
|
+
Runtime support: Bun 1+.
|
|
26
10
|
|
|
27
11
|
```sh
|
|
28
|
-
|
|
12
|
+
bun i @trebired/logger
|
|
29
13
|
```
|
|
30
14
|
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
31
17
|
```ts
|
|
32
18
|
import { createLog } from "@trebired/logger";
|
|
33
19
|
|
|
@@ -48,58 +34,9 @@ import { createBrowserLog } from "@trebired/logger/browser";
|
|
|
48
34
|
import { LogProvider, useLog } from "@trebired/logger/browser/react";
|
|
49
35
|
```
|
|
50
36
|
|
|
51
|
-
##
|
|
52
|
-
|
|
53
|
-
Use `@trebired/logger/browser` when you want the same levels, metadata conventions, grouping rules, and scoped logger behavior in browser code:
|
|
54
|
-
|
|
55
|
-
```ts
|
|
56
|
-
import { createBrowserLog } from "@trebired/logger/browser";
|
|
57
|
-
|
|
58
|
-
const log = createBrowserLog({
|
|
59
|
-
group: "frontend.app",
|
|
60
|
-
metadata: {
|
|
61
|
-
deploymentId: "deploy-42",
|
|
62
|
-
requestId: "req-abc",
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
log.info("frontend boot");
|
|
67
|
-
await log.flush();
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
The first browser release ships with console delivery built in. It also supports custom browser transports with in-memory batching so you can add fetch, beacon, websocket, or other delivery later without changing the logger API.
|
|
71
|
-
|
|
72
|
-
There is no built-in SSR bootstrap helper in this release. If you want browser correlation data such as `requestId`, `sessionId`, or `deploymentId`, pass it explicitly through `metadata` or per-log metadata.
|
|
73
|
-
|
|
74
|
-
## React Adapter
|
|
75
|
-
|
|
76
|
-
`@trebired/logger/browser/react` is intentionally thin. It does not create a logger for you. It only helps wire an existing browser logger into React context:
|
|
77
|
-
|
|
78
|
-
```tsx
|
|
79
|
-
import { createRoot } from "react-dom/client";
|
|
80
|
-
import { createBrowserLog } from "@trebired/logger/browser";
|
|
81
|
-
import { LogProvider, useLog } from "@trebired/logger/browser/react";
|
|
82
|
-
|
|
83
|
-
const log = createBrowserLog({
|
|
84
|
-
group: "frontend.app",
|
|
85
|
-
metadata: { deploymentId: "deploy-42" },
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
function SaveButton() {
|
|
89
|
-
const scopedLog = useLog("ui.save_button");
|
|
90
|
-
return <button onClick={() => scopedLog.info("clicked")}>Save</button>;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
createRoot(document.getElementById("root")!).render(
|
|
94
|
-
<LogProvider log={log}>
|
|
95
|
-
<SaveButton />
|
|
96
|
-
</LogProvider>,
|
|
97
|
-
);
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
`LogErrorBoundary` is also available from `@trebired/logger/browser/react` when you want render errors logged with the shared event shape.
|
|
37
|
+
## Concepts
|
|
101
38
|
|
|
102
|
-
|
|
39
|
+
### Why This Logger
|
|
103
40
|
|
|
104
41
|
Most loggers either write to stdout and expect an external collector, or provide a very broad transport system. This package is intentionally opinionated around a simpler operational workflow:
|
|
105
42
|
|
|
@@ -188,140 +125,7 @@ if (result.action === "switched") {
|
|
|
188
125
|
}
|
|
189
126
|
```
|
|
190
127
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
You can manage partitions either from a live logger or with standalone helpers:
|
|
194
|
-
|
|
195
|
-
```ts
|
|
196
|
-
import {
|
|
197
|
-
copyPartition,
|
|
198
|
-
createPartition,
|
|
199
|
-
deleteLogs,
|
|
200
|
-
getPartitionInfo,
|
|
201
|
-
listPartitions,
|
|
202
|
-
renamePartition,
|
|
203
|
-
} from "@trebired/logger";
|
|
204
|
-
|
|
205
|
-
await createPartition("/var/log/my-app", "2026-05-17-12-00-00-1-staged", {
|
|
206
|
-
temporary: true,
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
const partitions = await listPartitions("/var/log/my-app");
|
|
210
|
-
console.log(partitions.total.megabytes);
|
|
211
|
-
console.log(partitions[0]?.total.megabytes);
|
|
212
|
-
|
|
213
|
-
await renamePartition("/var/log/my-app", {
|
|
214
|
-
from: "2026-05-17-12-00-00-1-staged",
|
|
215
|
-
to: "2026-05-17-12-00-00-1-final",
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
await copyPartition({
|
|
219
|
-
fromDir: "/var/log/my-app",
|
|
220
|
-
from: "2026-05-17-12-00-00-1-final",
|
|
221
|
-
toDir: "/var/log/archive",
|
|
222
|
-
to: "2026-05-17-12-00-00-1-final-copy",
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
await deleteLogs("/var/log/my-app", {
|
|
226
|
-
partition: "2026-05-17-12-00-00-1-final",
|
|
227
|
-
groupKey: "jobs.queue",
|
|
228
|
-
level: "warn",
|
|
229
|
-
olderThanDays: 7,
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
console.log(await getPartitionInfo("/var/log/my-app", "2026-05-17-12-00-00-1-final"));
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
For live loggers, the package now exposes two layers:
|
|
236
|
-
|
|
237
|
-
- `promotePartition()` stays the lower-level explicit primitive. By default it still errors on target conflicts unless you pass `merge: true` or `ifExists`.
|
|
238
|
-
- `finalizePartition()` is the higher-level lifecycle helper for idempotent temp-to-final transitions.
|
|
239
|
-
|
|
240
|
-
`finalizePartition()` returns structured outcomes instead of forcing application code to catch expected conflicts:
|
|
241
|
-
|
|
242
|
-
```ts
|
|
243
|
-
const result = await log.finalizePartition("2026-05-17-12-00-00-1-final", {
|
|
244
|
-
ifExists: "switch",
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
result.action;
|
|
248
|
-
// "renamed" | "merged" | "switched" | "activated-target"
|
|
249
|
-
// "marked-permanent" | "already-finalized"
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
Conflict policies:
|
|
253
|
-
|
|
254
|
-
- `ifExists: "error"` keeps strict low-level behavior
|
|
255
|
-
- `ifExists: "merge"` merges the active source partition into the existing target
|
|
256
|
-
- `ifExists: "switch"` activates the existing target without merging the current source
|
|
257
|
-
|
|
258
|
-
For advanced callers that still use the lower-level primitives directly, `getPartitionErrorCode()` and `isPartitionError()` can inspect partition lifecycle errors without parsing raw message strings.
|
|
259
|
-
|
|
260
|
-
## Core API
|
|
261
|
-
|
|
262
|
-
```ts
|
|
263
|
-
const log = createLog({
|
|
264
|
-
dir: "/var/log/my-app",
|
|
265
|
-
save: true,
|
|
266
|
-
console: true,
|
|
267
|
-
timeZone: "America/New_York",
|
|
268
|
-
source: "api",
|
|
269
|
-
});
|
|
270
|
-
|
|
271
|
-
log.debug("app.boot", "config loaded");
|
|
272
|
-
log.info("app.boot", "ready");
|
|
273
|
-
log.success("job.import", "finished", { rows: 1200 });
|
|
274
|
-
log.warn("http.request", "slow request", { took_ms: 842 });
|
|
275
|
-
log.fail("job.import", "failed validation");
|
|
276
|
-
log.error("app.runtime", "uncaught error");
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
`save` defaults to `true` when `dir` is provided. If no `dir` is provided, the logger can still emit console output and live stream events.
|
|
280
|
-
|
|
281
|
-
If you log without passing a group, the logger always uses `"default"`.
|
|
282
|
-
|
|
283
|
-
`@trebired/logger` runs on both Bun and Node.js. It may print one-time package notices for runtime-specific guidance or important future package messages. For example, when it detects Node.js, it recommends Bun for best startup and file I/O performance. Pass `quiet: true` to suppress package notices:
|
|
284
|
-
|
|
285
|
-
```ts
|
|
286
|
-
const log = createLog({
|
|
287
|
-
quiet: true,
|
|
288
|
-
});
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
When `quiet` is not `true`, the package also prints a one-time startup greeting using the same console logger style as normal entries.
|
|
292
|
-
|
|
293
|
-
`timeZone` is a top-level logger option because it controls the actual local moment used for saved file names and console timestamps. It defaults to the host timezone, then falls back to `America/New_York`.
|
|
294
|
-
|
|
295
|
-
Console output is configurable. `level` and `message` are always shown; timestamp, group, and metadata can be hidden. `console.locale` only controls display formatting. When `locale` is omitted or invalid, the logger passes `undefined` to `Intl.DateTimeFormat`, so JavaScript uses the runtime or system default locale:
|
|
296
|
-
|
|
297
|
-
```ts
|
|
298
|
-
const log = createLog({
|
|
299
|
-
timeZone: "America/New_York",
|
|
300
|
-
console: {
|
|
301
|
-
colors: true,
|
|
302
|
-
timestamp: true,
|
|
303
|
-
group: false,
|
|
304
|
-
metadata: false,
|
|
305
|
-
locale: "en-US",
|
|
306
|
-
},
|
|
307
|
-
});
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
Use `timeZone` for the local hour and `console.locale` for the display style.
|
|
311
|
-
|
|
312
|
-
Server runtimes also auto-discover a top-level `tb.logger.json` file by walking up from `process.cwd()`. When present, it overrides console group visibility in both development and production without affecting saved logs:
|
|
313
|
-
|
|
314
|
-
```json
|
|
315
|
-
{
|
|
316
|
-
"hideConsoleGroups": ["blog.post", "http.request"]
|
|
317
|
-
}
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
Each configured group hides both the exact group and descendants such as `blog.post.comment`. Invalid files print a warning and are ignored.
|
|
321
|
-
|
|
322
|
-
European dot-date locales such as `cs-CZ` and `de-DE` are formatted consistently as `03.05.2026, 15:59:23`.
|
|
323
|
-
|
|
324
|
-
## Full API Example
|
|
128
|
+
### Full API Example
|
|
325
129
|
|
|
326
130
|
```ts
|
|
327
131
|
import { createLog } from "@trebired/logger";
|
|
@@ -395,7 +199,7 @@ await log.flush();
|
|
|
395
199
|
await log.close();
|
|
396
200
|
```
|
|
397
201
|
|
|
398
|
-
|
|
202
|
+
### Custom Levels
|
|
399
203
|
|
|
400
204
|
Levels are weighted. `minLevel` filters out entries with lower weight.
|
|
401
205
|
|
|
@@ -416,7 +220,183 @@ Built-in levels are `debug`, `info`, `success`, `warn`, `fail`, and `error`. A c
|
|
|
416
220
|
|
|
417
221
|
Custom level methods are available at runtime. In TypeScript, the logger exposes dynamic level methods through an index signature, so custom names work but are not exhaustively autocompleted from the `levels` object yet.
|
|
418
222
|
|
|
419
|
-
|
|
223
|
+
### Scoped Loggers
|
|
224
|
+
|
|
225
|
+
```ts
|
|
226
|
+
const jobs = log.group("jobs.queue");
|
|
227
|
+
jobs.info("started", { jobId: "job_1" });
|
|
228
|
+
|
|
229
|
+
const worker = log.withScope("worker", "jobs.queue", 2);
|
|
230
|
+
worker.error("failed", { jobId: "job_1" });
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Express-Style Middleware
|
|
234
|
+
|
|
235
|
+
`requestLogger()` is compatible with Express-style middleware and attaches `req.log` by default.
|
|
236
|
+
|
|
237
|
+
```ts
|
|
238
|
+
app.use(log.requestLogger({
|
|
239
|
+
group: "http.request",
|
|
240
|
+
idHeader: "x-request-id",
|
|
241
|
+
}));
|
|
242
|
+
|
|
243
|
+
app.get("/", (req, res) => {
|
|
244
|
+
req.log.info("handled");
|
|
245
|
+
res.end("ok");
|
|
246
|
+
});
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Live Stream
|
|
250
|
+
|
|
251
|
+
```ts
|
|
252
|
+
import { logStream } from "@trebired/logger";
|
|
253
|
+
|
|
254
|
+
logStream.on("log", (entry, context) => {
|
|
255
|
+
// context.dir is the active log directory, if one is configured
|
|
256
|
+
});
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## Runtime
|
|
260
|
+
|
|
261
|
+
### Install Notes
|
|
262
|
+
|
|
263
|
+
The package can use bundled native binaries for supported Linux and macOS targets to speed up large storage/export workloads. Consumers still install a single package:
|
|
264
|
+
|
|
265
|
+
```txt
|
|
266
|
+
@trebired/logger
|
|
267
|
+
dist/
|
|
268
|
+
native/
|
|
269
|
+
linux-x64-gnu.node
|
|
270
|
+
linux-arm64-gnu.node
|
|
271
|
+
darwin-arm64.node
|
|
272
|
+
darwin-x64.node
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
At runtime the JS wrapper always tries the matching `.node` file first when one is bundled for the current platform, and falls back to the built-in JS backend if native loading is unavailable or fails. Bundled native binaries are currently published for Linux GNU (`x64` and `arm64`) and macOS targets. End users do not need Rust installed.
|
|
276
|
+
|
|
277
|
+
Set `TB_LOGGER_DISABLE_NATIVE=1` only when you explicitly want to force the JS backend.
|
|
278
|
+
|
|
279
|
+
### Browser Runtime
|
|
280
|
+
|
|
281
|
+
Use `@trebired/logger/browser` when you want the same levels, metadata conventions, grouping rules, and scoped logger behavior in browser code:
|
|
282
|
+
|
|
283
|
+
```ts
|
|
284
|
+
import { createBrowserLog } from "@trebired/logger/browser";
|
|
285
|
+
|
|
286
|
+
const log = createBrowserLog({
|
|
287
|
+
group: "frontend.app",
|
|
288
|
+
metadata: {
|
|
289
|
+
deploymentId: "deploy-42",
|
|
290
|
+
requestId: "req-abc",
|
|
291
|
+
},
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
log.info("frontend boot");
|
|
295
|
+
await log.flush();
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
The first browser release ships with console delivery built in. It also supports custom browser transports with in-memory batching so you can add fetch, beacon, websocket, or other delivery later without changing the logger API.
|
|
299
|
+
|
|
300
|
+
There is no built-in SSR bootstrap helper in this release. If you want browser correlation data such as `requestId`, `sessionId`, or `deploymentId`, pass it explicitly through `metadata` or per-log metadata.
|
|
301
|
+
|
|
302
|
+
### React Adapter
|
|
303
|
+
|
|
304
|
+
`@trebired/logger/browser/react` is intentionally thin. It does not create a logger for you. It only helps wire an existing browser logger into React context:
|
|
305
|
+
|
|
306
|
+
```tsx
|
|
307
|
+
import { createRoot } from "react-dom/client";
|
|
308
|
+
import { createBrowserLog } from "@trebired/logger/browser";
|
|
309
|
+
import { LogProvider, useLog } from "@trebired/logger/browser/react";
|
|
310
|
+
|
|
311
|
+
const log = createBrowserLog({
|
|
312
|
+
group: "frontend.app",
|
|
313
|
+
metadata: { deploymentId: "deploy-42" },
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
function SaveButton() {
|
|
317
|
+
const scopedLog = useLog("ui.save_button");
|
|
318
|
+
return <button onClick={() => scopedLog.info("clicked")}>Save</button>;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
createRoot(document.getElementById("root")!).render(
|
|
322
|
+
<LogProvider log={log}>
|
|
323
|
+
<SaveButton />
|
|
324
|
+
</LogProvider>,
|
|
325
|
+
);
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
`LogErrorBoundary` is also available from `@trebired/logger/browser/react` when you want render errors logged with the shared event shape.
|
|
329
|
+
|
|
330
|
+
### Partition Lifecycle
|
|
331
|
+
|
|
332
|
+
You can manage partitions either from a live logger or with standalone helpers:
|
|
333
|
+
|
|
334
|
+
```ts
|
|
335
|
+
import {
|
|
336
|
+
copyPartition,
|
|
337
|
+
createPartition,
|
|
338
|
+
deleteLogs,
|
|
339
|
+
getPartitionInfo,
|
|
340
|
+
listPartitions,
|
|
341
|
+
renamePartition,
|
|
342
|
+
} from "@trebired/logger";
|
|
343
|
+
|
|
344
|
+
await createPartition("/var/log/my-app", "2026-05-17-12-00-00-1-staged", {
|
|
345
|
+
temporary: true,
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
const partitions = await listPartitions("/var/log/my-app");
|
|
349
|
+
console.log(partitions.total.megabytes);
|
|
350
|
+
console.log(partitions[0]?.total.megabytes);
|
|
351
|
+
|
|
352
|
+
await renamePartition("/var/log/my-app", {
|
|
353
|
+
from: "2026-05-17-12-00-00-1-staged",
|
|
354
|
+
to: "2026-05-17-12-00-00-1-final",
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
await copyPartition({
|
|
358
|
+
fromDir: "/var/log/my-app",
|
|
359
|
+
from: "2026-05-17-12-00-00-1-final",
|
|
360
|
+
toDir: "/var/log/archive",
|
|
361
|
+
to: "2026-05-17-12-00-00-1-final-copy",
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
await deleteLogs("/var/log/my-app", {
|
|
365
|
+
partition: "2026-05-17-12-00-00-1-final",
|
|
366
|
+
groupKey: "jobs.queue",
|
|
367
|
+
level: "warn",
|
|
368
|
+
olderThanDays: 7,
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
console.log(await getPartitionInfo("/var/log/my-app", "2026-05-17-12-00-00-1-final"));
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
For live loggers, the package now exposes two layers:
|
|
375
|
+
|
|
376
|
+
- `promotePartition()` stays the lower-level explicit primitive. By default it still errors on target conflicts unless you pass `merge: true` or `ifExists`.
|
|
377
|
+
- `finalizePartition()` is the higher-level lifecycle helper for idempotent temp-to-final transitions.
|
|
378
|
+
|
|
379
|
+
`finalizePartition()` returns structured outcomes instead of forcing application code to catch expected conflicts:
|
|
380
|
+
|
|
381
|
+
```ts
|
|
382
|
+
const result = await log.finalizePartition("2026-05-17-12-00-00-1-final", {
|
|
383
|
+
ifExists: "switch",
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
result.action;
|
|
387
|
+
// "renamed" | "merged" | "switched" | "activated-target"
|
|
388
|
+
// "marked-permanent" | "already-finalized"
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
Conflict policies:
|
|
392
|
+
|
|
393
|
+
- `ifExists: "error"` keeps strict low-level behavior
|
|
394
|
+
- `ifExists: "merge"` merges the active source partition into the existing target
|
|
395
|
+
- `ifExists: "switch"` activates the existing target without merging the current source
|
|
396
|
+
|
|
397
|
+
For advanced callers that still use the lower-level primitives directly, `getPartitionErrorCode()` and `isPartitionError()` can inspect partition lifecycle errors without parsing raw message strings.
|
|
398
|
+
|
|
399
|
+
### Async Writes, Flush, and Close
|
|
420
400
|
|
|
421
401
|
File writes are async queued by default.
|
|
422
402
|
|
|
@@ -452,7 +432,7 @@ const log = createLog({
|
|
|
452
432
|
});
|
|
453
433
|
```
|
|
454
434
|
|
|
455
|
-
|
|
435
|
+
### Retention and Rolling
|
|
456
436
|
|
|
457
437
|
Defaults:
|
|
458
438
|
|
|
@@ -484,7 +464,7 @@ When a file exceeds the configured size, the logger rolls to the next sequence i
|
|
|
484
464
|
2026-05-03-13-00-00-3-info.jsonl
|
|
485
465
|
```
|
|
486
466
|
|
|
487
|
-
|
|
467
|
+
### Redaction and Serializers
|
|
488
468
|
|
|
489
469
|
Common sensitive keys are redacted by default: password, token, secret, authorization, cookie, api_key, and related variants.
|
|
490
470
|
|
|
@@ -506,33 +486,7 @@ log.info("account.update", "saved", {
|
|
|
506
486
|
});
|
|
507
487
|
```
|
|
508
488
|
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
```ts
|
|
512
|
-
const jobs = log.group("jobs.queue");
|
|
513
|
-
jobs.info("started", { jobId: "job_1" });
|
|
514
|
-
|
|
515
|
-
const worker = log.withScope("worker", "jobs.queue", 2);
|
|
516
|
-
worker.error("failed", { jobId: "job_1" });
|
|
517
|
-
```
|
|
518
|
-
|
|
519
|
-
## Express-Style Middleware
|
|
520
|
-
|
|
521
|
-
`requestLogger()` is compatible with Express-style middleware and attaches `req.log` by default.
|
|
522
|
-
|
|
523
|
-
```ts
|
|
524
|
-
app.use(log.requestLogger({
|
|
525
|
-
group: "http.request",
|
|
526
|
-
idHeader: "x-request-id",
|
|
527
|
-
}));
|
|
528
|
-
|
|
529
|
-
app.get("/", (req, res) => {
|
|
530
|
-
req.log.info("handled");
|
|
531
|
-
res.end("ok");
|
|
532
|
-
});
|
|
533
|
-
```
|
|
534
|
-
|
|
535
|
-
## Query Saved Logs
|
|
489
|
+
### Query Saved Logs
|
|
536
490
|
|
|
537
491
|
Old query names are not supported anymore. Use `getLogsForDir()`, `getAllLogs()`, and `getAllLogsAcrossPartitions()`. Do not use `getEntriesForDir()` or `getAll()`.
|
|
538
492
|
|
|
@@ -574,7 +528,7 @@ console.log(merged.logs);
|
|
|
574
528
|
console.log(merged.metadata.partitions.items);
|
|
575
529
|
```
|
|
576
530
|
|
|
577
|
-
|
|
531
|
+
### Sampling
|
|
578
532
|
|
|
579
533
|
```ts
|
|
580
534
|
const log = createLog({
|
|
@@ -586,17 +540,7 @@ const selective = createLog({
|
|
|
586
540
|
});
|
|
587
541
|
```
|
|
588
542
|
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
```ts
|
|
592
|
-
import { logStream } from "@trebired/logger";
|
|
593
|
-
|
|
594
|
-
logStream.on("log", (entry, context) => {
|
|
595
|
-
// context.dir is the active log directory, if one is configured
|
|
596
|
-
});
|
|
597
|
-
```
|
|
598
|
-
|
|
599
|
-
## Development
|
|
543
|
+
### Development
|
|
600
544
|
|
|
601
545
|
```sh
|
|
602
546
|
bun install
|
|
@@ -609,4 +553,78 @@ Committed `*.spec.ts` and `*.spec.tsx` files are banned by Code Discipline, so t
|
|
|
609
553
|
|
|
610
554
|
`bun run demo` starts a small dummy system that keeps logging until interrupted. It exercises grouped and scoped loggers, custom levels, redaction, request middleware, live stream events, local querying, and write stats. It writes throwaway logs into the repo under `.demo-logs/dummy`. Microslop Windows is not supported.
|
|
611
555
|
|
|
612
|
-
The
|
|
556
|
+
The published package exports compiled files from `dist`. Publishing runs `typecheck` and package verification through `prepublishOnly`.
|
|
557
|
+
|
|
558
|
+
## Public API
|
|
559
|
+
|
|
560
|
+
### Core API
|
|
561
|
+
|
|
562
|
+
```ts
|
|
563
|
+
const log = createLog({
|
|
564
|
+
dir: "/var/log/my-app",
|
|
565
|
+
save: true,
|
|
566
|
+
console: true,
|
|
567
|
+
timeZone: "America/New_York",
|
|
568
|
+
source: "api",
|
|
569
|
+
});
|
|
570
|
+
|
|
571
|
+
log.debug("app.boot", "config loaded");
|
|
572
|
+
log.info("app.boot", "ready");
|
|
573
|
+
log.success("job.import", "finished", { rows: 1200 });
|
|
574
|
+
log.warn("http.request", "slow request", { took_ms: 842 });
|
|
575
|
+
log.fail("job.import", "failed validation");
|
|
576
|
+
log.error("app.runtime", "uncaught error");
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
`save` defaults to `true` when `dir` is provided. If no `dir` is provided, the logger can still emit console output and live stream events.
|
|
580
|
+
|
|
581
|
+
If you log without passing a group, the logger always uses `"default"`.
|
|
582
|
+
|
|
583
|
+
`@trebired/logger` runs on both Bun. It may print one-time package notices for runtime-specific guidance or important future package messages. For example, Pass `quiet: true` to suppress package notices:
|
|
584
|
+
|
|
585
|
+
```ts
|
|
586
|
+
const log = createLog({
|
|
587
|
+
quiet: true,
|
|
588
|
+
});
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
When `quiet` is not `true`, the package also prints a one-time startup greeting using the same console logger style as normal entries.
|
|
592
|
+
|
|
593
|
+
`timeZone` is a top-level logger option because it controls the actual local moment used for saved file names and console timestamps. It defaults to the host timezone, then falls back to `America/New_York`.
|
|
594
|
+
|
|
595
|
+
Console output is configurable. `level` and `message` are always shown; timestamp, group, and metadata can be hidden. `console.locale` only controls display formatting. When `locale` is omitted or invalid, the logger passes `undefined` to `Intl.DateTimeFormat`, so JavaScript uses the runtime or system default locale:
|
|
596
|
+
|
|
597
|
+
```ts
|
|
598
|
+
const log = createLog({
|
|
599
|
+
timeZone: "America/New_York",
|
|
600
|
+
console: {
|
|
601
|
+
colors: true,
|
|
602
|
+
timestamp: true,
|
|
603
|
+
group: false,
|
|
604
|
+
metadata: false,
|
|
605
|
+
locale: "en-US",
|
|
606
|
+
},
|
|
607
|
+
});
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
Use `timeZone` for the local hour and `console.locale` for the display style.
|
|
611
|
+
|
|
612
|
+
Server runtimes also auto-discover a top-level `tb.logger.json` file by walking up from `process.cwd()`. When present, it overrides console group visibility in both development and production without affecting saved logs:
|
|
613
|
+
|
|
614
|
+
```json
|
|
615
|
+
{
|
|
616
|
+
"hideConsoleGroups": ["blog.post", "http.request"]
|
|
617
|
+
}
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
Each configured group hides both the exact group and descendants such as `blog.post.comment`. Invalid files print a warning and are ignored.
|
|
621
|
+
|
|
622
|
+
European dot-date locales such as `cs-CZ` and `de-DE` are formatted consistently as `03.05.2026, 15:59:23`.
|
|
623
|
+
|
|
624
|
+
## What It Does Not Do
|
|
625
|
+
|
|
626
|
+
This package does not:
|
|
627
|
+
|
|
628
|
+
- replace a full observability stack
|
|
629
|
+
- force one transport, server framework, or deployment model
|
|
630
|
+
- infer product-specific redaction policy
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-metadata.d.ts","sourceRoot":"","sources":["../src/package-metadata.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"package-metadata.d.ts","sourceRoot":"","sources":["../src/package-metadata.ts"],"names":[],"mappings":"AAsDA,QAAA,MAAM,YAAY,QAAqH,CAAC;AACxI,QAAA,MAAM,yBAAyB,QAAsE,CAAC;AACtG,QAAA,MAAM,YAAY,QAAwC,CAAC;AAE3D,iBAAS,oBAAoB,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAKxD;AAED,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,yBAAyB,EACzB,YAAY,GACb,CAAC"}
|
package/dist/package-metadata.js
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
+
function findPackageJsonPath() {
|
|
5
|
+
let current = path.dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
for (let index = 0; index < 8; index += 1) {
|
|
7
|
+
const candidate = path.join(current, "package.json");
|
|
8
|
+
if (fs.existsSync(candidate))
|
|
9
|
+
return candidate;
|
|
10
|
+
const parent = path.dirname(current);
|
|
11
|
+
if (parent === current)
|
|
12
|
+
break;
|
|
13
|
+
current = parent;
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
4
17
|
function readPackageJson() {
|
|
5
|
-
const packageJsonPath =
|
|
18
|
+
const packageJsonPath = findPackageJsonPath();
|
|
19
|
+
if (!packageJsonPath)
|
|
20
|
+
return {};
|
|
6
21
|
try {
|
|
7
22
|
return JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
8
23
|
}
|
|
@@ -20,11 +35,16 @@ function packageSlug(name) {
|
|
|
20
35
|
return name.replace(new RegExp("^@[^/]+/"), "").trim();
|
|
21
36
|
}
|
|
22
37
|
const packageJson = readPackageJson();
|
|
23
|
-
const
|
|
24
|
-
const
|
|
38
|
+
const PACKAGE_JSON_NAME = cleanSegment(packageJson.name);
|
|
39
|
+
const PACKAGE_CONFIG_ORGANIZATION_NAME = cleanSegment(packageJson.config?.organization?.name);
|
|
40
|
+
const PACKAGE_NAME = PACKAGE_JSON_NAME || (PACKAGE_CONFIG_ORGANIZATION_NAME ? `@${PACKAGE_CONFIG_ORGANIZATION_NAME}/logger` : "logger");
|
|
41
|
+
const PACKAGE_ORGANIZATION_NAME = PACKAGE_CONFIG_ORGANIZATION_NAME || packageScope(PACKAGE_JSON_NAME);
|
|
25
42
|
const PACKAGE_SLUG = packageSlug(PACKAGE_NAME) || "logger";
|
|
26
43
|
function buildPackageLogGroup(...parts) {
|
|
27
|
-
return [PACKAGE_ORGANIZATION_NAME, PACKAGE_SLUG, ...parts
|
|
44
|
+
return [PACKAGE_ORGANIZATION_NAME, PACKAGE_SLUG, ...parts]
|
|
45
|
+
.map((part) => part.trim())
|
|
46
|
+
.filter(Boolean)
|
|
47
|
+
.join(".");
|
|
28
48
|
}
|
|
29
49
|
export { buildPackageLogGroup, PACKAGE_NAME, PACKAGE_ORGANIZATION_NAME, PACKAGE_SLUG, };
|
|
30
50
|
//# sourceMappingURL=package-metadata.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-metadata.js","sourceRoot":"","sources":["../src/package-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAWzC,SAAS,
|
|
1
|
+
{"version":3,"file":"package-metadata.js","sourceRoot":"","sources":["../src/package-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAWzC,SAAS,mBAAmB;IAC1B,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAE3D,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QAC1C,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QACrD,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC;YAAE,OAAO,SAAS,CAAC;QAE/C,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACrC,IAAI,MAAM,KAAK,OAAO;YAAE,MAAM;QAC9B,OAAO,GAAG,MAAM,CAAC;IACnB,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,eAAe;IACtB,MAAM,eAAe,GAAG,mBAAmB,EAAE,CAAC;IAC9C,IAAI,CAAC,eAAe;QAAE,OAAO,EAAE,CA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D,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SAC1B,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAED,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,yBAAyB,EACzB,YAAY,GACb,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../../src/storage/partitions/files.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGvD,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../../src/storage/partitions/files.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGvD,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEvE,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,WAAW,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAE9H,iBAAS,wBAAwB,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAW1F;AAED,iBAAe,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAgC1E;AAED,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,mBAAmB,GACpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../../src/storage/partitions/files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAA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,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;oBACtE,SAAS;gBACX,CAAC;gBACD,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;gBACrF,SAAS;YACX,CAAC;YACD,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,KAAK,CAAC,IAAI,KAAK,qBAAqB;gBAAE,SAAS;YACtE,MAAM,MAAM,GAAG,kBAAkB,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YAChG,IAAI,MAAM;gBAAE,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IAED,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IACvD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,mBAAmB,GACpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/storage/partitions/public.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/storage/partitions/public.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,eAAe,CAAC;AASvB,iBAAe,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,sBAA2B,GAAG,OAAO,CAAC,aAAa,CAAC,CAa3H;AAED,iBAAe,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAIvE;AAED,iBAAe,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAG7F;AAED,iBAAe,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,aAAa,CAAC,CAUnG;AAED,iBAAe,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,aAAa,CAAC,CAWlF;AAED,iBAAe,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,aAAa,CAAC,CAelF;AAED,iBAAe,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,aAAa,CAAC,CAIjG;AAED,iBAAe,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAE7F;AAED,OAAO,EACL,aAAa,EACb,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,aAAa,EACb,eAAe,GAChB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/storage/partitions/public.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/storage/partitions/public.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM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EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;AAC5D,CAAC;AAED,OAAO,EACL,aAAa,EACb,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,aAAa,EACb,eAAe,GAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trebired/logger",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.12",
|
|
4
4
|
"description": "Local-first JSONL logger with durable writes, partitions, export archives, native storage acceleration, redaction, query helpers, and browser runtimes.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
7
7
|
"license": "AGPL-3.0-only",
|
|
8
|
+
"author": "Miroslav Machynka (Trebired)",
|
|
8
9
|
"config": {
|
|
9
10
|
"organization": {
|
|
10
11
|
"name": "trebired"
|
|
@@ -12,8 +13,7 @@
|
|
|
12
13
|
},
|
|
13
14
|
"packageManager": "bun@1.3.12",
|
|
14
15
|
"engines": {
|
|
15
|
-
"bun": ">=1.0.0"
|
|
16
|
-
"node": ">=18"
|
|
16
|
+
"bun": ">=1.0.0"
|
|
17
17
|
},
|
|
18
18
|
"main": "./dist/index.js",
|
|
19
19
|
"types": "./dist/index.d.ts",
|
|
@@ -39,25 +39,26 @@
|
|
|
39
39
|
"README.md"
|
|
40
40
|
],
|
|
41
41
|
"scripts": {
|
|
42
|
-
"build": "rm -rf dist && tsc -p tsconfig.build.json &&
|
|
42
|
+
"build": "bun run prepare:generated && rm -rf dist && tsc -p tsconfig.build.json && bun ./scripts/prepare-dist.mjs prepare-dist",
|
|
43
43
|
"build:native": "bun ./scripts/build/native.mjs",
|
|
44
44
|
"build:native:matrix": "bun ./scripts/build/native-matrix.mjs",
|
|
45
45
|
"demo": "bun run examples/dummy.ts",
|
|
46
|
-
"postpack": "
|
|
47
|
-
"prepack": "bun run build &&
|
|
46
|
+
"postpack": "bun ./scripts/prepare-dist.mjs postpack",
|
|
47
|
+
"prepack": "bun run build && bun ./scripts/prepare-dist.mjs prepack",
|
|
48
48
|
"prepublishOnly": "bun run typecheck && bun ./scripts/verify/publish.mjs",
|
|
49
|
-
"publish:
|
|
50
|
-
"publish:
|
|
51
|
-
"
|
|
49
|
+
"publish:package": "bun run build:native:matrix && bun publish",
|
|
50
|
+
"publish:package:host": "bun run build:native && TB_LOGGER_ALLOW_HOST_ONLY_PUBLISH=1 bun publish",
|
|
51
|
+
"prepare:generated": "bun ./scripts/build/generated/tsconfig.mjs",
|
|
52
|
+
"typecheck": "bun run prepare:generated && tsc --noEmit",
|
|
52
53
|
"verify:pack": "bun ./scripts/verify/pack.mjs"
|
|
53
54
|
},
|
|
54
55
|
"dependencies": {
|
|
55
|
-
"@package/result": "npm:@trebired/result@^1.1.
|
|
56
|
+
"@package/result": "npm:@trebired/result@^1.1.4",
|
|
56
57
|
"fflate": "^0.8.3",
|
|
57
58
|
"tar-stream": "^3.2.0"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
|
-
"@trebired/code-discipline": "^4.
|
|
61
|
+
"@trebired/code-discipline": "^4.9.2",
|
|
61
62
|
"@types/bun": "^1.3.4",
|
|
62
63
|
"@types/node": "^24.10.1",
|
|
63
64
|
"@types/react": "^19.2.2",
|
|
@@ -83,7 +84,6 @@
|
|
|
83
84
|
"backend",
|
|
84
85
|
"browser",
|
|
85
86
|
"frontend",
|
|
86
|
-
"node",
|
|
87
87
|
"bun"
|
|
88
88
|
],
|
|
89
89
|
"repository": {
|