@platformatic/utils
Advanced tools
Comparing version 2.0.0-alpha.15 to 2.0.0-alpha.16
@@ -14,3 +14,3 @@ 'use strict' | ||
const match = require('./lib/match') | ||
const schemaComponents = require('./lib/fastify-schema') | ||
const schemaComponents = require('./lib/schema') | ||
const { createDirectory, safeRemove } = require('./lib/directory') | ||
@@ -36,2 +36,3 @@ const { withResolvers } = require('./lib/promises') | ||
module.exports.errors = errors | ||
module.exports.ensureLoggableError = errors.ensureLoggableError | ||
module.exports.match = match | ||
@@ -38,0 +39,0 @@ module.exports.schemaComponents = schemaComponents |
@@ -8,12 +8,27 @@ 'use strict' | ||
#write | ||
#ignoreEmpty | ||
#hadOutput | ||
constructor (options) { | ||
const { pino, level, ...opts } = options | ||
const { pino, level, ignoreEmpty, ...opts } = options | ||
super({ ...opts, decodeStrings: false }) | ||
this.#write = pino[level].bind(pino) | ||
this.#ignoreEmpty = ignoreEmpty | ||
this.#hadOutput = false | ||
} | ||
_write (chunk, encoding, callback) { | ||
this.#write({ raw: encoding === 'buffer' ? inspect(chunk) : chunk.toString(encoding ?? 'utf-8') }) | ||
const raw = encoding === 'buffer' ? inspect(chunk) : chunk.toString(encoding ?? 'utf-8') | ||
if (raw.trim().length === 0) { | ||
if (this.#ignoreEmpty && !this.#hadOutput) { | ||
callback() | ||
return | ||
} | ||
} else { | ||
this.#hadOutput = true | ||
} | ||
this.#write({ raw }) | ||
callback() | ||
@@ -25,4 +40,4 @@ } | ||
function createPinoWritable (pino, level) { | ||
const writable = new PinoWritable({ pino, level }) | ||
function createPinoWritable (pino, level, ignoreEmpty) { | ||
const writable = new PinoWritable({ pino, level, ignoreEmpty }) | ||
writable.write = writable.write.bind(writable) | ||
@@ -29,0 +44,0 @@ return writable |
{ | ||
"name": "@platformatic/utils", | ||
"version": "2.0.0-alpha.15", | ||
"version": "2.0.0-alpha.16", | ||
"description": "Platformatic Utils", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40001
992
1