logroller 2.1.0 → 2.1.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "logroller",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Zero-dependency rotating file stream for Node.js — daily/interval/size rotation, gzip archives, retention, timezone-aware, crash-safe resume",
5
5
  "license": "MIT",
6
6
  "author": "Vinau",
@@ -48,8 +48,7 @@
48
48
  "files": [
49
49
  "dist",
50
50
  "README.md",
51
- "LICENSE",
52
- "CHANGELOG.md"
51
+ "LICENSE"
53
52
  ],
54
53
  "engines": {
55
54
  "node": ">=16.14"
@@ -65,6 +64,7 @@
65
64
  "release": "npm run verify && npm pack --dry-run"
66
65
  },
67
66
  "devDependencies": {
67
+ "@rollup/plugin-terser": "^1.0.0",
68
68
  "@rollup/plugin-typescript": "^11.1.6",
69
69
  "@types/node": "^26.4.0",
70
70
  "prettier": "^3.4.2",
package/CHANGELOG.md DELETED
@@ -1,151 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project are documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [2.1.0] — 2026-08-28
9
-
10
- ### Added
11
-
12
- - `symlink: true | string` — stable "current" pointer (e.g. `app-current.log`)
13
- for `tail -f`/Filebeat/promtail; atomically flipped on every segment open;
14
- degrades gracefully on symlink-denying filesystems; excluded from retention.
15
- - `maxTotalSize: "5g"` — byte-budget retention: deletes OLDEST archives until
16
- under budget; composes with `maxFiles`.
17
- - `onSeal` hook (+ `sealHookTimeoutMs`) — awaited after a segment is archived
18
- and BEFORE retention can delete it: the S3/GCS upload extension point.
19
- Errors/timeouts degrade to `warn`; rotation never stalls.
20
- - `installShutdown(streams)` / `flushAll()` — graceful SIGINT/SIGTERM
21
- handling that flushes buffered writes before exit (fixes the classic
22
- "last log lines missing" support case).
23
- - `stats()` and `listSegments()` — health snapshot and per-file listing.
24
- - `compressionLevel` (0–9, default 6) — passes through to gzip.
25
-
26
- ## [2.0.2] — 2026-08-28
27
-
28
- ### Fixed
29
-
30
- - **Corrupt audit manifest quarantine**: an unparseable `<stem>_audit.json`
31
- (partial write, bad edit) is now renamed to `.corrupt` and preserved,
32
- matching existing behaviour for version/family mismatches. Previously it
33
- was silently overwritten by the first manifest save, destroying the
34
- event journal.
35
- - **Backward-clock safety**: a clock moving backward (NTP correction,
36
- manual change) no longer reopens a past log family or forks the segment
37
- series. The stream keeps the current segment, warns once, and resumes
38
- normal rotation when the clock catches up.
39
- - **Timer anti-spin**: with the rotation boundary in the past (backward
40
- clock), the timer now polls at 1 s instead of firing every 100 ms,
41
- which previously could keep processes from exiting cleanly.
42
-
43
- ### Added
44
-
45
- - **Construction-time pattern warning**: warns when `frequency` is finer
46
- than the `datePattern` tokens allow (`daily`→`DD`, sub-daily→`HH`,
47
- sub-minute→`mm`), preventing silent filename collisions where many
48
- rotations overwrite a single file.
49
-
50
- ### Tests
51
-
52
- - Suite expanded to 23 tests: interrupted-gzip repair, manifest divergence
53
- healing (`archive-regressed`, `vanished`), manifest quarantine,
54
- concurrent-writer detection, IST-midnight boundary, idle `period` slide,
55
- `rotateNow()`, over-max resume, backward-clock guard, and coarse-pattern
56
- warning.
57
-
58
- ## [2.0.1] — 2026-08-27
59
-
60
- ### Fixed
61
-
62
- - Reactivated segments no longer inherit stale lifecycle timestamps
63
- (`abandonedAt` could predate `openedAt`).
64
- - Raw tails of already-passed periods are now gzipped at boot
65
- (crash-near-midnight no longer leaves yesterday's file uncompressed).
66
- - Rotation adopts a `.gz` produced by a (warned-about) concurrent writer
67
- instead of recording a false `drop-empty` that orphaned the archive.
68
-
69
- ## [2.0.0] — 2026-08-28
70
-
71
- Architecture release: the library moved from a single-file JavaScript SDK to a
72
- modular **TypeScript** codebase with strict typings, first-class DX tooling,
73
- and CI-gated releases. The public runtime API (`createStream`,
74
- `RotateFileStream`, all options and events) remains compatible with 1.x;
75
- TypeScript consumers gain full type coverage.
76
-
77
- > ⚠️ Consumers on 1.x should re-run their smoke/integration tests after
78
- > upgrading — mostly due to the deterministic boot-order fix below.
79
-
80
- ### Added
81
-
82
- - **Full TypeScript source with shipped declarations** (`dist/index.d.ts`);
83
- strict-mode compile (`noImplicitOverride`, `noUnusedLocals`,
84
- `verbatimModuleSyntax`, …).
85
- - **Tuple-typed events** via `RotateFileStreamEventMap` — `on("rotated", …)`
86
- autocompletes and payload types are checked (`RotatedInfo`, `ClockInfo`),
87
- while Node-core fallback overloads keep `.pipe()` structurally valid.
88
- - `advanceClock()` — apply one virtual-clock tick immediately (previously the
89
- step timer fired only every minute); makes day-crossing tests fully
90
- deterministic.
91
- - `clockStepIntervalMs` option — control how often `addHoursEveryMin` ticks.
92
- - Modular source layout (`src/types.ts`, `parsers.ts`, `time.ts`, `fsio.ts`,
93
- `rotate-file-stream.ts`) with `.js` extension imports so emitted
94
- declarations resolve under `nodenext` consumers.
95
- - Developer toolchain: Prettier, `npm run verify` gate (typecheck + build + tests).
96
- - GitHub Actions: CI matrix on Node 18/20/22, release-triggered publish with
97
- npm provenance (`id-token: write`, `--provenance`).
98
- - Expanded README: comparison table, FAQ, restart-resume matrix, pino recipe.
99
-
100
- ### Fixed
101
-
102
- - **Deterministic boot sequencing**: housekeeping (zombie demotion, disk
103
- reconciliation, interrupted-gzip repair) is chained as job #1 of the
104
- serial operation queue in the constructor instead of `process.nextTick`,
105
- so a rapid first `write()` can no longer race a boot-time reopen or skip
106
- zombie cleanup.
107
- - Retention sweep skips `<audit>.corrupt` artifacts alongside `.tmp`.
108
-
109
- ### Changed
110
-
111
- - Internals restructured behind the same public exports; barrels re-export
112
- types explicitly (`import type { RotatedInfo } from "logroller"`).
113
- - Stricter package hygiene metadata: `sideEffects: false`, explicit
114
- `./package.json` export, `files` whitelist (`dist`, docs, license,
115
- changelog).
116
- - Test suite runs against the built bundle and covers: base writing +
117
- manifest creation, size rotation/gzip/indexing, restart resume,
118
- `addHours` naming, virtual midnight crossing, count-retention ordering
119
- (mtime-deterministic), zombie-record lifecycle (`abandon → active →
120
- closed`), and CJS loadability through the exports map.
121
-
122
- ## [1.0.0] — 2026-08-26
123
-
124
- Initial release. Single-file zero-dependency JavaScript SDK
125
- (`file-rotation-sdk.js`) providing a Writable stream with scheduled file
126
- rotation.
127
-
128
- ### Added
129
-
130
- - Time-based rotation: `frequency: "daily"` (local midnight in any IANA
131
- timezone via `Intl`) or epoch-aligned intervals (`"30s"`, `"5m"`, `"2h"`).
132
- - Size-based rotation: `maxSize` (`"20m"` / `"512k"` / raw bytes) producing
133
- numbered segments — `app-D.log`, `app-D.1.log`, … — inserted between the
134
- date stamp and the extension.
135
- - Optional gzip archiving of sealed segments (`zippedArchive`), atomic tmp+
136
- rename writes, source deleted only after verified compression success.
137
- - Retention via `maxFiles`: age policy (`"90d"`) or count policy (`500`);
138
- unset means files are never auto-deleted.
139
- - Crash-safe restart resume from disk scan: raw tails are appended to,
140
- sealed chains continue at the next free index; lazy period-roll catches
141
- boundaries missed while suspended or shut down.
142
- - Audit manifest (`<stem>_audit.json`): lifecycle records per file, capped
143
- uuid-tagged event journal, `gzipPending` intent markers enabling automatic
144
- repair of gzips interrupted by a crash, zombie active-record demotion,
145
- disk-divergence healing (`archive-regressed`, `vanished`),
146
- concurrent-writer detection via pid/bootId heartbeat.
147
- - Virtual test clock: static shift (`addHours`) and per-minute stepping
148
- (`addHoursEveryMin`).
149
- - Dual-format distribution (ESM + CJS) bundled with Rollup; named exports
150
- `createStream` and `RotateFileStream`; factory options mirroring common
151
- rotator APIs; streams pipe-ready for pino multistreams.