Skip to content

[Bug]: winston3.3.3 resolves to @dabh/diagnostics@^2 β†’ pulls @so-ric/colorspace (ES2021 ||=) and crashes on Node 12Β #2586

@fuqi1001

Description

@fuqi1001

πŸ”Ž Search Terms

denpendency

The problem

[email protected] depends on @dabh/diagnostics:^2.0.2. Recently, npm started resolving this to @dabh/[email protected], which in turn depends on @so-ric/[email protected]. That package uses the ES2021 logical-OR assignment operator (||=), which causes a syntax error on Node 12:

https://github.com/so-ric/colorspace/blob/57ead2fa29f93d738e944155751d67619676a43d/dist/index.cjs.js#L1976

/app/node_modules/@so-ric/colorspace/dist/index.cjs.js:1976
                (limiters[m] ||= [])[channel] = modifier;
                               ^

SyntaxError: Unexpected token '='
    at wrapSafe (internal/modules/cjs/loader.js:1072:16)
    at Module._compile (internal/modules/cjs/loader.js:1122:27)
    at Module._compile (/app/node_modules/pirates/lib/index.js:129:24)
    at Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Object.newLoader [as .js] (/app/node_modules/pirates/lib/index.js:134:7)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
    at Module.require (internal/modules/cjs/loader.js:1044:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/app/node_modules/@dabh/diagnostics/modifiers/namespace-ansi.js:1:18)

Previously, older @dabh/diagnostics did not pull @so-ric/colorspace and worked fine on Node 12.

Environment

Node: v12.16.1 (npm 6.13.4) β€” legacy runtime we still need to support

winston: 3.3.3 (also reproducible when a newer 3.x is hoisted)

@dabh/diagnostics: resolved to 2.0.8 via ^2.0.2

OS: Debian-based container

Expected behavior

Installing [email protected] should not introduce syntax that breaks on Node 12, or the compatibility constraints should be clearly documented.

Actual behavior

Transitive dependency upgrade to @dabh/[email protected] β†’ @so-ric/colorspace introduces ES2021 syntax and crashes at startup on Node 12.

Workarounds tried

Pinning with overrides/resolutions to @dabh/[email protected] (works).

Upgrading runtime to Node 18 (works, but not immediately feasible for all environments).

Request

Consider pinning a Node-12-compatible range for @dabh/diagnostics in [email protected], or

Document minimum Node version more prominently for current transitive tree, or

Provide guidance on recommended versions for users still on Node 12.

Thanks!

What version of Winston presents the issue?

v3.3.3

What version of Node are you using?

12.16.1

If this worked in a previous version of Winston, which was it?

No response

Minimum Working Example

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions