Skip to content

Commit

Permalink
Fix support for Pino v9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
segevfiner committed May 29, 2024
1 parent 657397a commit 58a8fb7
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export default function esbuildPluginPino({
}): Plugin {
return {
name: 'pino',
setup(currentBuild) {
async setup(currentBuild) {
const pino = path.dirname(require.resolve('pino'))
const threadStream = path.dirname(require.resolve('thread-stream'))

Expand All @@ -124,9 +124,18 @@ export default function esbuildPluginPino({
const customEntrypoints: Record<string, string> = {
'thread-stream-worker': path.join(threadStream, 'lib/worker.js'),
'pino-worker': path.join(pino, 'lib/worker.js'),
'pino-pipeline-worker': path.join(pino, 'lib/worker-pipeline.js'),
'pino-file': path.join(pino, 'file.js')
}

/** worker-pipeline.js was removed in Pino v9.1 */
try {
const pinoPipelineWorker = path.join(pino, 'lib/worker-pipeline.js');
await stat(pinoPipelineWorker)
customEntrypoints['pino-pipeline-worker'] = pinoPipelineWorker;
} catch (err) {
// Ignored
}

/** Transports */
const transportsEntrypoints: Record<string, string> = Object.fromEntries(
transports.map((transport) => [transport, require.resolve(transport)])
Expand Down

0 comments on commit 58a8fb7

Please # to comment.