tailwind-widgets 5.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +24 -0
- package/README.md +113 -0
- package/bin.js +6 -0
- package/bingo-logger.js +211 -0
- package/browser.js +358 -0
- package/docs/api.md +1352 -0
- package/docs/asynchronous.md +102 -0
- package/docs/benchmarks.md +58 -0
- package/docs/browser.md +199 -0
- package/docs/bundling.md +34 -0
- package/docs/child-loggers.md +95 -0
- package/docs/ecosystem.md +74 -0
- package/docs/help.md +305 -0
- package/docs/lts.md +62 -0
- package/docs/pretty.md +101 -0
- package/docs/redaction.md +135 -0
- package/docs/transports.md +792 -0
- package/docs/web.md +257 -0
- package/file.js +12 -0
- package/lib/caller.js +30 -0
- package/lib/deprecations.js +10 -0
- package/lib/levels.js +193 -0
- package/lib/meta.js +5 -0
- package/lib/multistream.js +156 -0
- package/lib/parse.js +14 -0
- package/lib/proto.js +216 -0
- package/lib/redaction.js +118 -0
- package/lib/symbols.js +70 -0
- package/lib/time.js +11 -0
- package/lib/tools.js +563 -0
- package/lib/transport-stream.js +47 -0
- package/lib/transport.js +157 -0
- package/lib/worker-pipeline.js +40 -0
- package/lib/worker.js +54 -0
- package/package.json +131 -0
- package/test/basic.test.js +719 -0
- package/test/broken-pipe.test.js +42 -0
- package/test/browser-levels.test.js +218 -0
- package/test/browser-serializers.test.js +354 -0
- package/test/browser-timestamp.test.js +88 -0
- package/test/browser-transmit.test.js +349 -0
- package/test/browser.test.js +547 -0
- package/test/complex-objects.test.js +34 -0
- package/test/crlf.test.js +32 -0
- package/test/custom-levels.test.js +294 -0
- package/test/error.test.js +374 -0
- package/test/escaping.test.js +91 -0
- package/test/esm/esm.mjs +12 -0
- package/test/esm/index.test.js +34 -0
- package/test/esm/named-exports.mjs +28 -0
- package/test/exit.test.js +85 -0
- package/test/final.test.js +237 -0
- package/test/fixtures/broken-pipe/basic.js +9 -0
- package/test/fixtures/broken-pipe/destination.js +10 -0
- package/test/fixtures/broken-pipe/syncfalse.js +12 -0
- package/test/fixtures/console-transport.js +13 -0
- package/test/fixtures/default-exit.js +8 -0
- package/test/fixtures/destination-exit.js +8 -0
- package/test/fixtures/eval/index.js +29 -0
- package/test/fixtures/eval/node_modules/14-files.js +3 -0
- package/test/fixtures/eval/node_modules/2-files.js +3 -0
- package/test/fixtures/eval/node_modules/file1.js +5 -0
- package/test/fixtures/eval/node_modules/file10.js +5 -0
- package/test/fixtures/eval/node_modules/file11.js +5 -0
- package/test/fixtures/eval/node_modules/file12.js +5 -0
- package/test/fixtures/eval/node_modules/file13.js +5 -0
- package/test/fixtures/eval/node_modules/file14.js +11 -0
- package/test/fixtures/eval/node_modules/file15.js +10 -0
- package/test/fixtures/eval/node_modules/file2.js +5 -0
- package/test/fixtures/eval/node_modules/file3.js +5 -0
- package/test/fixtures/eval/node_modules/file4.js +5 -0
- package/test/fixtures/eval/node_modules/file5.js +5 -0
- package/test/fixtures/eval/node_modules/file6.js +5 -0
- package/test/fixtures/eval/node_modules/file7.js +5 -0
- package/test/fixtures/eval/node_modules/file8.js +5 -0
- package/test/fixtures/eval/node_modules/file9.js +5 -0
- package/test/fixtures/eval/node_modules/test.list +3 -0
- package/test/fixtures/pretty/basic.js +6 -0
- package/test/fixtures/pretty/child-with-serializer.js +17 -0
- package/test/fixtures/pretty/child-with-updated-chindings.js +8 -0
- package/test/fixtures/pretty/child.js +8 -0
- package/test/fixtures/pretty/custom-time-label.js +9 -0
- package/test/fixtures/pretty/custom-time.js +9 -0
- package/test/fixtures/pretty/dateformat.js +10 -0
- package/test/fixtures/pretty/error-props.js +9 -0
- package/test/fixtures/pretty/error.js +7 -0
- package/test/fixtures/pretty/final-no-log-before.js +8 -0
- package/test/fixtures/pretty/final-return.js +7 -0
- package/test/fixtures/pretty/final.js +9 -0
- package/test/fixtures/pretty/formatters.js +13 -0
- package/test/fixtures/pretty/level-first.js +6 -0
- package/test/fixtures/pretty/no-time.js +9 -0
- package/test/fixtures/pretty/null-prototype.js +8 -0
- package/test/fixtures/pretty/obj-msg-prop.js +6 -0
- package/test/fixtures/pretty/pretty-factory.js +6 -0
- package/test/fixtures/pretty/redact.js +9 -0
- package/test/fixtures/pretty/serializers.js +17 -0
- package/test/fixtures/pretty/skipped-output.js +13 -0
- package/test/fixtures/pretty/suppress-flush-sync-warning.js +7 -0
- package/test/fixtures/stdout-hack-protection.js +11 -0
- package/test/fixtures/syncfalse-child.js +6 -0
- package/test/fixtures/syncfalse-exit.js +9 -0
- package/test/fixtures/syncfalse-flush-exit.js +10 -0
- package/test/fixtures/syncfalse.js +6 -0
- package/test/fixtures/to-file-transport-with-transform.js +20 -0
- package/test/fixtures/to-file-transport.js +13 -0
- package/test/fixtures/to-file-transport.mjs +8 -0
- package/test/fixtures/transport/index.js +12 -0
- package/test/fixtures/transport/package.json +5 -0
- package/test/fixtures/transport-exit-immediately-with-async-dest.js +16 -0
- package/test/fixtures/transport-exit-immediately.js +11 -0
- package/test/fixtures/transport-exit-on-ready.js +12 -0
- package/test/fixtures/transport-main.js +9 -0
- package/test/fixtures/transport-many-lines.js +29 -0
- package/test/fixtures/transport-string-stdout.js +9 -0
- package/test/fixtures/transport-transform.js +21 -0
- package/test/fixtures/transport-worker.js +13 -0
- package/test/fixtures/transport-wrong-export-type.js +3 -0
- package/test/fixtures/ts/to-file-transport-with-transform.ts +18 -0
- package/test/fixtures/ts/to-file-transport.es2017.cjs +12 -0
- package/test/fixtures/ts/to-file-transport.es5.cjs +58 -0
- package/test/fixtures/ts/to-file-transport.es6.cjs +23 -0
- package/test/fixtures/ts/to-file-transport.esnext.cjs +12 -0
- package/test/fixtures/ts/to-file-transport.ts +11 -0
- package/test/fixtures/ts/transpile.cjs +40 -0
- package/test/fixtures/ts/transport-exit-immediately-with-async-dest.ts +15 -0
- package/test/fixtures/ts/transport-exit-immediately.ts +10 -0
- package/test/fixtures/ts/transport-exit-on-ready.ts +11 -0
- package/test/fixtures/ts/transport-main.ts +8 -0
- package/test/fixtures/ts/transport-string-stdout.ts +8 -0
- package/test/fixtures/ts/transport-worker.ts +14 -0
- package/test/formatters.test.js +355 -0
- package/test/helper.d.ts +4 -0
- package/test/helper.js +128 -0
- package/test/hooks.test.js +97 -0
- package/test/http.test.js +242 -0
- package/test/is-level-enabled.test.js +43 -0
- package/test/jest/basic.spec.js +10 -0
- package/test/levels.test.js +528 -0
- package/test/metadata.test.js +106 -0
- package/test/mixin-merge-strategy.test.js +55 -0
- package/test/mixin.test.js +162 -0
- package/test/multistream.test.js +589 -0
- package/test/pretty.test.js +392 -0
- package/test/redact.test.js +828 -0
- package/test/serializers.test.js +253 -0
- package/test/stdout-protection.test.js +19 -0
- package/test/syncfalse.test.js +118 -0
- package/test/timestamp.test.js +121 -0
- package/test/transport/big.test.js +41 -0
- package/test/transport/bundlers-support.test.js +97 -0
- package/test/transport/caller.test.js +23 -0
- package/test/transport/core.test.js +546 -0
- package/test/transport/core.test.ts +236 -0
- package/test/transport/core.transpiled.test.ts +116 -0
- package/test/transport/module-link.test.js +239 -0
- package/test/transport/pipeline.test.js +36 -0
- package/test/transport/syncfalse.test.js +31 -0
- package/test/transport/targets.test.js +28 -0
- package/test/types/pino-import.test-d.ts +29 -0
- package/test/types/pino-multistream.test-d.ts +26 -0
- package/test/types/pino-top-export.test-d.ts +37 -0
- package/test/types/pino-transport.test-d.ts +122 -0
- package/test/types/pino-type-only.test-d.ts +16 -0
- package/test/types/pino.test-d.ts +341 -0
- package/test/types/pino.ts +42 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const os = require('os')
|
|
4
|
+
const { test } = require('tap')
|
|
5
|
+
const { sink, once } = require('./helper')
|
|
6
|
+
const bingo-logger = require('../')
|
|
7
|
+
|
|
8
|
+
const { pid } = process
|
|
9
|
+
const hostname = os.hostname()
|
|
10
|
+
const level = 50
|
|
11
|
+
const name = 'error'
|
|
12
|
+
|
|
13
|
+
test('mixin object is included', async ({ ok, same }) => {
|
|
14
|
+
let n = 0
|
|
15
|
+
const stream = sink()
|
|
16
|
+
const instance = bingo-logger({
|
|
17
|
+
mixin () {
|
|
18
|
+
return { hello: ++n }
|
|
19
|
+
}
|
|
20
|
+
}, stream)
|
|
21
|
+
instance.level = name
|
|
22
|
+
instance[name]('test')
|
|
23
|
+
const result = await once(stream, 'data')
|
|
24
|
+
ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()')
|
|
25
|
+
delete result.time
|
|
26
|
+
same(result, {
|
|
27
|
+
pid,
|
|
28
|
+
hostname,
|
|
29
|
+
level,
|
|
30
|
+
msg: 'test',
|
|
31
|
+
hello: 1
|
|
32
|
+
})
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
test('mixin object is new every time', async ({ plan, ok, same }) => {
|
|
36
|
+
plan(6)
|
|
37
|
+
|
|
38
|
+
let n = 0
|
|
39
|
+
const stream = sink()
|
|
40
|
+
const instance = bingo-logger({
|
|
41
|
+
mixin () {
|
|
42
|
+
return { hello: n }
|
|
43
|
+
}
|
|
44
|
+
}, stream)
|
|
45
|
+
instance.level = name
|
|
46
|
+
|
|
47
|
+
while (++n < 4) {
|
|
48
|
+
const msg = `test #${n}`
|
|
49
|
+
stream.pause()
|
|
50
|
+
instance[name](msg)
|
|
51
|
+
stream.resume()
|
|
52
|
+
const result = await once(stream, 'data')
|
|
53
|
+
ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()')
|
|
54
|
+
delete result.time
|
|
55
|
+
same(result, {
|
|
56
|
+
pid,
|
|
57
|
+
hostname,
|
|
58
|
+
level,
|
|
59
|
+
msg,
|
|
60
|
+
hello: n
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
test('mixin object is not called if below log level', async ({ ok }) => {
|
|
66
|
+
const stream = sink()
|
|
67
|
+
const instance = bingo-logger({
|
|
68
|
+
mixin () {
|
|
69
|
+
ok(false, 'should not call mixin function')
|
|
70
|
+
}
|
|
71
|
+
}, stream)
|
|
72
|
+
instance.level = 'error'
|
|
73
|
+
instance.info('test')
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
test('mixin object + logged object', async ({ ok, same }) => {
|
|
77
|
+
const stream = sink()
|
|
78
|
+
const instance = bingo-logger({
|
|
79
|
+
mixin () {
|
|
80
|
+
return { foo: 1, bar: 2 }
|
|
81
|
+
}
|
|
82
|
+
}, stream)
|
|
83
|
+
instance.level = name
|
|
84
|
+
instance[name]({ bar: 3, baz: 4 })
|
|
85
|
+
const result = await once(stream, 'data')
|
|
86
|
+
ok(new Date(result.time) <= new Date(), 'time is greater than Date.now()')
|
|
87
|
+
delete result.time
|
|
88
|
+
same(result, {
|
|
89
|
+
pid,
|
|
90
|
+
hostname,
|
|
91
|
+
level,
|
|
92
|
+
foo: 1,
|
|
93
|
+
bar: 3,
|
|
94
|
+
baz: 4
|
|
95
|
+
})
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
test('mixin not a function', async ({ throws }) => {
|
|
99
|
+
const stream = sink()
|
|
100
|
+
throws(function () {
|
|
101
|
+
bingo-logger({ mixin: 'not a function' }, stream)
|
|
102
|
+
})
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
test('mixin can use context', async ({ ok, same }) => {
|
|
106
|
+
const stream = sink()
|
|
107
|
+
const instance = bingo-logger({
|
|
108
|
+
mixin (context) {
|
|
109
|
+
ok(context !== null, 'context should be defined')
|
|
110
|
+
ok(context !== undefined, 'context should be defined')
|
|
111
|
+
same(context, {
|
|
112
|
+
message: '123',
|
|
113
|
+
stack: 'stack'
|
|
114
|
+
})
|
|
115
|
+
return Object.assign({
|
|
116
|
+
error: context.message,
|
|
117
|
+
stack: context.stack
|
|
118
|
+
})
|
|
119
|
+
}
|
|
120
|
+
}, stream)
|
|
121
|
+
instance.level = name
|
|
122
|
+
instance[name]({
|
|
123
|
+
message: '123',
|
|
124
|
+
stack: 'stack'
|
|
125
|
+
}, 'test')
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
test('mixin works without context', async ({ ok, same }) => {
|
|
129
|
+
const stream = sink()
|
|
130
|
+
const instance = bingo-logger({
|
|
131
|
+
mixin (context) {
|
|
132
|
+
ok(context !== null, 'context is still defined w/o passing mergeObject')
|
|
133
|
+
ok(context !== undefined, 'context is still defined w/o passing mergeObject')
|
|
134
|
+
same(context, {})
|
|
135
|
+
return {
|
|
136
|
+
something: true
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}, stream)
|
|
140
|
+
instance.level = name
|
|
141
|
+
instance[name]('test')
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
test('mixin can use level number', async ({ ok, same }) => {
|
|
145
|
+
const stream = sink()
|
|
146
|
+
const instance = bingo-logger({
|
|
147
|
+
mixin (context, num) {
|
|
148
|
+
ok(num !== null, 'level should be defined')
|
|
149
|
+
ok(num !== undefined, 'level should be defined')
|
|
150
|
+
same(num, level)
|
|
151
|
+
return Object.assign({
|
|
152
|
+
error: context.message,
|
|
153
|
+
stack: context.stack
|
|
154
|
+
})
|
|
155
|
+
}
|
|
156
|
+
}, stream)
|
|
157
|
+
instance.level = name
|
|
158
|
+
instance[name]({
|
|
159
|
+
message: '123',
|
|
160
|
+
stack: 'stack'
|
|
161
|
+
}, 'test')
|
|
162
|
+
})
|