cordis 4.0.0-rc.6, plugin-loader, -include, -group, -timer, -hmr, -logger-console, cosmokit 1.8.1, schemastery 3.18.0 — copied from the cordis-workspace checkout, flattened under vendor/, original npm names, private: true. vendor/README.md is the manifest: upstream repos + commit SHAs, local-modification log, sync procedure. Local modification: hmr's locale YAML imports and .i18n() call removed (avoids a runtime YAML import hook we don't vendor).
29 lines
851 B
TypeScript
29 lines
851 B
TypeScript
import { Formatter } from 'cordis'
|
|
import { inspect } from 'node:util'
|
|
import supportsColor from 'supports-color'
|
|
import { ConsoleExporter as Base } from './shared.js'
|
|
|
|
/** Re-export shared console exporter config and base implementation. */
|
|
export * from './shared.js'
|
|
|
|
const inspectFormatter: Formatter = (value, target) => {
|
|
return inspect(value, { colors: !!target.colors, depth: Infinity, compact: true, breakLength: Infinity })
|
|
}
|
|
|
|
/** Node console exporter with `util.inspect` object formatting. */
|
|
export class ConsoleExporter extends Base {
|
|
formatters: Record<string, Formatter> = {
|
|
o: inspectFormatter,
|
|
O: inspectFormatter,
|
|
}
|
|
|
|
getDefaults() {
|
|
return {
|
|
...super.getDefaults(),
|
|
colors: (supportsColor.stdout ? supportsColor.stdout.level : 0) as false | 0 | 1 | 2 | 3,
|
|
}
|
|
}
|
|
}
|
|
|
|
export default ConsoleExporter
|