refactor(default-reporter): drop the runtime dependency on config.reader (#13517)

Every import was type-only, so the declared dependency shipped the
whole config-reader tree to reporter consumers for nothing — Bit's
mirror-constrained installs were pulling config.env-replace@4.x through
it. The reporter now declares ReporterPnpmConfig, the structural slice
of the config it actually reads; the pnpm CLI's full Config satisfies
it unchanged.
This commit is contained in:
Zoltan Kochan authored and GitHub committed 2026-07-31 02:03:04 +02:00
1 parent 2e91fa470f
commit 7f81da30b8
18 files changed
+187 -159

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
---
"@pnpm/cli.default-reporter": patch
"pnpm": patch
---
The default reporter no longer depends on `@pnpm/config.reader` at runtime: it declares its own minimal `ReporterPnpmConfig` type for the config fields it reads. Hosts that embed the reporter no longer pull in the config-reader dependency tree.
+79 -82
View File
@@ -1395,7 +1395,7 @@ importers:
dependencies:
'@inquirer/prompts':
specifier: 'catalog:'
version: 8.5.2(@types/node@22.20.1)
version: 8.5.2(@types/node@26.1.2)
'@pnpm/cli.utils':
specifier: workspace:*
version: link:../../cli/utils
@@ -1688,7 +1688,7 @@ importers:
dependencies:
'@inquirer/prompts':
specifier: 'catalog:'
version: 8.5.2(@types/node@22.20.1)
version: 8.5.2(@types/node@26.1.2)
'@pnpm/building.after-install':
specifier: workspace:*
version: link:../after-install
@@ -2122,9 +2122,6 @@ importers:
'@pnpm/cli.meta':
specifier: workspace:*
version: link:../meta
'@pnpm/config.reader':
specifier: workspace:*
version: link:../../config/reader
'@pnpm/core-loggers':
specifier: workspace:*
version: link:../../core/core-loggers
@@ -2764,14 +2761,14 @@ importers:
version: link:../../fetching/types
openpgp:
specifier: 'catalog:'
version: 6.3.1(@openpgp/web-stream-tools@0.3.1(@types/node@22.20.1)(typescript@6.0.3))
version: 6.3.1(@openpgp/web-stream-tools@0.3.1(@types/node@26.1.2)(typescript@6.0.3))
devDependencies:
'@jest/globals':
specifier: 'catalog:'
version: 30.4.1(supports-color@10.2.2)
'@openpgp/web-stream-tools':
specifier: 'catalog:'
version: 0.3.1(@types/node@22.20.1)(typescript@6.0.3)
version: 0.3.1(@types/node@26.1.2)(typescript@6.0.3)
'@pnpm/crypto.shasums-file':
specifier: workspace:*
version: 'link:'
@@ -2838,7 +2835,7 @@ importers:
dependencies:
'@inquirer/prompts':
specifier: 'catalog:'
version: 8.5.2(@types/node@22.20.1)
version: 8.5.2(@types/node@26.1.2)
'@pnpm/cli.command':
specifier: workspace:*
version: link:../../../cli/command
@@ -3829,7 +3826,7 @@ importers:
dependencies:
'@inquirer/prompts':
specifier: 'catalog:'
version: 8.5.2(@types/node@22.20.1)
version: 8.5.2(@types/node@26.1.2)
'@pnpm/bins.linker':
specifier: workspace:*
version: link:../../../bins/linker
@@ -4153,7 +4150,7 @@ importers:
dependencies:
'@inquirer/prompts':
specifier: 'catalog:'
version: 8.5.2(@types/node@22.20.1)
version: 8.5.2(@types/node@26.1.2)
'@pnpm/bins.resolver':
specifier: workspace:*
version: link:../../bins/resolver
@@ -5184,7 +5181,7 @@ importers:
dependencies:
'@inquirer/prompts':
specifier: 'catalog:'
version: 8.5.2(@types/node@22.20.1)
version: 8.5.2(@types/node@26.1.2)
'@pnpm/building.after-install':
specifier: workspace:*
version: link:../../building/after-install
@@ -5590,7 +5587,7 @@ importers:
dependencies:
'@inquirer/prompts':
specifier: 'catalog:'
version: 8.5.2(@types/node@22.20.1)
version: 8.5.2(@types/node@26.1.2)
'@pnpm/bins.linker':
specifier: workspace:*
version: link:../../bins/linker
@@ -7414,7 +7411,7 @@ importers:
dependencies:
'@inquirer/prompts':
specifier: 'catalog:'
version: 8.5.2(@types/node@22.20.1)
version: 8.5.2(@types/node@26.1.2)
'@pnpm/cli.utils':
specifier: workspace:*
version: link:../../cli/utils
@@ -8141,7 +8138,7 @@ importers:
dependencies:
'@inquirer/prompts':
specifier: 'catalog:'
version: 8.5.2(@types/node@22.20.1)
version: 8.5.2(@types/node@26.1.2)
'@pnpm/cli.utils':
specifier: workspace:*
version: link:../../cli/utils
@@ -8226,7 +8223,7 @@ importers:
dependencies:
'@inquirer/prompts':
specifier: 'catalog:'
version: 8.5.2(@types/node@22.20.1)
version: 8.5.2(@types/node@26.1.2)
'@pnpm/bins.resolver':
specifier: workspace:*
version: link:../../bins/resolver
@@ -9598,7 +9595,7 @@ importers:
version: link:../store/index
'@rushstack/worker-pool':
specifier: 'catalog:'
version: 0.7.22(@types/node@22.20.1)
version: 0.7.22(@types/node@26.1.2)
is-windows:
specifier: 'catalog:'
version: 1.0.2
@@ -17887,48 +17884,48 @@ snapshots:
'@inquirer/ansi@2.0.7': {}
'@inquirer/checkbox@5.2.1(@types/node@22.20.1)':
'@inquirer/checkbox@5.2.1(@types/node@26.1.2)':
dependencies:
'@inquirer/ansi': 2.0.7
'@inquirer/core': 11.2.1(@types/node@22.20.1)
'@inquirer/core': 11.2.1(@types/node@26.1.2)
'@inquirer/figures': 2.0.7
'@inquirer/type': 4.0.7(@types/node@22.20.1)
'@inquirer/type': 4.0.7(@types/node@26.1.2)
optionalDependencies:
'@types/node': 22.20.1
'@types/node': 26.1.2
'@inquirer/confirm@6.1.1(@types/node@22.20.1)':
'@inquirer/confirm@6.1.1(@types/node@26.1.2)':
dependencies:
'@inquirer/core': 11.2.1(@types/node@22.20.1)
'@inquirer/type': 4.0.7(@types/node@22.20.1)
'@inquirer/core': 11.2.1(@types/node@26.1.2)
'@inquirer/type': 4.0.7(@types/node@26.1.2)
optionalDependencies:
'@types/node': 22.20.1
'@types/node': 26.1.2
'@inquirer/core@11.2.1(@types/node@22.20.1)':
'@inquirer/core@11.2.1(@types/node@26.1.2)':
dependencies:
'@inquirer/ansi': 2.0.7
'@inquirer/figures': 2.0.7
'@inquirer/type': 4.0.7(@types/node@22.20.1)
'@inquirer/type': 4.0.7(@types/node@26.1.2)
cli-width: 4.1.0
fast-wrap-ansi: 0.2.2
mute-stream: 3.0.0
signal-exit: 4.1.0
optionalDependencies:
'@types/node': 22.20.1
'@types/node': 26.1.2
'@inquirer/editor@5.2.2(@types/node@22.20.1)':
'@inquirer/editor@5.2.2(@types/node@26.1.2)':
dependencies:
'@inquirer/core': 11.2.1(@types/node@22.20.1)
'@inquirer/external-editor': 3.0.3(@types/node@22.20.1)
'@inquirer/type': 4.0.7(@types/node@22.20.1)
'@inquirer/core': 11.2.1(@types/node@26.1.2)
'@inquirer/external-editor': 3.0.3(@types/node@26.1.2)
'@inquirer/type': 4.0.7(@types/node@26.1.2)
optionalDependencies:
'@types/node': 22.20.1
'@types/node': 26.1.2
'@inquirer/expand@5.1.1(@types/node@22.20.1)':
'@inquirer/expand@5.1.1(@types/node@26.1.2)':
dependencies:
'@inquirer/core': 11.2.1(@types/node@22.20.1)
'@inquirer/type': 4.0.7(@types/node@22.20.1)
'@inquirer/core': 11.2.1(@types/node@26.1.2)
'@inquirer/type': 4.0.7(@types/node@26.1.2)
optionalDependencies:
'@types/node': 22.20.1
'@types/node': 26.1.2
'@inquirer/external-editor@1.0.3(@types/node@22.20.1)':
dependencies:
@@ -17937,81 +17934,81 @@ snapshots:
optionalDependencies:
'@types/node': 22.20.1
'@inquirer/external-editor@3.0.3(@types/node@22.20.1)':
'@inquirer/external-editor@3.0.3(@types/node@26.1.2)':
dependencies:
chardet: 2.2.0
iconv-lite: 0.7.3
optionalDependencies:
'@types/node': 22.20.1
'@types/node': 26.1.2
'@inquirer/figures@1.0.15': {}
'@inquirer/figures@2.0.7': {}
'@inquirer/input@5.1.2(@types/node@22.20.1)':
'@inquirer/input@5.1.2(@types/node@26.1.2)':
dependencies:
'@inquirer/core': 11.2.1(@types/node@22.20.1)
'@inquirer/type': 4.0.7(@types/node@22.20.1)
'@inquirer/core': 11.2.1(@types/node@26.1.2)
'@inquirer/type': 4.0.7(@types/node@26.1.2)
optionalDependencies:
'@types/node': 22.20.1
'@types/node': 26.1.2
'@inquirer/number@4.1.1(@types/node@22.20.1)':
'@inquirer/number@4.1.1(@types/node@26.1.2)':
dependencies:
'@inquirer/core': 11.2.1(@types/node@22.20.1)
'@inquirer/type': 4.0.7(@types/node@22.20.1)
'@inquirer/core': 11.2.1(@types/node@26.1.2)
'@inquirer/type': 4.0.7(@types/node@26.1.2)
optionalDependencies:
'@types/node': 22.20.1
'@types/node': 26.1.2
'@inquirer/password@5.1.1(@types/node@22.20.1)':
'@inquirer/password@5.1.1(@types/node@26.1.2)':
dependencies:
'@inquirer/ansi': 2.0.7
'@inquirer/core': 11.2.1(@types/node@22.20.1)
'@inquirer/type': 4.0.7(@types/node@22.20.1)
'@inquirer/core': 11.2.1(@types/node@26.1.2)
'@inquirer/type': 4.0.7(@types/node@26.1.2)
optionalDependencies:
'@types/node': 22.20.1
'@types/node': 26.1.2
'@inquirer/prompts@8.5.2(@types/node@22.20.1)':
'@inquirer/prompts@8.5.2(@types/node@26.1.2)':
dependencies:
'@inquirer/checkbox': 5.2.1(@types/node@22.20.1)
'@inquirer/confirm': 6.1.1(@types/node@22.20.1)
'@inquirer/editor': 5.2.2(@types/node@22.20.1)
'@inquirer/expand': 5.1.1(@types/node@22.20.1)
'@inquirer/input': 5.1.2(@types/node@22.20.1)
'@inquirer/number': 4.1.1(@types/node@22.20.1)
'@inquirer/password': 5.1.1(@types/node@22.20.1)
'@inquirer/rawlist': 5.3.1(@types/node@22.20.1)
'@inquirer/search': 4.2.1(@types/node@22.20.1)
'@inquirer/select': 5.2.1(@types/node@22.20.1)
'@inquirer/checkbox': 5.2.1(@types/node@26.1.2)
'@inquirer/confirm': 6.1.1(@types/node@26.1.2)
'@inquirer/editor': 5.2.2(@types/node@26.1.2)
'@inquirer/expand': 5.1.1(@types/node@26.1.2)
'@inquirer/input': 5.1.2(@types/node@26.1.2)
'@inquirer/number': 4.1.1(@types/node@26.1.2)
'@inquirer/password': 5.1.1(@types/node@26.1.2)
'@inquirer/rawlist': 5.3.1(@types/node@26.1.2)
'@inquirer/search': 4.2.1(@types/node@26.1.2)
'@inquirer/select': 5.2.1(@types/node@26.1.2)
optionalDependencies:
'@types/node': 22.20.1
'@types/node': 26.1.2
'@inquirer/rawlist@5.3.1(@types/node@22.20.1)':
'@inquirer/rawlist@5.3.1(@types/node@26.1.2)':
dependencies:
'@inquirer/core': 11.2.1(@types/node@22.20.1)
'@inquirer/type': 4.0.7(@types/node@22.20.1)
'@inquirer/core': 11.2.1(@types/node@26.1.2)
'@inquirer/type': 4.0.7(@types/node@26.1.2)
optionalDependencies:
'@types/node': 22.20.1
'@types/node': 26.1.2
'@inquirer/search@4.2.1(@types/node@22.20.1)':
'@inquirer/search@4.2.1(@types/node@26.1.2)':
dependencies:
'@inquirer/core': 11.2.1(@types/node@22.20.1)
'@inquirer/core': 11.2.1(@types/node@26.1.2)
'@inquirer/figures': 2.0.7
'@inquirer/type': 4.0.7(@types/node@22.20.1)
'@inquirer/type': 4.0.7(@types/node@26.1.2)
optionalDependencies:
'@types/node': 22.20.1
'@types/node': 26.1.2
'@inquirer/select@5.2.1(@types/node@22.20.1)':
'@inquirer/select@5.2.1(@types/node@26.1.2)':
dependencies:
'@inquirer/ansi': 2.0.7
'@inquirer/core': 11.2.1(@types/node@22.20.1)
'@inquirer/core': 11.2.1(@types/node@26.1.2)
'@inquirer/figures': 2.0.7
'@inquirer/type': 4.0.7(@types/node@22.20.1)
'@inquirer/type': 4.0.7(@types/node@26.1.2)
optionalDependencies:
'@types/node': 22.20.1
'@types/node': 26.1.2
'@inquirer/type@4.0.7(@types/node@22.20.1)':
'@inquirer/type@4.0.7(@types/node@26.1.2)':
optionalDependencies:
'@types/node': 22.20.1
'@types/node': 26.1.2
'@isaacs/cliui@9.0.0': {}
@@ -18348,9 +18345,9 @@ snapshots:
'@npmcli/redact@4.0.0': {}
'@openpgp/web-stream-tools@0.3.1(@types/node@22.20.1)(typescript@6.0.3)':
'@openpgp/web-stream-tools@0.3.1(@types/node@26.1.2)(typescript@6.0.3)':
optionalDependencies:
'@types/node': 22.20.1
'@types/node': 26.1.2
typescript: 6.0.3
'@pkgr/core@0.3.6': {}
@@ -19530,9 +19527,9 @@ snapshots:
optionalDependencies:
'@types/node': 22.20.1
'@rushstack/worker-pool@0.7.22(@types/node@22.20.1)':
'@rushstack/worker-pool@0.7.22(@types/node@26.1.2)':
optionalDependencies:
'@types/node': 22.20.1
'@types/node': 26.1.2
'@sec-ant/readable-stream@0.4.1': {}
@@ -23544,9 +23541,9 @@ snapshots:
is-docker: 2.2.1
is-wsl: 2.2.0
openpgp@6.3.1(@openpgp/web-stream-tools@0.3.1(@types/node@22.20.1)(typescript@6.0.3)):
openpgp@6.3.1(@openpgp/web-stream-tools@0.3.1(@types/node@26.1.2)(typescript@6.0.3)):
optionalDependencies:
'@openpgp/web-stream-tools': 0.3.1(@types/node@22.20.1)(typescript@6.0.3)
'@openpgp/web-stream-tools': 0.3.1(@types/node@26.1.2)(typescript@6.0.3)
opt-cli@1.5.1:
dependencies:
-1
View File
@@ -38,7 +38,6 @@
},
"dependencies": {
"@pnpm/cli.meta": "workspace:*",
"@pnpm/config.reader": "workspace:*",
"@pnpm/core-loggers": "workspace:*",
"@pnpm/deps.inspection.peers-issues-renderer": "workspace:*",
"@pnpm/error": "workspace:*",
@@ -0,0 +1,24 @@
import type * as logs from '@pnpm/core-loggers'
/**
* The slice of pnpm's resolved config the reporter reads. Structural on
* purpose: the pnpm CLI passes its full `Config`, while other hosts (for
* example Bit, which drives the engine through `@pnpm/napi`) can pass just
* the fields they have without depending on `@pnpm/config.reader`.
*/
export interface ReporterPnpmConfig {
dir?: string
workspaceDir?: string
global?: boolean
recursive?: boolean
production?: boolean
dev?: boolean
optional?: boolean
saveDev?: boolean
strictDepBuilds?: boolean
authConfig?: Record<string, string>
cliOptions?: Record<string, unknown>
hooks?: {
filterLog?: Array<(log: logs.Log) => boolean>
}
}
+3 -3
View File
@@ -1,4 +1,3 @@
import type { Config, ConfigContext } from '@pnpm/config.reader'
import type * as logs from '@pnpm/core-loggers'
import type { LogLevel, StreamParser } from '@pnpm/logger'
import createDiffer from 'ansi-diff'
@@ -10,6 +9,7 @@ import { mergeOutputs } from './mergeOutputs.js'
import { reporterForClient } from './reporterForClient/index.js'
import type { FilterPkgsDiff } from './reporterForClient/reportSummary.js'
import { formatWarn } from './reporterForClient/utils/formatWarn.js'
import type { ReporterPnpmConfig } from './ReporterPnpmConfig.js'
export { formatWarn }
@@ -38,7 +38,7 @@ export function initDefaultReporter (
}
context: {
argv: string[]
config?: Config & ConfigContext
config?: ReporterPnpmConfig
env?: NodeJS.ProcessEnv
process?: NodeJS.Process
}
@@ -139,7 +139,7 @@ export function toOutput$ (
}
context: {
argv: string[]
config?: Config & ConfigContext
config?: ReporterPnpmConfig
env?: NodeJS.ProcessEnv
process?: NodeJS.Process
}
@@ -1,4 +1,3 @@
import type { Config } from '@pnpm/config.reader'
import type { Log } from '@pnpm/core-loggers'
import { renderPeerIssues } from '@pnpm/deps.inspection.peers-issues-renderer'
import type { PnpmError } from '@pnpm/error'
@@ -10,6 +9,7 @@ import { equals } from 'ramda'
import StackTracey from 'stacktracey'
import { EOL } from './constants.js'
import type { ReporterPnpmConfig } from './ReporterPnpmConfig.js'
StackTracey.maxColumnWidths = {
callee: 25,
@@ -20,7 +20,7 @@ StackTracey.maxColumnWidths = {
const highlight = chalk.yellow
const colorPath = chalk.gray
export function reportError (logObj: Log, config?: Config): string | null {
export function reportError (logObj: Log, config?: ReporterPnpmConfig): string | null {
const errorInfo = getErrorInfo(logObj, config)
if (!errorInfo) return null
let output = formatErrorSummary(errorInfo.title, (logObj as LogObjWithPossibleError).err?.code)
@@ -50,7 +50,7 @@ interface ErrorInfo {
body?: string
}
function getErrorInfo (logObj: Log, config?: Config): ErrorInfo | null {
function getErrorInfo (logObj: Log, config?: ReporterPnpmConfig): ErrorInfo | null {
if ('err' in logObj && logObj.err) {
const err = logObj.err as (PnpmError & { stack: object })
switch (err.code) {
@@ -426,7 +426,7 @@ To fix this issue, install the required Node version.`
function reportAuthError (
err: Error,
msg: { hint?: string },
config?: Config
config?: ReporterPnpmConfig
): ErrorInfo {
const foundSettings = [] as string[]
for (const [key, value] of Object.entries(config?.authConfig ?? {})) {
@@ -1,9 +1,9 @@
import type { Config, ConfigContext } from '@pnpm/config.reader'
import type * as logs from '@pnpm/core-loggers'
import type { LogLevel } from '@pnpm/logger'
import type * as Rx from 'rxjs'
import { throttleTime } from 'rxjs/operators'
import type { ReporterPnpmConfig } from '../ReporterPnpmConfig.js'
import { reportBigTarballProgress } from './reportBigTarballsProgress.js'
import { reportContext } from './reportContext.js'
import { reportDeprecations } from './reportDeprecations.js'
@@ -62,13 +62,13 @@ export function reporterForClient (
opts: {
appendOnly?: boolean
cmd: string
config?: Config
config?: ReporterPnpmConfig
env: NodeJS.ProcessEnv
filterPkgsDiff?: FilterPkgsDiff
process: NodeJS.Process
isRecursive: boolean
logLevel?: LogLevel
pnpmConfig?: Config & ConfigContext
pnpmConfig?: ReporterPnpmConfig
streamLifecycleOutput?: boolean
aggregateOutput?: boolean
throttleProgress?: number
@@ -1,16 +1,17 @@
import type { Config, ConfigContext } from '@pnpm/config.reader'
import type { IgnoredScriptsLog } from '@pnpm/core-loggers'
import { lexCompare } from '@pnpm/util.lex-comparator'
import boxen from 'boxen'
import * as Rx from 'rxjs'
import { map } from 'rxjs/operators'
import type { ReporterPnpmConfig } from '../ReporterPnpmConfig.js'
export function reportIgnoredBuilds (
log$: {
ignoredScripts: Rx.Observable<IgnoredScriptsLog>
},
opts: {
pnpmConfig?: Config & ConfigContext
pnpmConfig?: ReporterPnpmConfig
// This is used by Bit CLI
approveBuildsInstructionText?: string
}
@@ -1,11 +1,11 @@
import os from 'node:os'
import type { Config } from '@pnpm/config.reader'
import type { Log, RegistryLog } from '@pnpm/core-loggers'
import type { LogLevel } from '@pnpm/logger'
import * as Rx from 'rxjs'
import { filter, map } from 'rxjs/operators'
import type { ReporterPnpmConfig } from '../ReporterPnpmConfig.js'
import { reportError } from '../reportError.js'
import { formatWarn } from './utils/formatWarn.js'
import { autozoom } from './utils/zooming.js'
@@ -30,7 +30,7 @@ export function reportMisc (
appendOnly: boolean
cwd: string
logLevel?: LogLevel
config?: Config
config?: ReporterPnpmConfig
zoomOutCurrent: boolean
}
): Rx.Observable<Rx.Observable<{ msg: string }>> {
@@ -1,6 +1,5 @@
import path from 'node:path'
import type { Config } from '@pnpm/config.reader'
import type {
DeprecationLog,
PackageManifestLog,
@@ -13,6 +12,7 @@ import { map, take } from 'rxjs/operators'
import semver from 'semver'
import { EOL } from '../constants.js'
import type { ReporterPnpmConfig } from '../ReporterPnpmConfig.js'
import {
ADDED_CHAR,
REMOVED_CHAR,
@@ -45,7 +45,7 @@ export function reportSummary (
cwd: string
env: NodeJS.ProcessEnv
filterPkgsDiff?: FilterPkgsDiff
pnpmConfig?: Config
pnpmConfig?: ReporterPnpmConfig
}
): Rx.Observable<Rx.Observable<{ msg: string }>> {
const pkgsDiff$ = getPkgsDiff(log$, { prefix: opts.pnpmConfig?.global ? undefined : opts.cwd })
@@ -91,7 +91,7 @@ function printDiffs (
opts: {
cmd: string
prefix: string
pnpmConfig?: Config
pnpmConfig?: ReporterPnpmConfig
},
pkgsDiff: PackageDiff[],
depType: string
+24 -24
View File
@@ -3,7 +3,6 @@ import path from 'node:path'
import { expect, test } from '@jest/globals'
import { toOutput$ } from '@pnpm/cli.default-reporter'
import type { Config, ConfigContext } from '@pnpm/config.reader'
import {
deprecationLogger,
hookLogger,
@@ -26,6 +25,7 @@ import { firstValueFrom } from 'rxjs'
import { map, skip, take } from 'rxjs/operators'
import { formatWarn } from '../src/reporterForClient/utils/formatWarn.js'
import type { ReporterPnpmConfig } from '../src/ReporterPnpmConfig.js'
const formatErrorCode = (code: string) => chalk.bgRed.red('[') + chalk.bgRed.black(code) + chalk.bgRed.red(']')
const formatError = (code: string, message: string) => {
@@ -44,7 +44,7 @@ test('prints summary (of current package only)', async () => {
const output$ = toOutput$({
context: {
argv: ['install'],
config: { dir: prefix } as Config & ConfigContext,
config: { dir: prefix } as ReporterPnpmConfig,
},
streamParser: createStreamParser(),
})
@@ -236,7 +236,7 @@ test('prints summary without the filtered out entries', async () => {
argv: ['install'],
config: {
dir: prefix,
} as Config & ConfigContext,
} as ReporterPnpmConfig,
},
streamParser: createStreamParser(),
filterPkgsDiff: (diff) => diff.name !== 'bar',
@@ -308,7 +308,7 @@ test('does not print "(X is available)" when latest equals the installed version
const output$ = toOutput$({
context: {
argv: ['install'],
config: { dir: prefix } as Config & ConfigContext,
config: { dir: prefix } as ReporterPnpmConfig,
},
streamParser: createStreamParser(),
})
@@ -348,7 +348,7 @@ test('does not print deprecation message when log level is set to error', async
const output$ = toOutput$({
context: {
argv: ['install'],
config: { dir: prefix } as Config & ConfigContext,
config: { dir: prefix } as ReporterPnpmConfig,
},
reportingOptions: {
logLevel: 'error',
@@ -406,7 +406,7 @@ test('prints summary for global installation', async () => {
config: {
dir: prefix,
global: true,
} as Config & ConfigContext,
} as ReporterPnpmConfig,
},
streamParser: createStreamParser(),
})
@@ -463,7 +463,7 @@ test('prints added peer dependency', async () => {
argv: ['install'],
config: {
dir: prefix,
} as Config & ConfigContext,
} as ReporterPnpmConfig,
},
streamParser: createStreamParser(),
})
@@ -504,7 +504,7 @@ test('prints summary correctly when the same package is specified both in option
argv: ['install'],
config: {
dir: prefix,
} as Config & ConfigContext,
} as ReporterPnpmConfig,
},
streamParser: createStreamParser(),
})
@@ -566,7 +566,7 @@ test('in the installation summary report which dependency types are skipped', as
production: true,
dev: false,
optional: false,
} as Config & ConfigContext,
} as ReporterPnpmConfig,
env: {
NODE_ENV: 'production',
},
@@ -627,7 +627,7 @@ ${h1('devDependencies:')} skipped
test('prints summary when some packages fail', async () => {
const output$ = toOutput$({
context: { argv: ['run'], config: { recursive: true } as Config & ConfigContext },
context: { argv: ['run'], config: { recursive: true } as ReporterPnpmConfig },
streamParser: createStreamParser(),
})
@@ -866,7 +866,7 @@ test('prints added/removed stats and warnings during recursive installation', as
const output$ = toOutput$({
context: {
argv: ['install'],
config: { dir: rootPrefix, recursive: true } as Config & ConfigContext,
config: { dir: rootPrefix, recursive: true } as ReporterPnpmConfig,
},
streamParser: createStreamParser(),
})
@@ -925,7 +925,7 @@ test('recursive installation: prints only the added stats if nothing was removed
const output$ = toOutput$({
context: {
argv: ['recursive'],
config: { dir: '/home/jane/repo' } as Config & ConfigContext,
config: { dir: '/home/jane/repo' } as ReporterPnpmConfig,
},
reportingOptions: { outputMaxWidth: 60 },
streamParser: createStreamParser(),
@@ -944,7 +944,7 @@ test('recursive installation: prints only the removed stats if nothing was added
const output$ = toOutput$({
context: {
argv: ['recursive'],
config: { dir: '/home/jane/repo' } as Config & ConfigContext,
config: { dir: '/home/jane/repo' } as ReporterPnpmConfig,
},
reportingOptions: { outputMaxWidth: 60 },
streamParser: createStreamParser(),
@@ -963,7 +963,7 @@ test('recursive installation: prints at least one remove sign when removed !== 0
const output$ = toOutput$({
context: {
argv: ['recursive'],
config: { dir: '/home/jane/repo' } as Config & ConfigContext,
config: { dir: '/home/jane/repo' } as ReporterPnpmConfig,
},
reportingOptions: { outputMaxWidth: 62 },
streamParser: createStreamParser(),
@@ -982,7 +982,7 @@ test('recursive installation: prints at least one add sign when added !== 0', as
const output$ = toOutput$({
context: {
argv: ['recursive'],
config: { dir: '/home/jane/repo' } as Config & ConfigContext,
config: { dir: '/home/jane/repo' } as ReporterPnpmConfig,
},
reportingOptions: { outputMaxWidth: 62 },
streamParser: createStreamParser(),
@@ -1001,7 +1001,7 @@ test('recursive uninstall: prints removed packages number', async () => {
const output$ = toOutput$({
context: {
argv: ['remove'],
config: { dir: '/home/jane/repo', recursive: true } as Config & ConfigContext,
config: { dir: '/home/jane/repo', recursive: true } as ReporterPnpmConfig,
},
reportingOptions: { outputMaxWidth: 62 },
streamParser: createStreamParser(),
@@ -1019,7 +1019,7 @@ test('install: print hook message', async () => {
const output$ = toOutput$({
context: {
argv: ['install'],
config: { dir: '/home/jane/repo' } as Config & ConfigContext,
config: { dir: '/home/jane/repo' } as ReporterPnpmConfig,
},
streamParser: createStreamParser(),
})
@@ -1041,7 +1041,7 @@ test('recursive: print hook message', async () => {
const output$ = toOutput$({
context: {
argv: ['recursive'],
config: { dir: '/home/jane/repo' } as Config & ConfigContext,
config: { dir: '/home/jane/repo' } as ReporterPnpmConfig,
},
streamParser: createStreamParser(),
})
@@ -1064,7 +1064,7 @@ test('prints skipped optional dependency info message', async () => {
const output$ = toOutput$({
context: {
argv: ['install'],
config: { dir: prefix } as Config & ConfigContext,
config: { dir: prefix } as ReporterPnpmConfig,
},
streamParser: createStreamParser(),
})
@@ -1093,7 +1093,7 @@ test('logLevel=default', async () => {
const output$ = toOutput$({
context: {
argv: ['install'],
config: { dir: prefix } as Config & ConfigContext,
config: { dir: prefix } as ReporterPnpmConfig,
},
streamParser: createStreamParser(),
})
@@ -1116,7 +1116,7 @@ test('logLevel=warn', async () => {
const output$ = toOutput$({
context: {
argv: ['install'],
config: { dir: prefix } as Config & ConfigContext,
config: { dir: prefix } as ReporterPnpmConfig,
},
reportingOptions: {
logLevel: 'warn',
@@ -1141,7 +1141,7 @@ test('logLevel=error', async () => {
const output$ = toOutput$({
context: {
argv: ['install'],
config: { dir: prefix } as Config & ConfigContext,
config: { dir: prefix } as ReporterPnpmConfig,
},
reportingOptions: {
logLevel: 'error',
@@ -1165,7 +1165,7 @@ test('warnings are collapsed', async () => {
const output$ = toOutput$({
context: {
argv: ['install'],
config: { dir: prefix } as Config & ConfigContext,
config: { dir: prefix } as ReporterPnpmConfig,
},
reportingOptions: {
logLevel: 'warn',
@@ -1197,7 +1197,7 @@ test('warnings are not collapsed when append-only is true', async () => {
const output$ = toOutput$({
context: {
argv: ['install'],
config: { dir: prefix } as Config & ConfigContext,
config: { dir: prefix } as ReporterPnpmConfig,
},
reportingOptions: {
appendOnly: true,
@@ -2,7 +2,6 @@ import { stripVTControlCharacters as stripAnsi } from 'node:util'
import { expect, test } from '@jest/globals'
import { initDefaultReporter } from '@pnpm/cli.default-reporter'
import type { Config, ConfigContext } from '@pnpm/config.reader'
import type * as logs from '@pnpm/core-loggers'
import {
lockfileVerificationLogger,
@@ -14,6 +13,8 @@ import {
import type { StreamParser } from '@pnpm/logger'
import { createStreamParser } from '@pnpm/logger'
import type { ReporterPnpmConfig } from '../src/ReporterPnpmConfig.js'
const ERASE_TO_END_OF_DISPLAY = '\x1b[0J'
const LOCKFILE_TEXT = 'Lockfile passes supply-chain policies'
@@ -61,7 +62,7 @@ test('differential renderer does not reprint unchanged sticky blocks', async ()
reportingOptions: { throttleProgress: 0 },
context: {
argv: ['install'],
config: { dir: cwd } as Config & ConfigContext,
config: { dir: cwd } as ReporterPnpmConfig,
process: mockProcess as unknown as NodeJS.Process,
},
})
@@ -124,7 +125,7 @@ test('each write clears external output below the frame', async () => {
reportingOptions: { throttleProgress: 0 },
context: {
argv: ['install'],
config: { dir: cwd } as Config & ConfigContext,
config: { dir: cwd } as ReporterPnpmConfig,
process: mockProcess as unknown as NodeJS.Process,
},
})
@@ -172,7 +173,7 @@ test('holds frame redraws while an interactive prompt owns the terminal', async
reportingOptions: { throttleProgress: 0 },
context: {
argv: ['install'],
config: { dir: cwd } as Config & ConfigContext,
config: { dir: cwd } as ReporterPnpmConfig,
process: mockProcess as unknown as NodeJS.Process,
},
})
@@ -1,6 +1,5 @@
import { expect, test } from '@jest/globals'
import { toOutput$ } from '@pnpm/cli.default-reporter'
import type { Config, ConfigContext } from '@pnpm/config.reader'
import {
deprecationLogger,
stageLogger,
@@ -12,13 +11,14 @@ import { firstValueFrom } from 'rxjs'
import { map, take } from 'rxjs/operators'
import { formatWarn } from '../src/reporterForClient/utils/formatWarn.js'
import type { ReporterPnpmConfig } from '../src/ReporterPnpmConfig.js'
test('prints summary of deprecated subdependencies', async () => {
const prefix = '/home/jane/project'
const output$ = toOutput$({
context: {
argv: ['install'],
config: { dir: prefix } as Config & ConfigContext,
config: { dir: prefix } as ReporterPnpmConfig,
},
streamParser: createStreamParser(),
})
@@ -3,17 +3,18 @@ import { stripVTControlCharacters as stripAnsi } from 'node:util'
import { expect, test } from '@jest/globals'
import { toOutput$ } from '@pnpm/cli.default-reporter'
import type { Config, ConfigContext } from '@pnpm/config.reader'
import { lockfileVerificationLogger } from '@pnpm/core-loggers'
import { createStreamParser } from '@pnpm/logger'
import { firstValueFrom, take, toArray } from 'rxjs'
import type { ReporterPnpmConfig } from '../src/ReporterPnpmConfig.js'
test('prints lockfile verification in-progress and completion messages', async () => {
const cwd = '/repo'
const output$ = toOutput$({
context: {
argv: ['install'],
config: { dir: cwd } as Config & ConfigContext,
config: { dir: cwd } as ReporterPnpmConfig,
},
streamParser: createStreamParser(),
})
@@ -62,7 +63,7 @@ test('prints relative path when lockfile lives outside the workspace root', asyn
const output$ = toOutput$({
context: {
argv: ['install'],
config: { dir: cwd, workspaceDir } as Config & ConfigContext,
config: { dir: cwd, workspaceDir } as ReporterPnpmConfig,
},
streamParser: createStreamParser(),
})
@@ -90,7 +91,7 @@ test('does not print path when running from workspace subdir and lockfile is at
const output$ = toOutput$({
context: {
argv: ['install'],
config: { dir: cwd, workspaceDir } as Config & ConfigContext,
config: { dir: cwd, workspaceDir } as ReporterPnpmConfig,
},
streamParser: createStreamParser(),
})
@@ -112,7 +113,7 @@ test('suppresses path when workspaceDir has a trailing separator', async () => {
const output$ = toOutput$({
context: {
argv: ['install'],
config: { dir: cwd, workspaceDir } as Config & ConfigContext,
config: { dir: cwd, workspaceDir } as ReporterPnpmConfig,
},
streamParser: createStreamParser(),
})
@@ -134,7 +135,7 @@ test('prints a previously-verified line when the cached verdict is reused', asyn
const output$ = toOutput$({
context: {
argv: ['install'],
config: { dir: cwd } as Config & ConfigContext,
config: { dir: cwd } as ReporterPnpmConfig,
},
streamParser: createStreamParser(),
})
@@ -1,6 +1,5 @@
import { expect, test } from '@jest/globals'
import { toOutput$ } from '@pnpm/cli.default-reporter'
import type { Config, ConfigContext } from '@pnpm/config.reader'
import {
fetchingProgressLogger,
progressLogger,
@@ -17,6 +16,7 @@ import { firstValueFrom } from 'rxjs'
import { map, skip, take, toArray } from 'rxjs/operators'
import { formatWarn } from '../src/reporterForClient/utils/formatWarn.js'
import type { ReporterPnpmConfig } from '../src/ReporterPnpmConfig.js'
const hlValue = chalk.cyanBright
@@ -26,7 +26,7 @@ test('prints progress beginning', async () => {
const output$ = toOutput$({
context: {
argv: ['install'],
config: { dir: '/src/project' } as Config & ConfigContext,
config: { dir: '/src/project' } as ReporterPnpmConfig,
},
streamParser: createStreamParser(),
})
@@ -51,7 +51,7 @@ test('prints progress without added packages stats', async () => {
const output$ = toOutput$({
context: {
argv: ['install'],
config: { dir: '/src/project' } as Config & ConfigContext,
config: { dir: '/src/project' } as ReporterPnpmConfig,
},
reportingOptions: {
hideAddedPkgsProgress: true,
@@ -79,7 +79,7 @@ test('prints all progress stats', async () => {
const output$ = toOutput$({
context: {
argv: ['install'],
config: { dir: '/src/project' } as Config & ConfigContext,
config: { dir: '/src/project' } as ReporterPnpmConfig,
},
streamParser: createStreamParser(),
})
@@ -120,7 +120,7 @@ test('prints progress beginning of node_modules from not cwd', async () => {
const output$ = toOutput$({
context: {
argv: ['install'],
config: { dir: '/src/projects' } as Config & ConfigContext,
config: { dir: '/src/projects' } as ReporterPnpmConfig,
},
streamParser: createStreamParser(),
})
@@ -145,7 +145,7 @@ test('prints progress beginning of node_modules from not cwd, when progress pref
const output$ = toOutput$({
context: {
argv: ['install'],
config: { dir: '/src/projects' } as Config & ConfigContext,
config: { dir: '/src/projects' } as ReporterPnpmConfig,
},
streamParser: createStreamParser(),
reportingOptions: {
@@ -173,7 +173,7 @@ test('prints progress beginning when appendOnly is true', async () => {
const output$ = toOutput$({
context: {
argv: ['install'],
config: { dir: '/src/project' } as Config & ConfigContext,
config: { dir: '/src/project' } as ReporterPnpmConfig,
},
reportingOptions: {
appendOnly: true,
@@ -204,7 +204,7 @@ test('prints progress beginning during recursive install', async () => {
config: {
dir: '/src/project',
recursive: true,
} as Config & ConfigContext,
} as ReporterPnpmConfig,
},
streamParser: createStreamParser(),
})
@@ -231,7 +231,7 @@ test('prints progress on first download', async () => {
const output$ = toOutput$({
context: {
argv: ['install'],
config: { dir: '/src/project' } as Config & ConfigContext,
config: { dir: '/src/project' } as ReporterPnpmConfig,
},
reportingOptions: { throttleProgress: 0 },
streamParser: createStreamParser(),
@@ -265,7 +265,7 @@ test('moves fixed line to the end', async () => {
const output$ = toOutput$({
context: {
argv: ['install'],
config: { dir: prefix } as Config & ConfigContext,
config: { dir: prefix } as ReporterPnpmConfig,
},
reportingOptions: { throttleProgress: 0 },
streamParser: createStreamParser(),
@@ -327,7 +327,7 @@ test('prints progress of big files download', async () => {
const output$ = toOutput$({
context: {
argv: ['install'],
config: { dir: '/src/project' } as Config & ConfigContext,
config: { dir: '/src/project' } as ReporterPnpmConfig,
},
reportingOptions: { throttleProgress: 0 },
streamParser: createStreamParser(),
@@ -2,11 +2,12 @@ import { setTimeout } from 'node:timers/promises'
import { expect, test } from '@jest/globals'
import { toOutput$ } from '@pnpm/cli.default-reporter'
import type { Config, ConfigContext } from '@pnpm/config.reader'
import { scopeLogger } from '@pnpm/core-loggers'
import { createStreamParser } from '@pnpm/logger'
import { firstValueFrom } from 'rxjs'
import type { ReporterPnpmConfig } from '../src/ReporterPnpmConfig.js'
const NO_OUTPUT = Symbol('test should not log anything')
test('does not print scope of non-recursive install in a workspace', async () => {
@@ -34,7 +35,7 @@ test('prints scope of recursive install in a workspace when not all packages are
const output$ = toOutput$({
context: {
argv: ['install'],
config: { recursive: true } as Config & ConfigContext,
config: { recursive: true } as ReporterPnpmConfig,
},
streamParser: createStreamParser(),
})
@@ -55,7 +56,7 @@ test('prints scope of recursive install in a workspace when all packages are sel
const output$ = toOutput$({
context: {
argv: ['install'],
config: { recursive: true } as Config & ConfigContext,
config: { recursive: true } as ReporterPnpmConfig,
},
streamParser: createStreamParser(),
})
@@ -76,7 +77,7 @@ test('prints scope of recursive install not in a workspace when not all packages
const output$ = toOutput$({
context: {
argv: ['install'],
config: { recursive: true } as Config & ConfigContext,
config: { recursive: true } as ReporterPnpmConfig,
},
streamParser: createStreamParser(),
})
@@ -96,7 +97,7 @@ test('prints scope of recursive install not in a workspace when all packages are
const output$ = toOutput$({
context: {
argv: ['install'],
config: { recursive: true } as Config & ConfigContext,
config: { recursive: true } as ReporterPnpmConfig,
},
streamParser: createStreamParser(),
})
@@ -3,11 +3,12 @@ import { stripVTControlCharacters as stripAnsi } from 'node:util'
import { expect, test } from '@jest/globals'
import { toOutput$ } from '@pnpm/cli.default-reporter'
import type { Config, ConfigContext } from '@pnpm/config.reader'
import { updateCheckLogger } from '@pnpm/core-loggers'
import { createStreamParser } from '@pnpm/logger'
import { firstValueFrom } from 'rxjs'
import type { ReporterPnpmConfig } from '../src/ReporterPnpmConfig.js'
const NO_OUTPUT = Symbol('test should not log anything')
test('does not print update if latest is less than current', async () => {
@@ -36,7 +37,7 @@ test('print update notification if the latest version is greater than the curren
const output$ = toOutput$({
context: {
argv: ['install'],
config: { recursive: true } as Config & ConfigContext,
config: { recursive: true } as ReporterPnpmConfig,
env: {},
},
streamParser: createStreamParser(),
@@ -57,7 +58,7 @@ test('print update notification for Corepack if the latest version is greater th
const output$ = toOutput$({
context: {
argv: ['install'],
config: { recursive: true } as Config & ConfigContext,
config: { recursive: true } as ReporterPnpmConfig,
env: {
COREPACK_ROOT: '/usr/bin/corepack',
},
@@ -80,7 +81,7 @@ test('print update notification that suggests to use the standalone scripts for
const output$ = toOutput$({
context: {
argv: ['install'],
config: { recursive: true } as Config & ConfigContext,
config: { recursive: true } as ReporterPnpmConfig,
env: {
PNPM_HOME: '/home/user/.local/share/pnpm',
},
@@ -10,9 +10,6 @@
"../../__typings__/**/*.d.ts"
],
"references": [
{
"path": "../../config/reader"
},
{
"path": "../../core/core-loggers"
},