Skip to content

feat: export winston's stock npm levels alongside the custom defaults#140

Merged
cuzzlor merged 6 commits intomainfrom
claude/export-winston-logging-levels-vTcd8
Apr 25, 2026
Merged

feat: export winston's stock npm levels alongside the custom defaults#140
cuzzlor merged 6 commits intomainfrom
claude/export-winston-logging-levels-vTcd8

Conversation

@cuzzlor
Copy link
Copy Markdown
Collaborator

@cuzzlor cuzzlor commented Apr 25, 2026

Summary

  • feat — Adds winstonDefaultLevels / winstonDefaultLevelColors so consumers can opt back into winston's built-in npm level set via loggerOptions.levels without reaching into winston.config.npm. Colours register automatically on first use, mirroring the existing behaviour for defaultLevels. Also exposes defaultLevelColors for parity, and adds a WinstonDefaultLogger type alias.
  • fix(cjs) — Rollup's CJS output now uses interop: 'auto'. Default imports of yamlify-object (whose CJS build sets exports.default = fn + __esModule: true with no module.exports = fn shim) were being emitted as var yamlifyObject = require('yamlify-object') and then called directly, throwing TypeError: yamlifyObject is not a function for CJS consumers. With interop: 'auto', Rollup emits a runtime __esModule check and unwraps .default at the call site. The .mjs build was unaffected — it resolved through yamlify-object's import condition correctly already. Verified end-to-end with a Node smoke test of require('./dist/index.js') + createLogger({ consoleFormat: 'pretty' }).
  • docs — Documents in the v1 → v2 migration notes that submodule deep-imports (e.g. @makerx/node-winston/redact-format) are intentionally not part of v2's surface — every public format/helper/type is re-exported from the root entry. The ./serialize-error subpath specifically has no replacement: serialize-error is now a peer dependency, so consumers wanting the underlying serializer should import it from that package directly rather than through us.
  • fix(audit) — Pins transitive postcss to ^8.5.10 via npm overrides to clear GHSA-qx2v-qp2m-jg93 (XSS in CSS Stringify Output, pulled in through vitest → vite → postcss@8.5.9). postcss is dev-only here.

Test plan

  • npm test — all 46 tests pass (existing suite + new tests covering winstonDefaultLevels exports and method shape, plus a @ts-expect-error confirming audit is rejected on the winston-default-typed logger)
  • npm run lint / npm run check-types — clean
  • npm run buildattw reports 🟢 across node10 / node16 (CJS) / node16 (ESM) / bundler
  • npm run audit🤝 All good! (postcss override applied, lockfile rehydrates cleanly via npm ci)
  • CJS smoke: require('./dist/index.js') + createLogger({ consoleFormat: 'pretty' }).info(...) no longer throws on yamlify
  • ESM smoke: import { yamlify } from './dist/pretty-console-format.mjs' still works

https://claude.ai/code/session_01Ap9pEtBBrZBzqmwtZb3gzr

claude added 6 commits April 25, 2026 05:07
Adds `winstonDefaultLevels` / `winstonDefaultLevelColors` so consumers can
opt back into winston's built-in npm level set via `loggerOptions.levels`
without reaching into `winston.config.npm`. Colours register automatically
on first use, mirroring the existing behaviour for `defaultLevels`. Also
exposes `defaultLevelColors` for parity.

https://claude.ai/code/session_01Ap9pEtBBrZBzqmwtZb3gzr
- rollup CJS output now uses interop:'auto', so default imports of
  yamlify-object (whose CJS build sets exports.default + __esModule
  but no module.exports = fn) are unwrapped at the call site instead
  of throwing TypeError: yamlifyObject is not a function. Only the
  CJS bundle was affected; the .mjs build resolved through
  yamlify-object's `import` condition correctly already.
- Re-add per-module subpath entries to the dist package.json's
  `exports` field via tstoolkit config, so deep-imports like
  `@makerx/node-winston/serialize-error` resolve again instead of
  hitting ERR_PACKAGE_PATH_NOT_EXPORTED. Restores the v1.2-and-earlier
  shape that the v1.3 modernify lost when it added a single-`.` exports
  field. Validated by attw across node10/node16-cjs/node16-esm/bundler.

https://claude.ai/code/session_01Ap9pEtBBrZBzqmwtZb3gzr
Drop the per-module `exports` map: v2 ships a single `.` entry, so deep
imports like `@makerx/node-winston/serialize-error` are intentionally
unsupported. Every public format, helper and type is re-exported from
the root entry. The `./serialize-error` subpath specifically has no
replacement — `serialize-error` is now a peer dependency, so consumers
who want the underlying serializer should import it from that package
directly rather than through us.

The yamlify-object CJS interop fix in rollup.config.ts (interop:'auto')
stays — that's an unrelated runtime bug.

https://claude.ai/code/session_01Ap9pEtBBrZBzqmwtZb3gzr
CI's `npm run audit` was failing on GHSA-qx2v-qp2m-jg93 (PostCSS XSS in
CSS Stringify Output) — pulled in transitively via vitest → vite →
postcss@8.5.9. Pin postcss to ^8.5.10 via npm `overrides` so we get the
patched version without waiting on a vitest/vite release.

postcss is dev-only here (we don't process CSS); the override just keeps
the audit job green.

https://claude.ai/code/session_01Ap9pEtBBrZBzqmwtZb3gzr
- Split the serialize-error breaking change into two precise bullets:
  the wire-format shape change (now includes name/cause/own-props/
  circular-ref handling via the serialize-error peer dep) and the
  logger-level promotion (errors are now serialised on every transport,
  not just inside the Console's format.json — custom transports that
  expected an Error instance need to read the plain object now).
- Drop "omit/redact handling" from the omitPaths bullet; redact didn't
  exist in v1 so the wording was anachronistic.
- Surface redactPaths as a drop-in replacement for any hand-rolled
  redaction in v1 loggerOptions.format / custom transports — calls out
  that, like omitPaths, it applies at the logger level across every
  transport.
- Add a new-functionality bullet for mapAuditLevelForOtel (was
  documented in its own section but missing from the migration list).
- Tighten the serializeErrorFormat new-functionality bullet to focus on
  the standalone format / pluggable serializer; the behaviour change
  now lives in the breaking-changes section where it belongs.

https://claude.ai/code/session_01Ap9pEtBBrZBzqmwtZb3gzr
@cuzzlor cuzzlor merged commit 7afb027 into main Apr 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants