Restore explicit .ts relative specifiers in source and enable rewriteRelativeImportExtensions so emitted JS uses .js while declarations keep explicit .ts specifiers. Add a NodeNext declaration-consumer gate to prevent extensionless declaration regressions.
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.ts'
|
|
|
|
/** Re-export shared console exporter config and base implementation. */
|
|
export * from './shared.ts'
|
|
|
|
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
|