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.
Files changed (166) hide show
  1. package/LICENSE +24 -0
  2. package/README.md +113 -0
  3. package/bin.js +6 -0
  4. package/bingo-logger.js +211 -0
  5. package/browser.js +358 -0
  6. package/docs/api.md +1352 -0
  7. package/docs/asynchronous.md +102 -0
  8. package/docs/benchmarks.md +58 -0
  9. package/docs/browser.md +199 -0
  10. package/docs/bundling.md +34 -0
  11. package/docs/child-loggers.md +95 -0
  12. package/docs/ecosystem.md +74 -0
  13. package/docs/help.md +305 -0
  14. package/docs/lts.md +62 -0
  15. package/docs/pretty.md +101 -0
  16. package/docs/redaction.md +135 -0
  17. package/docs/transports.md +792 -0
  18. package/docs/web.md +257 -0
  19. package/file.js +12 -0
  20. package/lib/caller.js +30 -0
  21. package/lib/deprecations.js +10 -0
  22. package/lib/levels.js +193 -0
  23. package/lib/meta.js +5 -0
  24. package/lib/multistream.js +156 -0
  25. package/lib/parse.js +14 -0
  26. package/lib/proto.js +216 -0
  27. package/lib/redaction.js +118 -0
  28. package/lib/symbols.js +70 -0
  29. package/lib/time.js +11 -0
  30. package/lib/tools.js +563 -0
  31. package/lib/transport-stream.js +47 -0
  32. package/lib/transport.js +157 -0
  33. package/lib/worker-pipeline.js +40 -0
  34. package/lib/worker.js +54 -0
  35. package/package.json +131 -0
  36. package/test/basic.test.js +719 -0
  37. package/test/broken-pipe.test.js +42 -0
  38. package/test/browser-levels.test.js +218 -0
  39. package/test/browser-serializers.test.js +354 -0
  40. package/test/browser-timestamp.test.js +88 -0
  41. package/test/browser-transmit.test.js +349 -0
  42. package/test/browser.test.js +547 -0
  43. package/test/complex-objects.test.js +34 -0
  44. package/test/crlf.test.js +32 -0
  45. package/test/custom-levels.test.js +294 -0
  46. package/test/error.test.js +374 -0
  47. package/test/escaping.test.js +91 -0
  48. package/test/esm/esm.mjs +12 -0
  49. package/test/esm/index.test.js +34 -0
  50. package/test/esm/named-exports.mjs +28 -0
  51. package/test/exit.test.js +85 -0
  52. package/test/final.test.js +237 -0
  53. package/test/fixtures/broken-pipe/basic.js +9 -0
  54. package/test/fixtures/broken-pipe/destination.js +10 -0
  55. package/test/fixtures/broken-pipe/syncfalse.js +12 -0
  56. package/test/fixtures/console-transport.js +13 -0
  57. package/test/fixtures/default-exit.js +8 -0
  58. package/test/fixtures/destination-exit.js +8 -0
  59. package/test/fixtures/eval/index.js +29 -0
  60. package/test/fixtures/eval/node_modules/14-files.js +3 -0
  61. package/test/fixtures/eval/node_modules/2-files.js +3 -0
  62. package/test/fixtures/eval/node_modules/file1.js +5 -0
  63. package/test/fixtures/eval/node_modules/file10.js +5 -0
  64. package/test/fixtures/eval/node_modules/file11.js +5 -0
  65. package/test/fixtures/eval/node_modules/file12.js +5 -0
  66. package/test/fixtures/eval/node_modules/file13.js +5 -0
  67. package/test/fixtures/eval/node_modules/file14.js +11 -0
  68. package/test/fixtures/eval/node_modules/file15.js +10 -0
  69. package/test/fixtures/eval/node_modules/file2.js +5 -0
  70. package/test/fixtures/eval/node_modules/file3.js +5 -0
  71. package/test/fixtures/eval/node_modules/file4.js +5 -0
  72. package/test/fixtures/eval/node_modules/file5.js +5 -0
  73. package/test/fixtures/eval/node_modules/file6.js +5 -0
  74. package/test/fixtures/eval/node_modules/file7.js +5 -0
  75. package/test/fixtures/eval/node_modules/file8.js +5 -0
  76. package/test/fixtures/eval/node_modules/file9.js +5 -0
  77. package/test/fixtures/eval/node_modules/test.list +3 -0
  78. package/test/fixtures/pretty/basic.js +6 -0
  79. package/test/fixtures/pretty/child-with-serializer.js +17 -0
  80. package/test/fixtures/pretty/child-with-updated-chindings.js +8 -0
  81. package/test/fixtures/pretty/child.js +8 -0
  82. package/test/fixtures/pretty/custom-time-label.js +9 -0
  83. package/test/fixtures/pretty/custom-time.js +9 -0
  84. package/test/fixtures/pretty/dateformat.js +10 -0
  85. package/test/fixtures/pretty/error-props.js +9 -0
  86. package/test/fixtures/pretty/error.js +7 -0
  87. package/test/fixtures/pretty/final-no-log-before.js +8 -0
  88. package/test/fixtures/pretty/final-return.js +7 -0
  89. package/test/fixtures/pretty/final.js +9 -0
  90. package/test/fixtures/pretty/formatters.js +13 -0
  91. package/test/fixtures/pretty/level-first.js +6 -0
  92. package/test/fixtures/pretty/no-time.js +9 -0
  93. package/test/fixtures/pretty/null-prototype.js +8 -0
  94. package/test/fixtures/pretty/obj-msg-prop.js +6 -0
  95. package/test/fixtures/pretty/pretty-factory.js +6 -0
  96. package/test/fixtures/pretty/redact.js +9 -0
  97. package/test/fixtures/pretty/serializers.js +17 -0
  98. package/test/fixtures/pretty/skipped-output.js +13 -0
  99. package/test/fixtures/pretty/suppress-flush-sync-warning.js +7 -0
  100. package/test/fixtures/stdout-hack-protection.js +11 -0
  101. package/test/fixtures/syncfalse-child.js +6 -0
  102. package/test/fixtures/syncfalse-exit.js +9 -0
  103. package/test/fixtures/syncfalse-flush-exit.js +10 -0
  104. package/test/fixtures/syncfalse.js +6 -0
  105. package/test/fixtures/to-file-transport-with-transform.js +20 -0
  106. package/test/fixtures/to-file-transport.js +13 -0
  107. package/test/fixtures/to-file-transport.mjs +8 -0
  108. package/test/fixtures/transport/index.js +12 -0
  109. package/test/fixtures/transport/package.json +5 -0
  110. package/test/fixtures/transport-exit-immediately-with-async-dest.js +16 -0
  111. package/test/fixtures/transport-exit-immediately.js +11 -0
  112. package/test/fixtures/transport-exit-on-ready.js +12 -0
  113. package/test/fixtures/transport-main.js +9 -0
  114. package/test/fixtures/transport-many-lines.js +29 -0
  115. package/test/fixtures/transport-string-stdout.js +9 -0
  116. package/test/fixtures/transport-transform.js +21 -0
  117. package/test/fixtures/transport-worker.js +13 -0
  118. package/test/fixtures/transport-wrong-export-type.js +3 -0
  119. package/test/fixtures/ts/to-file-transport-with-transform.ts +18 -0
  120. package/test/fixtures/ts/to-file-transport.es2017.cjs +12 -0
  121. package/test/fixtures/ts/to-file-transport.es5.cjs +58 -0
  122. package/test/fixtures/ts/to-file-transport.es6.cjs +23 -0
  123. package/test/fixtures/ts/to-file-transport.esnext.cjs +12 -0
  124. package/test/fixtures/ts/to-file-transport.ts +11 -0
  125. package/test/fixtures/ts/transpile.cjs +40 -0
  126. package/test/fixtures/ts/transport-exit-immediately-with-async-dest.ts +15 -0
  127. package/test/fixtures/ts/transport-exit-immediately.ts +10 -0
  128. package/test/fixtures/ts/transport-exit-on-ready.ts +11 -0
  129. package/test/fixtures/ts/transport-main.ts +8 -0
  130. package/test/fixtures/ts/transport-string-stdout.ts +8 -0
  131. package/test/fixtures/ts/transport-worker.ts +14 -0
  132. package/test/formatters.test.js +355 -0
  133. package/test/helper.d.ts +4 -0
  134. package/test/helper.js +128 -0
  135. package/test/hooks.test.js +97 -0
  136. package/test/http.test.js +242 -0
  137. package/test/is-level-enabled.test.js +43 -0
  138. package/test/jest/basic.spec.js +10 -0
  139. package/test/levels.test.js +528 -0
  140. package/test/metadata.test.js +106 -0
  141. package/test/mixin-merge-strategy.test.js +55 -0
  142. package/test/mixin.test.js +162 -0
  143. package/test/multistream.test.js +589 -0
  144. package/test/pretty.test.js +392 -0
  145. package/test/redact.test.js +828 -0
  146. package/test/serializers.test.js +253 -0
  147. package/test/stdout-protection.test.js +19 -0
  148. package/test/syncfalse.test.js +118 -0
  149. package/test/timestamp.test.js +121 -0
  150. package/test/transport/big.test.js +41 -0
  151. package/test/transport/bundlers-support.test.js +97 -0
  152. package/test/transport/caller.test.js +23 -0
  153. package/test/transport/core.test.js +546 -0
  154. package/test/transport/core.test.ts +236 -0
  155. package/test/transport/core.transpiled.test.ts +116 -0
  156. package/test/transport/module-link.test.js +239 -0
  157. package/test/transport/pipeline.test.js +36 -0
  158. package/test/transport/syncfalse.test.js +31 -0
  159. package/test/transport/targets.test.js +28 -0
  160. package/test/types/pino-import.test-d.ts +29 -0
  161. package/test/types/pino-multistream.test-d.ts +26 -0
  162. package/test/types/pino-top-export.test-d.ts +37 -0
  163. package/test/types/pino-transport.test-d.ts +122 -0
  164. package/test/types/pino-type-only.test-d.ts +16 -0
  165. package/test/types/pino.test-d.ts +341 -0
  166. 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
+ })