mirror of
https://github.com/pinojs/pino.git
synced 2025-12-08 20:36:13 +00:00
chore: use node: imports (#2003)
* chore: use node: imports * missing esm style import
This commit is contained in:
parent
4fe8065bdb
commit
bd2fb33597
@ -5,7 +5,7 @@ const pino = require('../')
|
||||
const bunyan = require('bunyan')
|
||||
const bole = require('bole')('bench')
|
||||
const winston = require('winston')
|
||||
const fs = require('fs')
|
||||
const fs = require('node:fs')
|
||||
const dest = fs.createWriteStream('/dev/null')
|
||||
const loglevel = require('./utils/wrap-log-level')(dest)
|
||||
const plogNodeStream = pino(dest)
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
const bench = require('fastbench')
|
||||
const pino = require('../')
|
||||
const bunyan = require('bunyan')
|
||||
const fs = require('fs')
|
||||
const fs = require('node:fs')
|
||||
const dest = fs.createWriteStream('/dev/null')
|
||||
const plogNodeStream = pino(dest).child({ a: 'property' }).child({ sub: 'child' })
|
||||
delete require.cache[require.resolve('../')]
|
||||
|
||||
@ -4,7 +4,7 @@ const bench = require('fastbench')
|
||||
const pino = require('../')
|
||||
const bunyan = require('bunyan')
|
||||
const bole = require('bole')('bench')
|
||||
const fs = require('fs')
|
||||
const fs = require('node:fs')
|
||||
const dest = fs.createWriteStream('/dev/null')
|
||||
const plogNodeStream = pino(dest)
|
||||
const plogDest = pino(pino.destination(('/dev/null')))
|
||||
|
||||
@ -4,7 +4,7 @@ const bench = require('fastbench')
|
||||
const pino = require('../')
|
||||
const bunyan = require('bunyan')
|
||||
const bole = require('bole')('bench')('child')
|
||||
const fs = require('fs')
|
||||
const fs = require('node:fs')
|
||||
const dest = fs.createWriteStream('/dev/null')
|
||||
const plogNodeStream = pino(dest).child({ a: 'property' })
|
||||
delete require.cache[require.resolve('../')]
|
||||
|
||||
@ -5,7 +5,7 @@ const pino = require('../')
|
||||
const bunyan = require('bunyan')
|
||||
const bole = require('bole')('bench')
|
||||
const winston = require('winston')
|
||||
const fs = require('fs')
|
||||
const fs = require('node:fs')
|
||||
const dest = fs.createWriteStream('/dev/null')
|
||||
const plogNodeStream = pino(dest)
|
||||
delete require.cache[require.resolve('../')]
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
const bench = require('fastbench')
|
||||
const pino = require('../../')
|
||||
const fs = require('fs')
|
||||
const fs = require('node:fs')
|
||||
const dest = fs.createWriteStream('/dev/null')
|
||||
const plog = pino(dest)
|
||||
delete require.cache[require.resolve('../../')]
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
const bench = require('fastbench')
|
||||
const pino = require('../../')
|
||||
const fs = require('fs')
|
||||
const fs = require('node:fs')
|
||||
const dest = fs.createWriteStream('/dev/null')
|
||||
const plog = pino(dest)
|
||||
delete require.cache[require.resolve('../../')]
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
const bench = require('fastbench')
|
||||
const pino = require('../../')
|
||||
const fs = require('fs')
|
||||
const fs = require('node:fs')
|
||||
const dest = fs.createWriteStream('/dev/null')
|
||||
const plog = pino(dest)
|
||||
delete require.cache[require.resolve('../../')]
|
||||
|
||||
@ -5,7 +5,7 @@ const pino = require('../')
|
||||
const bunyan = require('bunyan')
|
||||
const bole = require('bole')('bench')
|
||||
const winston = require('winston')
|
||||
const fs = require('fs')
|
||||
const fs = require('node:fs')
|
||||
const dest = fs.createWriteStream('/dev/null')
|
||||
const plogNodeStream = pino(dest)
|
||||
delete require.cache[require.resolve('../')]
|
||||
|
||||
@ -5,7 +5,7 @@ const pino = require('../')
|
||||
const bunyan = require('bunyan')
|
||||
const bole = require('bole')('bench')
|
||||
const winston = require('winston')
|
||||
const fs = require('fs')
|
||||
const fs = require('node:fs')
|
||||
const dest = fs.createWriteStream('/dev/null')
|
||||
const plogNodeStream = pino(dest)
|
||||
delete require.cache[require.resolve('../')]
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
const bench = require('fastbench')
|
||||
const bunyan = require('bunyan')
|
||||
const pino = require('../')
|
||||
const fs = require('fs')
|
||||
const fs = require('node:fs')
|
||||
const dest = fs.createWriteStream('/dev/null')
|
||||
|
||||
const tenStreams = [
|
||||
|
||||
@ -5,7 +5,7 @@ const pino = require('../')
|
||||
const bunyan = require('bunyan')
|
||||
const bole = require('bole')('bench')
|
||||
const winston = require('winston')
|
||||
const fs = require('fs')
|
||||
const fs = require('node:fs')
|
||||
const dest = fs.createWriteStream('/dev/null')
|
||||
const loglevel = require('./utils/wrap-log-level')(dest)
|
||||
const plogNodeStream = pino(dest)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
const { join } = require('path')
|
||||
const { execSync } = require('child_process')
|
||||
const { join } = require('node:path')
|
||||
const { execSync } = require('node:child_process')
|
||||
|
||||
const run = (type) => {
|
||||
process.stderr.write(`benchmarking ${type}\n`)
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
'use strict'
|
||||
|
||||
const { type, platform, arch, release, cpus } = require('os')
|
||||
const { resolve, join } = require('path')
|
||||
const spawn = require('child_process').spawn
|
||||
const { type, platform, arch, release, cpus } = require('node:os')
|
||||
const { resolve, join } = require('node:path')
|
||||
const spawn = require('node:child_process').spawn
|
||||
const pump = require('pump')
|
||||
const split = require('split2')
|
||||
const through = require('through2')
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
'use strict'
|
||||
|
||||
const { readFileSync } = require('fs')
|
||||
const { readFileSync } = require('node:fs')
|
||||
const vm = require('vm')
|
||||
const { join } = require('path')
|
||||
const { join } = require('node:path')
|
||||
const code = readFileSync(
|
||||
join(__dirname, '..', '..', 'node_modules', 'loglevel', 'lib', 'loglevel.js')
|
||||
)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const fs = require('node:fs')
|
||||
const path = require('node:path')
|
||||
const { version } = require('../package.json')
|
||||
|
||||
const metaContent = `'use strict'
|
||||
|
||||
@ -1312,7 +1312,7 @@ Create a stream composed by multiple destination streams and returns an
|
||||
object implementing the [MultiStreamRes](#multistreamres) interface.
|
||||
|
||||
```js
|
||||
var fs = require('fs')
|
||||
var fs = require('node:fs')
|
||||
var pino = require('pino')
|
||||
var pretty = require('pino-pretty')
|
||||
var streams = [
|
||||
|
||||
@ -60,7 +60,7 @@ somewhere so the log rotation tool knows where to send the signal.
|
||||
|
||||
```js
|
||||
// write the process pid to a well known location for later
|
||||
const fs = require('fs')
|
||||
const fs = require('node:fs')
|
||||
fs.writeFileSync('/var/run/myapp.pid', process.pid)
|
||||
|
||||
const dest = pino.destination('/log/file')
|
||||
|
||||
@ -25,7 +25,7 @@ flushed as quickly as possible (there is nothing to do).
|
||||
A transport is a module that exports a default function that returns a writable stream:
|
||||
|
||||
```js
|
||||
import { createWriteStream } from 'fs'
|
||||
import { createWriteStream } from 'node:fs'
|
||||
|
||||
export default (options) => {
|
||||
return createWriteStream(options.destination)
|
||||
@ -54,7 +54,7 @@ The exported function can also be async. If we use an async function we can thro
|
||||
if the transform could not be opened. As an example:
|
||||
|
||||
```js
|
||||
import fs from 'fs'
|
||||
import fs from 'node:fs'
|
||||
import { once } from 'events'
|
||||
export default async (options) => {
|
||||
const stream = fs.createWriteStream(options.destination)
|
||||
@ -218,7 +218,7 @@ As an example, the following transport returns a `Transform` stream:
|
||||
|
||||
```js
|
||||
import build from 'pino-abstract-transport'
|
||||
import { pipeline, Transform } from 'stream'
|
||||
import { pipeline, Transform } from 'node:stream'
|
||||
export default async function (options) {
|
||||
return build(function (source) {
|
||||
const myTransportStream = new Transform({
|
||||
@ -378,7 +378,7 @@ A legacy Pino "transport" is a supplementary tool that consumes Pino logs.
|
||||
Consider the following example for creating a transport:
|
||||
|
||||
```js
|
||||
const { pipeline, Writable } = require('stream')
|
||||
const { pipeline, Writable } = require('node:stream')
|
||||
const split = require('split2')
|
||||
|
||||
const myTransportStream = new Writable({
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
'use strict'
|
||||
|
||||
const pino = require('..')
|
||||
const { tmpdir } = require('os')
|
||||
const { join } = require('path')
|
||||
const { tmpdir } = require('node:os')
|
||||
const { join } = require('node:path')
|
||||
|
||||
const file = join(tmpdir(), `pino-${process.pid}-example`)
|
||||
|
||||
|
||||
2
file.js
2
file.js
@ -1,7 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
const pino = require('./pino')
|
||||
const { once } = require('events')
|
||||
const { once } = require('node:events')
|
||||
|
||||
module.exports = async function (opts = {}) {
|
||||
const destOpts = Object.assign({}, opts, { dest: opts.destination || 1, sync: false })
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
/* eslint no-prototype-builtins: 0 */
|
||||
|
||||
const { EventEmitter } = require('events')
|
||||
const { EventEmitter } = require('node:events')
|
||||
const {
|
||||
lsCacheSym,
|
||||
levelValSym,
|
||||
|
||||
@ -7,7 +7,7 @@ module.exports = loadTransportStreamBuilder
|
||||
/**
|
||||
* Loads & returns a function to build transport streams
|
||||
* @param {string} target
|
||||
* @returns {function(object): Promise<import('stream').Writable>}
|
||||
* @returns {function(object): Promise<import('node:stream').Writable>}
|
||||
* @throws {Error} In case the target module does not export a function
|
||||
*/
|
||||
async function loadTransportStreamBuilder (target) {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
const { createRequire } = require('module')
|
||||
const getCallers = require('./caller')
|
||||
const { join, isAbsolute, sep } = require('path')
|
||||
const { join, isAbsolute, sep } = require('node:path')
|
||||
const sleep = require('atomic-sleep')
|
||||
const onExit = require('on-exit-leak-free')
|
||||
const ThreadStream = require('thread-stream')
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
const EE = require('events')
|
||||
const { pipeline, PassThrough } = require('stream')
|
||||
const EE = require('node:events')
|
||||
const { pipeline, PassThrough } = require('node:stream')
|
||||
const pino = require('../pino.js')
|
||||
const build = require('pino-abstract-transport')
|
||||
const loadTransportStreamBuilder = require('./transport-stream')
|
||||
|
||||
4
pino.js
4
pino.js
@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
/* eslint no-prototype-builtins: 0 */
|
||||
const os = require('os')
|
||||
|
||||
const os = require('node:os')
|
||||
const stdSerializers = require('pino-std-serializers')
|
||||
const caller = require('./lib/caller')
|
||||
const redaction = require('./lib/redaction')
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
const os = require('os')
|
||||
const { readFileSync } = require('fs')
|
||||
const os = require('node:os')
|
||||
const { readFileSync } = require('node:fs')
|
||||
const { test } = require('tap')
|
||||
const { sink, check, once, watchFileCreated, file } = require('./helper')
|
||||
const pino = require('../')
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
'use strict'
|
||||
|
||||
const t = require('tap')
|
||||
const { join } = require('path')
|
||||
const { fork } = require('child_process')
|
||||
const { join } = require('node:path')
|
||||
const { fork } = require('node:child_process')
|
||||
const { once } = require('./helper')
|
||||
const pino = require('..')
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
const { test } = require('tap')
|
||||
const { sink, once } = require('./helper')
|
||||
const { PassThrough } = require('stream')
|
||||
const { PassThrough } = require('node:stream')
|
||||
const pino = require('../')
|
||||
|
||||
test('Proxy and stream objects', async ({ equal }) => {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
/* eslint no-prototype-builtins: 0 */
|
||||
|
||||
const os = require('os')
|
||||
const os = require('node:os')
|
||||
const { test } = require('tap')
|
||||
const { sink, once } = require('./helper')
|
||||
const pino = require('../')
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
const os = require('os')
|
||||
const os = require('node:os')
|
||||
const { test } = require('tap')
|
||||
const { sink, once } = require('./helper')
|
||||
const pino = require('../')
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
import { tmpdir, hostname } from 'os'
|
||||
import { hostname } from 'node:os'
|
||||
import t from 'tap'
|
||||
import { sink, check, once, watchFileCreated, file } from '../helper.js'
|
||||
import { pino, destination } from '../../pino.js'
|
||||
import { join } from 'path'
|
||||
import { readFileSync } from 'fs'
|
||||
import { readFileSync } from 'node:fs'
|
||||
|
||||
t.test('named exports support', async ({ equal }) => {
|
||||
const stream = sink()
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
const { test } = require('tap')
|
||||
const { join } = require('path')
|
||||
const { join } = require('node:path')
|
||||
const execa = require('execa')
|
||||
const writer = require('flush-write-stream')
|
||||
const { once } = require('./helper')
|
||||
|
||||
2
test/fixtures/broken-pipe/basic.js
vendored
2
test/fixtures/broken-pipe/basic.js
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
global.process = { __proto__: process, pid: 123456 }
|
||||
Date.now = function () { return 1459875739796 }
|
||||
require('os').hostname = function () { return 'abcdefghijklmnopqr' }
|
||||
require('node:os').hostname = function () { return 'abcdefghijklmnopqr' }
|
||||
|
||||
const pino = require('../../..')()
|
||||
|
||||
|
||||
2
test/fixtures/broken-pipe/destination.js
vendored
2
test/fixtures/broken-pipe/destination.js
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
global.process = { __proto__: process, pid: 123456 }
|
||||
Date.now = function () { return 1459875739796 }
|
||||
require('os').hostname = function () { return 'abcdefghijklmnopqr' }
|
||||
require('node:os').hostname = function () { return 'abcdefghijklmnopqr' }
|
||||
|
||||
const pino = require('../../..')
|
||||
const logger = pino(pino.destination())
|
||||
|
||||
2
test/fixtures/broken-pipe/syncfalse.js
vendored
2
test/fixtures/broken-pipe/syncfalse.js
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
global.process = { __proto__: process, pid: 123456 }
|
||||
Date.now = function () { return 1459875739796 }
|
||||
require('os').hostname = function () { return 'abcdefghijklmnopqr' }
|
||||
require('node:os').hostname = function () { return 'abcdefghijklmnopqr' }
|
||||
|
||||
const pino = require('../../..')
|
||||
const logger = pino(pino.destination({ sync: false }))
|
||||
|
||||
2
test/fixtures/console-transport.js
vendored
2
test/fixtures/console-transport.js
vendored
@ -1,4 +1,4 @@
|
||||
const { Writable } = require('stream')
|
||||
const { Writable } = require('node:stream')
|
||||
|
||||
module.exports = (options) => {
|
||||
const myTransportStream = new Writable({
|
||||
|
||||
2
test/fixtures/default-exit.js
vendored
2
test/fixtures/default-exit.js
vendored
@ -1,6 +1,6 @@
|
||||
global.process = { __proto__: process, pid: 123456 }
|
||||
Date.now = function () { return 1459875739796 }
|
||||
require('os').hostname = function () { return 'abcdefghijklmnopqr' }
|
||||
require('node:os').hostname = function () { return 'abcdefghijklmnopqr' }
|
||||
const pino = require(require.resolve('./../../'))
|
||||
const logger = pino()
|
||||
logger.info('hello')
|
||||
|
||||
2
test/fixtures/destination-exit.js
vendored
2
test/fixtures/destination-exit.js
vendored
@ -1,6 +1,6 @@
|
||||
global.process = { __proto__: process, pid: 123456 }
|
||||
Date.now = function () { return 1459875739796 }
|
||||
require('os').hostname = function () { return 'abcdefghijklmnopqr' }
|
||||
require('node:os').hostname = function () { return 'abcdefghijklmnopqr' }
|
||||
const pino = require(require.resolve('./../../'))
|
||||
const logger = pino({}, pino.destination(1))
|
||||
logger.info('hello')
|
||||
|
||||
2
test/fixtures/noop-transport.js
vendored
2
test/fixtures/noop-transport.js
vendored
@ -1,4 +1,4 @@
|
||||
const { Writable } = require('stream')
|
||||
const { Writable } = require('node:stream')
|
||||
|
||||
module.exports = () => {
|
||||
return new Writable({
|
||||
|
||||
2
test/fixtures/pretty/null-prototype.js
vendored
2
test/fixtures/pretty/null-prototype.js
vendored
@ -1,6 +1,6 @@
|
||||
global.process = { __proto__: process, pid: 123456 }
|
||||
Date.now = function () { return 1459875739796 }
|
||||
require('os').hostname = function () { return 'abcdefghijklmnopqr' }
|
||||
require('node:os').hostname = function () { return 'abcdefghijklmnopqr' }
|
||||
const pino = require(require.resolve('./../../../'))
|
||||
const log = pino({ prettyPrint: true })
|
||||
const obj = Object.create(null)
|
||||
|
||||
2
test/fixtures/stdout-hack-protection.js
vendored
2
test/fixtures/stdout-hack-protection.js
vendored
@ -6,6 +6,6 @@ process.stdout.write = function (chunk) {
|
||||
}
|
||||
|
||||
Date.now = function () { return 1459875739796 }
|
||||
require('os').hostname = function () { return 'abcdefghijklmnopqr' }
|
||||
require('node:os').hostname = function () { return 'abcdefghijklmnopqr' }
|
||||
const pino = require(require.resolve('../../'))()
|
||||
pino.info('me')
|
||||
|
||||
2
test/fixtures/syncfalse-child.js
vendored
2
test/fixtures/syncfalse-child.js
vendored
@ -1,6 +1,6 @@
|
||||
global.process = { __proto__: process, pid: 123456 }
|
||||
Date.now = function () { return 1459875739796 }
|
||||
require('os').hostname = function () { return 'abcdefghijklmnopqr' }
|
||||
require('node:os').hostname = function () { return 'abcdefghijklmnopqr' }
|
||||
const pino = require(require.resolve('./../../'))
|
||||
const asyncLogger = pino(pino.destination({ sync: false })).child({ hello: 'world' })
|
||||
asyncLogger.info('h')
|
||||
|
||||
2
test/fixtures/syncfalse-exit.js
vendored
2
test/fixtures/syncfalse-exit.js
vendored
@ -1,6 +1,6 @@
|
||||
global.process = { __proto__: process, pid: 123456 }
|
||||
Date.now = function () { return 1459875739796 }
|
||||
require('os').hostname = function () { return 'abcdefghijklmnopqr' }
|
||||
require('node:os').hostname = function () { return 'abcdefghijklmnopqr' }
|
||||
const pino = require(require.resolve('./../../'))
|
||||
const dest = pino.destination({ dest: 1, minLength: 4096, sync: false })
|
||||
const logger = pino({}, dest)
|
||||
|
||||
2
test/fixtures/syncfalse-flush-exit.js
vendored
2
test/fixtures/syncfalse-flush-exit.js
vendored
@ -1,6 +1,6 @@
|
||||
global.process = { __proto__: process, pid: 123456 }
|
||||
Date.now = function () { return 1459875739796 }
|
||||
require('os').hostname = function () { return 'abcdefghijklmnopqr' }
|
||||
require('node:os').hostname = function () { return 'abcdefghijklmnopqr' }
|
||||
const pino = require(require.resolve('./../../'))
|
||||
const dest = pino.destination({ dest: 1, minLength: 4096, sync: false })
|
||||
const logger = pino({}, dest)
|
||||
|
||||
2
test/fixtures/syncfalse.js
vendored
2
test/fixtures/syncfalse.js
vendored
@ -1,6 +1,6 @@
|
||||
global.process = { __proto__: process, pid: 123456 }
|
||||
Date.now = function () { return 1459875739796 }
|
||||
require('os').hostname = function () { return 'abcdefghijklmnopqr' }
|
||||
require('node:os').hostname = function () { return 'abcdefghijklmnopqr' }
|
||||
const pino = require(require.resolve('./../../'))
|
||||
const asyncLogger = pino(pino.destination({ minLength: 4096, sync: false }))
|
||||
asyncLogger.info('h')
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('fs')
|
||||
const { once } = require('events')
|
||||
const { Transform } = require('stream')
|
||||
const fs = require('node:fs')
|
||||
const { once } = require('node:events')
|
||||
const { Transform } = require('node:stream')
|
||||
|
||||
async function run (opts) {
|
||||
if (!opts.destination) throw new Error('kaboom')
|
||||
|
||||
4
test/fixtures/to-file-transport.js
vendored
4
test/fixtures/to-file-transport.js
vendored
@ -1,7 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('fs')
|
||||
const { once } = require('events')
|
||||
const fs = require('node:fs')
|
||||
const { once } = require('node:events')
|
||||
|
||||
async function run (opts) {
|
||||
if (!opts.destination) throw new Error('kaboom')
|
||||
|
||||
4
test/fixtures/to-file-transport.mjs
vendored
4
test/fixtures/to-file-transport.mjs
vendored
@ -1,5 +1,5 @@
|
||||
import { createWriteStream } from 'fs'
|
||||
import { once } from 'events'
|
||||
import { createWriteStream } from 'node:fs'
|
||||
import { once } from 'node:events'
|
||||
|
||||
export default async function run (opts) {
|
||||
const stream = createWriteStream(opts.destination)
|
||||
|
||||
2
test/fixtures/transport-main.js
vendored
2
test/fixtures/transport-main.js
vendored
@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
const { join } = require('path')
|
||||
const { join } = require('node:path')
|
||||
const pino = require('../..')
|
||||
const transport = pino.transport({
|
||||
target: join(__dirname, 'transport-worker.js')
|
||||
|
||||
2
test/fixtures/transport-transform.js
vendored
2
test/fixtures/transport-transform.js
vendored
@ -1,7 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
const build = require('pino-abstract-transport')
|
||||
const { pipeline, Transform } = require('stream')
|
||||
const { pipeline, Transform } = require('node:stream')
|
||||
module.exports = (options) => {
|
||||
return build(function (source) {
|
||||
const myTransportStream = new Transform({
|
||||
|
||||
2
test/fixtures/transport-uses-pino-config.js
vendored
2
test/fixtures/transport-uses-pino-config.js
vendored
@ -1,7 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
const build = require('pino-abstract-transport')
|
||||
const { pipeline, Transform } = require('stream')
|
||||
const { pipeline, Transform } = require('node:stream')
|
||||
module.exports = () => {
|
||||
return build(function (source) {
|
||||
const myTransportStream = new Transform({
|
||||
|
||||
2
test/fixtures/transport-worker-data.js
vendored
2
test/fixtures/transport-worker-data.js
vendored
@ -1,7 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
const { parentPort, workerData } = require('worker_threads')
|
||||
const { Writable } = require('stream')
|
||||
const { Writable } = require('node:stream')
|
||||
|
||||
module.exports = (options) => {
|
||||
const myTransportStream = new Writable({
|
||||
|
||||
4
test/fixtures/transport-worker.js
vendored
4
test/fixtures/transport-worker.js
vendored
@ -1,7 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
const { Writable } = require('stream')
|
||||
const fs = require('fs')
|
||||
const { Writable } = require('node:stream')
|
||||
const fs = require('node:fs')
|
||||
module.exports = (options) => {
|
||||
const myTransportStream = new Writable({
|
||||
autoDestroy: true,
|
||||
|
||||
4
test/fixtures/transport/index.js
vendored
4
test/fixtures/transport/index.js
vendored
@ -1,7 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('fs')
|
||||
const { once } = require('events')
|
||||
const fs = require('node:fs')
|
||||
const { once } = require('node:events')
|
||||
|
||||
async function run (opts) {
|
||||
const stream = fs.createWriteStream(opts.destination)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import * as fs from 'fs'
|
||||
import { once } from 'events'
|
||||
import { Transform } from 'stream'
|
||||
import * as fs from 'node:fs'
|
||||
import { once } from 'node:events'
|
||||
import { Transform } from 'node:stream'
|
||||
|
||||
async function run (opts: { destination?: fs.PathLike }): Promise<Transform> {
|
||||
if (!opts.destination) throw new Error('kaboom')
|
||||
|
||||
4
test/fixtures/ts/to-file-transport.ts
vendored
4
test/fixtures/ts/to-file-transport.ts
vendored
@ -1,5 +1,5 @@
|
||||
import * as fs from 'fs'
|
||||
import { once } from 'events'
|
||||
import * as fs from 'node:fs'
|
||||
import { once } from 'node:events'
|
||||
|
||||
async function run (opts: { destination?: fs.PathLike }): Promise<fs.WriteStream> {
|
||||
if (!opts.destination) throw new Error('kaboom')
|
||||
|
||||
2
test/fixtures/ts/transpile.cjs
vendored
2
test/fixtures/ts/transpile.cjs
vendored
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const execa = require('execa')
|
||||
const fs = require('fs')
|
||||
const fs = require('node:fs')
|
||||
|
||||
const existsSync = fs.existsSync
|
||||
const stat = fs.promises.stat
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import pino from '../../..'
|
||||
import { join } from 'path'
|
||||
import { join } from 'node:path'
|
||||
|
||||
const transport = pino.transport({
|
||||
target: join(__dirname, 'to-file-transport-with-transform.ts'),
|
||||
|
||||
2
test/fixtures/ts/transport-main.ts
vendored
2
test/fixtures/ts/transport-main.ts
vendored
@ -1,4 +1,4 @@
|
||||
import { join } from 'path'
|
||||
import { join } from 'node:path'
|
||||
import pino from '../../..'
|
||||
|
||||
const transport = pino.transport({
|
||||
|
||||
2
test/fixtures/ts/transport-worker.ts
vendored
2
test/fixtures/ts/transport-worker.ts
vendored
@ -1,4 +1,4 @@
|
||||
import { Writable } from 'stream'
|
||||
import { Writable } from 'node:stream'
|
||||
|
||||
export default (): Writable => {
|
||||
const myTransportStream = new Writable({
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
'use strict'
|
||||
/* eslint no-prototype-builtins: 0 */
|
||||
|
||||
const { hostname } = require('os')
|
||||
const { join } = require('path')
|
||||
const { readFile } = require('fs').promises
|
||||
const { hostname } = require('node:os')
|
||||
const { join } = require('node:path')
|
||||
const { readFile } = require('node:fs').promises
|
||||
const { test } = require('tap')
|
||||
const { sink, once, watchFileCreated, file } = require('./helper')
|
||||
const pino = require('../')
|
||||
|
||||
2
test/helper.d.ts
vendored
2
test/helper.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
import { PathLike } from 'fs'
|
||||
import { PathLike } from 'node:fs'
|
||||
|
||||
export declare function watchFileCreated(filename: PathLike): Promise<void>
|
||||
export declare function watchForWrite(filename: PathLike, testString: string): Promise<void>
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
'use strict'
|
||||
|
||||
const crypto = require('crypto')
|
||||
const os = require('os')
|
||||
const os = require('node:os')
|
||||
const writer = require('flush-write-stream')
|
||||
const split = require('split2')
|
||||
const { existsSync, readFileSync, statSync, unlinkSync } = require('fs')
|
||||
const { existsSync, readFileSync, statSync, unlinkSync } = require('node:fs')
|
||||
const pid = process.pid
|
||||
const hostname = os.hostname()
|
||||
const t = require('tap')
|
||||
const { join } = require('path')
|
||||
const { join } = require('node:path')
|
||||
const { tmpdir } = os
|
||||
|
||||
const isWin = process.platform === 'win32'
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
const http = require('http')
|
||||
const os = require('os')
|
||||
const os = require('node:os')
|
||||
const semver = require('semver')
|
||||
const { test, skip } = require('tap')
|
||||
const { sink, once } = require('./helper')
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const fs = require('node:fs')
|
||||
const path = require('node:path')
|
||||
const t = require('tap')
|
||||
const test = t.test
|
||||
const pino = require('../..')()
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
const os = require('os')
|
||||
const os = require('node:os')
|
||||
const { test } = require('tap')
|
||||
const pino = require('../')
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
const os = require('os')
|
||||
const os = require('node:os')
|
||||
const { test } = require('tap')
|
||||
const { sink, once } = require('./helper')
|
||||
const pino = require('../')
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
'use strict'
|
||||
|
||||
const writeStream = require('flush-write-stream')
|
||||
const { readFileSync } = require('fs')
|
||||
const { join } = require('path')
|
||||
const { readFileSync } = require('node:fs')
|
||||
const { join } = require('node:path')
|
||||
const test = require('tap').test
|
||||
const pino = require('../')
|
||||
const multistream = pino.multistream
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
'use strict'
|
||||
|
||||
const os = require('os')
|
||||
const { join } = require('path')
|
||||
const { readFile } = require('fs').promises
|
||||
const os = require('node:os')
|
||||
const { join } = require('node:path')
|
||||
const { readFile } = require('node:fs').promises
|
||||
const { watchFileCreated, file } = require('../helper')
|
||||
const { test } = require('tap')
|
||||
const pino = require('../../pino')
|
||||
|
||||
@ -2,11 +2,11 @@
|
||||
|
||||
const { test } = require('tap')
|
||||
const config = require('./pkg.config.json')
|
||||
const { promisify } = require('util')
|
||||
const { unlink } = require('fs/promises')
|
||||
const { join } = require('path')
|
||||
const { platform } = require('process')
|
||||
const exec = promisify(require('child_process').exec)
|
||||
const { promisify } = require('node:util')
|
||||
const { unlink } = require('node:fs/promises')
|
||||
const { join } = require('node:path')
|
||||
const { platform } = require('node:process')
|
||||
const exec = promisify(require('node:child_process').exec)
|
||||
|
||||
/**
|
||||
* The following regex is for tesintg the deprecation warning that is thrown by the `punycode` module.
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
'use strict'
|
||||
|
||||
const { test } = require('tap')
|
||||
const { join } = require('path')
|
||||
const { fork } = require('child_process')
|
||||
const { join } = require('node:path')
|
||||
const { fork } = require('node:child_process')
|
||||
const { once } = require('./helper')
|
||||
const writer = require('flush-write-stream')
|
||||
const pino = require('..')
|
||||
|
||||
@ -1,13 +1,10 @@
|
||||
'use strict'
|
||||
|
||||
const os = require('os')
|
||||
const {
|
||||
createWriteStream
|
||||
} = require('fs')
|
||||
const { readFile } = require('fs').promises
|
||||
const { join } = require('path')
|
||||
const os = require('node:os')
|
||||
const { promises: { readFile }, createWriteStream } = require('node:fs')
|
||||
const { join } = require('node:path')
|
||||
const { test } = require('tap')
|
||||
const { fork } = require('child_process')
|
||||
const { fork } = require('node:child_process')
|
||||
const writer = require('flush-write-stream')
|
||||
const {
|
||||
once,
|
||||
@ -15,7 +12,7 @@ const {
|
||||
file,
|
||||
watchFileCreated
|
||||
} = require('./helper')
|
||||
const { promisify } = require('util')
|
||||
const { promisify } = require('node:util')
|
||||
|
||||
const sleep = promisify(setTimeout)
|
||||
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
'use strict'
|
||||
|
||||
const { test } = require('tap')
|
||||
const { join } = require('path')
|
||||
const { createReadStream } = require('fs')
|
||||
const { promisify } = require('util')
|
||||
const { join } = require('node:path')
|
||||
const { createReadStream } = require('node:fs')
|
||||
const { promisify } = require('node:util')
|
||||
const execa = require('execa')
|
||||
const split = require('split2')
|
||||
const stream = require('stream')
|
||||
const stream = require('node:stream')
|
||||
const { file } = require('../helper')
|
||||
|
||||
const pipeline = promisify(stream.pipeline)
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
'use strict'
|
||||
|
||||
const os = require('os')
|
||||
const { join } = require('path')
|
||||
const { readFile } = require('fs').promises
|
||||
const os = require('node:os')
|
||||
const { join } = require('node:path')
|
||||
const { readFile } = require('node:fs').promises
|
||||
const { watchFileCreated, file } = require('../helper')
|
||||
const { test } = require('tap')
|
||||
const pino = require('../../pino')
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
const { join } = require('path')
|
||||
const { join } = require('node:path')
|
||||
const { test } = require('tap')
|
||||
const execa = require('execa')
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
'use strict'
|
||||
|
||||
const os = require('os')
|
||||
const { join } = require('path')
|
||||
const { once } = require('events')
|
||||
const { readFile, writeFile } = require('fs').promises
|
||||
const os = require('node:os')
|
||||
const { join } = require('node:path')
|
||||
const { once } = require('node:events')
|
||||
const { readFile, writeFile } = require('node:fs').promises
|
||||
const { watchFileCreated, watchForWrite, file } = require('../helper')
|
||||
const { test } = require('tap')
|
||||
const pino = require('../../')
|
||||
@ -12,7 +12,7 @@ const strip = require('strip-ansi')
|
||||
const execa = require('execa')
|
||||
const writer = require('flush-write-stream')
|
||||
const rimraf = require('rimraf')
|
||||
const { promisify } = require('util')
|
||||
const { promisify } = require('node:util')
|
||||
const { tmpdir } = os
|
||||
|
||||
const immediate = promisify(setImmediate)
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
import * as os from 'os'
|
||||
import { join } from 'path'
|
||||
import { once } from 'events'
|
||||
import fs from 'fs'
|
||||
import * as os from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { once } from 'node:events'
|
||||
import fs from 'node:fs'
|
||||
import { watchFileCreated } from '../helper'
|
||||
import { test } from 'tap'
|
||||
import pino from '../../'
|
||||
import * as url from 'url'
|
||||
import * as url from 'node:url'
|
||||
import { default as strip } from 'strip-ansi'
|
||||
import execa from 'execa'
|
||||
import writer from 'flush-write-stream'
|
||||
|
||||
@ -1,14 +1,10 @@
|
||||
import * as os from 'os'
|
||||
import { join } from 'path'
|
||||
import { once } from 'events'
|
||||
import fs from 'fs'
|
||||
import * as os from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import fs from 'node:fs'
|
||||
import { watchFileCreated } from '../helper'
|
||||
import { test } from 'tap'
|
||||
import pino from '../../'
|
||||
import * as url from 'url'
|
||||
import { default as strip } from 'strip-ansi'
|
||||
import execa from 'execa'
|
||||
import writer from 'flush-write-stream'
|
||||
import * as url from 'node:url'
|
||||
|
||||
const readFile = fs.promises.readFile
|
||||
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
'use strict'
|
||||
|
||||
const os = require('os')
|
||||
const { join } = require('path')
|
||||
const { readFile, symlink, unlink, mkdir, writeFile } = require('fs').promises
|
||||
const os = require('node:os')
|
||||
const { join } = require('node:path')
|
||||
const { readFile, symlink, unlink, mkdir, writeFile } = require('node:fs').promises
|
||||
const { test } = require('tap')
|
||||
const { isWin, isYarnPnp, watchFileCreated, file } = require('../helper')
|
||||
const { once } = require('events')
|
||||
const { once } = require('node:events')
|
||||
const execa = require('execa')
|
||||
const pino = require('../../')
|
||||
const rimraf = require('rimraf')
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
'use strict'
|
||||
|
||||
const os = require('os')
|
||||
const { join } = require('path')
|
||||
const { readFile } = require('fs').promises
|
||||
const os = require('node:os')
|
||||
const { join } = require('node:path')
|
||||
const { readFile } = require('node:fs').promises
|
||||
const { watchFileCreated, file } = require('../helper')
|
||||
const { test } = require('tap')
|
||||
const pino = require('../../')
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
'use strict'
|
||||
|
||||
const os = require('os')
|
||||
const os = require('node:os')
|
||||
const pino = require('../..')
|
||||
const { join } = require('path')
|
||||
const { join } = require('node:path')
|
||||
const { test } = require('tap')
|
||||
const { readFile } = require('fs').promises
|
||||
const { readFile } = require('node:fs').promises
|
||||
const { watchFileCreated, file } = require('../helper')
|
||||
const { promisify } = require('util')
|
||||
const { promisify } = require('node:util')
|
||||
|
||||
const { pid } = process
|
||||
const hostname = os.hostname()
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
'use strict'
|
||||
|
||||
const { test } = require('tap')
|
||||
const { join } = require('path')
|
||||
const { join } = require('node:path')
|
||||
const proxyquire = require('proxyquire')
|
||||
const Writable = require('stream').Writable
|
||||
const Writable = require('node:stream').Writable
|
||||
const pino = require('../../pino')
|
||||
|
||||
test('file-target mocked', async function ({ equal, same, plan, pass }) {
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
'use strict'
|
||||
|
||||
const os = require('os')
|
||||
const { join } = require('path')
|
||||
const { readFile } = require('fs').promises
|
||||
const os = require('node:os')
|
||||
const { join } = require('node:path')
|
||||
const { readFile } = require('node:fs').promises
|
||||
const writeStream = require('flush-write-stream')
|
||||
const { watchFileCreated, file } = require('../helper')
|
||||
const { test } = require('tap')
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { expectType } from 'tsd'
|
||||
|
||||
import { createWriteStream } from 'fs'
|
||||
import { createWriteStream } from 'node:fs'
|
||||
|
||||
import pino, { multistream } from '../../pino'
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { StreamEntry, pino } from '../../pino'
|
||||
import { join } from 'path'
|
||||
import { tmpdir } from 'os'
|
||||
import { join } from 'node:path'
|
||||
import { tmpdir } from 'node:os'
|
||||
import pinoPretty from 'pino-pretty'
|
||||
|
||||
const destination = join(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user