diff --git a/index.d.ts b/index.d.ts index 50bb9571..614d3750 100644 --- a/index.d.ts +++ b/index.d.ts @@ -201,6 +201,8 @@ interface PrettyOptions_ { customColors?: string|object; } +declare function build(options: PrettyOptions_): PinoPretty.PrettyStream; + declare namespace PinoPretty { type Prettifier = (inputData: string | object) => string; type MessageFormatFunc = (log: LogDescriptor, messageKey: string, levelLabel: string) => string; @@ -208,7 +210,8 @@ declare namespace PinoPretty { type PrettyStream = Transform & OnUnknown; type ColorizerFactory = typeof colorizerFactory; type PrettyFactory = typeof prettyFactory; + type Build = typeof build; } export default PinoPretty; -export { PinoPretty, PrettyOptions_ as PrettyOptions, colorizerFactory, prettyFactory }; +export { build, PinoPretty, PrettyOptions_ as PrettyOptions, colorizerFactory, prettyFactory }; diff --git a/index.js b/index.js index 141fc8f2..3e500f8f 100644 --- a/index.js +++ b/index.js @@ -165,6 +165,7 @@ function build (opts = {}) { } module.exports = build +module.exports.build = build module.exports.prettyFactory = prettyFactory module.exports.colorizerFactory = colors module.exports.default = build