Skip to content

Commit

Permalink
doc: update readme (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
wd-David authored Nov 9, 2024
1 parent 952c44b commit f245d16
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ npm install esbuild-plugin-pino

## Description

This plugin allows to use of pino v7 with esbuild generated bundle files.
This plugin allows to use of pino v7 ~ v9 with esbuild generated bundle files.

Note that, due to pino architecture (based on Node.js' Worker Threads), it is not possible to make it work without generating extra files.

This means that when using this plugin the following list of files will be generated at the root of your dist folder:

- `thread-stream.js`
- `pino-worker.js`
- `pino-pipeline-worker.js`
- `pino-pipeline-worker.js` (no longer required after Pino v9.1.0)
- `pino-file.js`

A file for each transport you specify in the plugin constructor's `transports` option. (see below)
Expand All @@ -36,51 +36,51 @@ Simply include the plugin in your esbuild build script. Make sure you provide th

```js
// General usage
const { build } = require('esbuild')
const esbuildPluginPino = require('esbuild-plugin-pino')
const { build } = require("esbuild");
const esbuildPluginPino = require("esbuild-plugin-pino");

build({
entryPoints: ['src/index.ts'],
outdir: 'dist',
plugins: [esbuildPluginPino({ transports: ['pino-pretty'] })],
}).catch(() => process.exit(1))
entryPoints: ["src/index.ts"],
outdir: "dist",
plugins: [esbuildPluginPino({ transports: ["pino-pretty"] })],
}).catch(() => process.exit(1));
```

```js
// Multiple entryPoints & pino transports
const { build } = require('esbuild')
const esbuildPluginPino = require('esbuild-plugin-pino')
const { build } = require("esbuild");
const esbuildPluginPino = require("esbuild-plugin-pino");

build({
entryPoints: {
first: './first.js',
'abc/cde/second': './second.js'
first: "./first.js",
"abc/cde/second": "./second.js",
},
outdir: 'dist',
plugins: [esbuildPluginPino({ transports: ['pino-pretty', 'pino-loki'] })],
}).catch(() => process.exit(1))
outdir: "dist",
plugins: [esbuildPluginPino({ transports: ["pino-pretty", "pino-loki"] })],
}).catch(() => process.exit(1));
```

```js
// Start from esbuild@^0.17.1
// Multiple entryPoints in an array of object & pino transports
const { build } = require('esbuild')
const esbuildPluginPino = require('esbuild-plugin-pino')
const { build } = require("esbuild");
const esbuildPluginPino = require("esbuild-plugin-pino");

build({
entryPoints: [
{
in: './test/fixtures/first.js',
out: 'first'
in: "./test/fixtures/first.js",
out: "first",
},
{
in: './test/fixtures/second.js',
out: 'abc/cde/second'
}
in: "./test/fixtures/second.js",
out: "abc/cde/second",
},
],
outdir: 'dist',
plugins: [esbuildPluginPino({ transports: ['pino-pretty', 'pino-loki'] })],
}).catch(() => process.exit(1))
outdir: "dist",
plugins: [esbuildPluginPino({ transports: ["pino-pretty", "pino-loki"] })],
}).catch(() => process.exit(1));
```

## Deploy to production
Expand Down

0 comments on commit f245d16

Please sign in to comment.