From 2286bde5d9eae2f31aaeea086cfb184d95877e19 Mon Sep 17 00:00:00 2001 From: jaredhan Date: Wed, 27 Dec 2023 21:16:47 +0800 Subject: [PATCH] Add build function export in type define file. (#484) * Add build function export in type define file. * export build in index.js --- index.d.ts | 5 ++++- index.js | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) 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