@atlaspack/logger 2.14.5-canary.36 → 2.14.5-canary.360

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/CHANGELOG.md CHANGED
@@ -1,5 +1,259 @@
1
1
  # @atlaspack/logger
2
2
 
3
+ ## 2.14.40
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`564fb4f`](https://github.com/atlassian-labs/atlaspack/commit/564fb4fecc2a20bdeb951863a8fac29b618d91b7), [`9df722c`](https://github.com/atlassian-labs/atlaspack/commit/9df722c38b225054883693ba9731344f701767a7), [`34b01ec`](https://github.com/atlassian-labs/atlaspack/commit/34b01ec03e2264bd617be000465821e1ed11eae5), [`6e5fec1`](https://github.com/atlassian-labs/atlaspack/commit/6e5fec1406c53257be7e7fbe06c028beda70fcf1), [`e4e5522`](https://github.com/atlassian-labs/atlaspack/commit/e4e55222422d8c73653d3ea09f1a0d13946345b9)]:
8
+ - @atlaspack/rust@3.18.0
9
+ - @atlaspack/types-internal@2.22.5
10
+
11
+ ## 2.14.39
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [[`7cb8569`](https://github.com/atlassian-labs/atlaspack/commit/7cb85698143e381fcb887173b2bfd15f0aea7918), [`695339e`](https://github.com/atlassian-labs/atlaspack/commit/695339e4fd46df9590013c2ef4de74cb22225927)]:
16
+ - @atlaspack/rust@3.17.0
17
+ - @atlaspack/types-internal@2.22.4
18
+
19
+ ## 2.14.38
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [[`515149d`](https://github.com/atlassian-labs/atlaspack/commit/515149d0a0767d844af803efdc611646780ad0fe), [`02cc8b3`](https://github.com/atlassian-labs/atlaspack/commit/02cc8b32c06ca6b51806b33f6f707ca06e55e957), [`02cc8b3`](https://github.com/atlassian-labs/atlaspack/commit/02cc8b32c06ca6b51806b33f6f707ca06e55e957)]:
24
+ - @atlaspack/rust@3.16.0
25
+ - @atlaspack/types-internal@2.22.3
26
+
27
+ ## 2.14.37
28
+
29
+ ### Patch Changes
30
+
31
+ - Updated dependencies []:
32
+ - @atlaspack/types-internal@2.22.2
33
+
34
+ ## 2.14.36
35
+
36
+ ### Patch Changes
37
+
38
+ - Updated dependencies [[`362a85d`](https://github.com/atlassian-labs/atlaspack/commit/362a85deb9722f769eeb5099bae915f8b858a126), [`c81b368`](https://github.com/atlassian-labs/atlaspack/commit/c81b368db20af701d9e019a11272b138f9cfe080)]:
39
+ - @atlaspack/rust@3.15.0
40
+ - @atlaspack/types-internal@2.22.1
41
+
42
+ ## 2.14.35
43
+
44
+ ### Patch Changes
45
+
46
+ - Updated dependencies [[`00fa643`](https://github.com/atlassian-labs/atlaspack/commit/00fa6433202bfd3311479f6314c9ec878a789f2c)]:
47
+ - @atlaspack/types-internal@2.22.0
48
+
49
+ ## 2.14.34
50
+
51
+ ### Patch Changes
52
+
53
+ - Updated dependencies [[`787290a`](https://github.com/atlassian-labs/atlaspack/commit/787290a63b3f781e7af86097201dfdb5a36c8551), [`cbb66a5`](https://github.com/atlassian-labs/atlaspack/commit/cbb66a554f7ad679fd4dfc9e2bf2d5abb859f846), [`7815a93`](https://github.com/atlassian-labs/atlaspack/commit/7815a931b18983c3f34a39990b2f4b8b86855cc6), [`25aa273`](https://github.com/atlassian-labs/atlaspack/commit/25aa2735f4db920960de3d65d3a427775086b7d5), [`9468e16`](https://github.com/atlassian-labs/atlaspack/commit/9468e164e8ca20a5e8f552f5dc203aa3716cb154), [`e55c80c`](https://github.com/atlassian-labs/atlaspack/commit/e55c80cd0ae3cc40356fe063cb7d45fbb9095356)]:
54
+ - @atlaspack/rust@3.14.0
55
+ - @atlaspack/types-internal@2.21.3
56
+
57
+ ## 2.14.33
58
+
59
+ ### Patch Changes
60
+
61
+ - Updated dependencies [[`96f1d7f`](https://github.com/atlassian-labs/atlaspack/commit/96f1d7f3efef12ce4f5966e34d00b299fcefb4dd), [`91738fd`](https://github.com/atlassian-labs/atlaspack/commit/91738fd77cb6b3b7acc93e799327ec283d27f7c0), [`38f3569`](https://github.com/atlassian-labs/atlaspack/commit/38f3569a7024357c43274666312bc6d024bfe5f9), [`3f6a3b8`](https://github.com/atlassian-labs/atlaspack/commit/3f6a3b8df4589fd4d65c072281c7f33bd37341d6), [`96f1d7f`](https://github.com/atlassian-labs/atlaspack/commit/96f1d7f3efef12ce4f5966e34d00b299fcefb4dd), [`d8024ce`](https://github.com/atlassian-labs/atlaspack/commit/d8024ce5c9ced1a9bc39144c979138be3a12b2fb), [`308e7ff`](https://github.com/atlassian-labs/atlaspack/commit/308e7ff979c05c1ae97fe6b08a65666b53d86cc7), [`d98c992`](https://github.com/atlassian-labs/atlaspack/commit/d98c992a56121a4f9f6a011ced5e103f96fe3999)]:
62
+ - @atlaspack/rust@3.13.0
63
+ - @atlaspack/types-internal@2.21.2
64
+
65
+ ## 2.14.32
66
+
67
+ ### Patch Changes
68
+
69
+ - Updated dependencies [[`a884bd2`](https://github.com/atlassian-labs/atlaspack/commit/a884bd2a6bd6f37d088fb886dd9b88e85328501b), [`25fee72`](https://github.com/atlassian-labs/atlaspack/commit/25fee723d2228d0482ec8a8f1b8379ccd2977ce7), [`6fac01d`](https://github.com/atlassian-labs/atlaspack/commit/6fac01dbb1bfc5b971176c1a1c008297bf4b8f91), [`432d571`](https://github.com/atlassian-labs/atlaspack/commit/432d571ea4e9fc67be12304fcafe8c445e844174), [`042cd95`](https://github.com/atlassian-labs/atlaspack/commit/042cd95a32ad38cd02d57aa3344c36d4e7ab8f9c), [`28f5424`](https://github.com/atlassian-labs/atlaspack/commit/28f5424f7e2080dd4fbbeb1bc5314a530197a23e), [`a884bd2`](https://github.com/atlassian-labs/atlaspack/commit/a884bd2a6bd6f37d088fb886dd9b88e85328501b), [`5710532`](https://github.com/atlassian-labs/atlaspack/commit/57105322b26ce42af2cbfcc0506cff929e50b630), [`44eb8c3`](https://github.com/atlassian-labs/atlaspack/commit/44eb8c388d3e63f1ef5d835aee7aee5d1bb0620f)]:
70
+ - @atlaspack/rust@3.12.0
71
+ - @atlaspack/types-internal@2.21.1
72
+
73
+ ## 2.14.31
74
+
75
+ ### Patch Changes
76
+
77
+ - Updated dependencies [[`7dd5bd8`](https://github.com/atlassian-labs/atlaspack/commit/7dd5bd89ff60c7b324347d772729eb4c3314f01e), [`c8a0e51`](https://github.com/atlassian-labs/atlaspack/commit/c8a0e51b1096d038a64644ad02fe68383f58682a), [`8eb84ee`](https://github.com/atlassian-labs/atlaspack/commit/8eb84ee61a42bfe87c58079b610802b07a6a13e4), [`71900f3`](https://github.com/atlassian-labs/atlaspack/commit/71900f3508d53c3882ca8ea71501ba3069687d4e), [`73168c2`](https://github.com/atlassian-labs/atlaspack/commit/73168c275a5d9abff9907bcf536b340bca1ed5f0), [`617a318`](https://github.com/atlassian-labs/atlaspack/commit/617a318ddc9419b38360257353fec50b9051ee13), [`2c4953e`](https://github.com/atlassian-labs/atlaspack/commit/2c4953e20dc1a6b012792081667aefeb9340505e), [`3fe7d4e`](https://github.com/atlassian-labs/atlaspack/commit/3fe7d4e821bee162fcbbaf9278b107a5eead944f)]:
78
+ - @atlaspack/rust@3.11.0
79
+ - @atlaspack/types-internal@2.21.0
80
+
81
+ ## 2.14.30
82
+
83
+ ### Patch Changes
84
+
85
+ - Updated dependencies [[`ec3abe4`](https://github.com/atlassian-labs/atlaspack/commit/ec3abe4dffc98560a850fd2f71fb566577e6c99c), [`c7fe3f7`](https://github.com/atlassian-labs/atlaspack/commit/c7fe3f76f247e9e20299e205e2df0a16c418eaf2), [`cfb4707`](https://github.com/atlassian-labs/atlaspack/commit/cfb4707087498e4fa4dcf10753fe984a248d196b), [`1468695`](https://github.com/atlassian-labs/atlaspack/commit/1468695fc0c9d06f060a6da9e9b0e154f11dff34), [`f31b041`](https://github.com/atlassian-labs/atlaspack/commit/f31b04107e9077c9946aadb99f6f91bb69703bb7), [`8180981`](https://github.com/atlassian-labs/atlaspack/commit/8180981be14c00f9570adb70d3f350bd91d6ec0a), [`ae77e74`](https://github.com/atlassian-labs/atlaspack/commit/ae77e7452a466b43b3fa5bed24d4ba26345ed765), [`f0a496f`](https://github.com/atlassian-labs/atlaspack/commit/f0a496f70fc8652e090cf1b3f6260e8cfbb796e2), [`540f253`](https://github.com/atlassian-labs/atlaspack/commit/540f253dfdcd1a5caebbdc0b197319d439404aae)]:
86
+ - @atlaspack/rust@3.10.0
87
+ - @atlaspack/types-internal@2.20.8
88
+
89
+ ## 2.14.29
90
+
91
+ ### Patch Changes
92
+
93
+ - Updated dependencies [[`339b600`](https://github.com/atlassian-labs/atlaspack/commit/339b60095d755742cea50f811d08ccc44a4ae521), [`373ee2d`](https://github.com/atlassian-labs/atlaspack/commit/373ee2d3b5cc315df1e90e647619f915892e2b87)]:
94
+ - @atlaspack/rust@3.9.1
95
+ - @atlaspack/types-internal@2.20.7
96
+
97
+ ## 2.14.28
98
+
99
+ ### Patch Changes
100
+
101
+ - Updated dependencies [[`02f6aa1`](https://github.com/atlassian-labs/atlaspack/commit/02f6aa1906953fc184d2b49c905c2ef815cb878d), [`58527ee`](https://github.com/atlassian-labs/atlaspack/commit/58527eec15c1aebaaadbeb63586f3082c16beae3), [`525898e`](https://github.com/atlassian-labs/atlaspack/commit/525898e33cc229a4bc938ae853732be36d20c01a), [`cfb39a0`](https://github.com/atlassian-labs/atlaspack/commit/cfb39a0d729eb620cf2ca1611750a2bf7a080d08), [`d0c7bea`](https://github.com/atlassian-labs/atlaspack/commit/d0c7bea04458255b4c5d4299600e734b5f919fe1), [`1086c6a`](https://github.com/atlassian-labs/atlaspack/commit/1086c6a2c59271b63b3fb78e6acdb9d3a0dbf354), [`9cd9521`](https://github.com/atlassian-labs/atlaspack/commit/9cd9521978f783046e2ae4ce78f2de7aeb07d073)]:
102
+ - @atlaspack/rust@3.9.0
103
+ - @atlaspack/types-internal@2.20.6
104
+
105
+ ## 2.14.27
106
+
107
+ ### Patch Changes
108
+
109
+ - Updated dependencies [[`79a7e22`](https://github.com/atlassian-labs/atlaspack/commit/79a7e22ef119891a2f4180a9d3cc66b38dd52092), [`c372f3f`](https://github.com/atlassian-labs/atlaspack/commit/c372f3fd6fce8200d5cf47f41bc7895c6cbb5558), [`17dfea9`](https://github.com/atlassian-labs/atlaspack/commit/17dfea9e9f3169807808520df9c09ebf70dc8b10), [`27fd73f`](https://github.com/atlassian-labs/atlaspack/commit/27fd73fa07d358653f1be6f2d15d72dc5d8fc2fd), [`3091fa3`](https://github.com/atlassian-labs/atlaspack/commit/3091fa36425ecffe3938e55247a035b08cda37a2)]:
110
+ - @atlaspack/rust@3.8.3
111
+ - @atlaspack/types-internal@2.20.5
112
+
113
+ ## 2.14.26
114
+
115
+ ### Patch Changes
116
+
117
+ - Updated dependencies []:
118
+ - @atlaspack/types-internal@2.20.4
119
+
120
+ ## 2.14.25
121
+
122
+ ### Patch Changes
123
+
124
+ - Updated dependencies []:
125
+ - @atlaspack/types-internal@2.20.3
126
+
127
+ ## 2.14.24
128
+
129
+ ### Patch Changes
130
+
131
+ - Updated dependencies [[`0207171`](https://github.com/atlassian-labs/atlaspack/commit/0207171e59e985c51e105aec2e0a99de174374bd), [`bbe4e28`](https://github.com/atlassian-labs/atlaspack/commit/bbe4e28c89e5e9284bd730075d4d6f2a3cb37b21)]:
132
+ - @atlaspack/rust@3.8.2
133
+ - @atlaspack/types-internal@2.20.2
134
+
135
+ ## 2.14.23
136
+
137
+ ### Patch Changes
138
+
139
+ - [#785](https://github.com/atlassian-labs/atlaspack/pull/785) [`0e7dd5e`](https://github.com/atlassian-labs/atlaspack/commit/0e7dd5ec6fbe05aa9e0bb5775a9d0975f206a922) Thanks [@matt-koko](https://github.com/matt-koko)! - We need to re-publish every package in Atlaspack with the corrected types field.
140
+
141
+ - Updated dependencies [[`0e7dd5e`](https://github.com/atlassian-labs/atlaspack/commit/0e7dd5ec6fbe05aa9e0bb5775a9d0975f206a922), [`686a398`](https://github.com/atlassian-labs/atlaspack/commit/686a398faa1f9e19cbf9274add2c46e246bafba8)]:
142
+ - @atlaspack/diagnostic@2.14.4
143
+ - @atlaspack/rust@3.8.1
144
+ - @atlaspack/types-internal@2.20.1
145
+ - @atlaspack/events@2.14.4
146
+
147
+ ## 2.14.22
148
+
149
+ ### Patch Changes
150
+
151
+ - Updated dependencies [[`eedcbc4`](https://github.com/atlassian-labs/atlaspack/commit/eedcbc408fc1e86a2a8e25f1a41c57146d8529e1), [`5a0363f`](https://github.com/atlassian-labs/atlaspack/commit/5a0363f1086e81068959b87e92064bed5a11a9b4), [`038e87a`](https://github.com/atlassian-labs/atlaspack/commit/038e87a7858d39556d59d3a2d17db534d45f62c6), [`f6532d7`](https://github.com/atlassian-labs/atlaspack/commit/f6532d7a4f7f007bd4e5e36af04dd466f0b9f572), [`0684997`](https://github.com/atlassian-labs/atlaspack/commit/0684997c127a6204af1376b36e556fddd1ba5557), [`602f8ed`](https://github.com/atlassian-labs/atlaspack/commit/602f8ed9d8381301df8b2cc82c1d5cf6f2f94fec)]:
152
+ - @atlaspack/types-internal@2.20.0
153
+ - @atlaspack/rust@3.8.0
154
+
155
+ ## 2.14.21
156
+
157
+ ### Patch Changes
158
+
159
+ - Updated dependencies [[`53dd47b`](https://github.com/atlassian-labs/atlaspack/commit/53dd47bd6d23cd47f87297347f03a609ab38a03d)]:
160
+ - @atlaspack/rust@3.7.0
161
+ - @atlaspack/types-internal@2.19.5
162
+
163
+ ## 2.14.20
164
+
165
+ ### Patch Changes
166
+
167
+ - Updated dependencies []:
168
+ - @atlaspack/types-internal@2.19.4
169
+
170
+ ## 2.14.19
171
+
172
+ ### Patch Changes
173
+
174
+ - Updated dependencies [[`3cfb7cf`](https://github.com/atlassian-labs/atlaspack/commit/3cfb7cfd90b78a5c48ce717e779ff789769825a3)]:
175
+ - @atlaspack/rust@3.6.2
176
+ - @atlaspack/types-internal@2.19.3
177
+
178
+ ## 2.14.18
179
+
180
+ ### Patch Changes
181
+
182
+ - [#742](https://github.com/atlassian-labs/atlaspack/pull/742) [`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd) Thanks [@yamadapc](https://github.com/yamadapc)! - Internal changes and bug fixes to environmentDeduplication flag
183
+
184
+ - Updated dependencies [[`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd)]:
185
+ - @atlaspack/types-internal@2.19.2
186
+ - @atlaspack/diagnostic@2.14.3
187
+ - @atlaspack/events@2.14.3
188
+ - @atlaspack/rust@3.6.1
189
+
190
+ ## 2.14.17
191
+
192
+ ### Patch Changes
193
+
194
+ - Updated dependencies []:
195
+ - @atlaspack/types-internal@2.19.1
196
+
197
+ ## 2.14.16
198
+
199
+ ### Patch Changes
200
+
201
+ - Updated dependencies [[`ad26146`](https://github.com/atlassian-labs/atlaspack/commit/ad26146f13b4c1cc65d4a0f9c67060b90ef14ff3), [`f1b48e7`](https://github.com/atlassian-labs/atlaspack/commit/f1b48e7a04e005cef0f36a3e692087a9ecdb6f7a), [`7f5841c`](https://github.com/atlassian-labs/atlaspack/commit/7f5841c39df049f9546cccbeea2a7337e0337b45)]:
202
+ - @atlaspack/rust@3.6.0
203
+ - @atlaspack/types-internal@2.19.0
204
+
205
+ ## 2.14.15
206
+
207
+ ### Patch Changes
208
+
209
+ - Updated dependencies [[`23d561e`](https://github.com/atlassian-labs/atlaspack/commit/23d561e51e68b0c38fd1ff4e4fb173e5e7b01cf2)]:
210
+ - @atlaspack/rust@3.5.0
211
+
212
+ ## 2.14.14
213
+
214
+ ### Patch Changes
215
+
216
+ - [#720](https://github.com/atlassian-labs/atlaspack/pull/720) [`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94) Thanks [@alshdavid](https://github.com/alshdavid)! - Migrate to TypeScript
217
+
218
+ - Updated dependencies [[`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94)]:
219
+ - @atlaspack/diagnostic@2.14.2
220
+ - @atlaspack/events@2.14.2
221
+ - @atlaspack/rust@3.4.2
222
+
223
+ ## 2.14.13
224
+
225
+ ### Patch Changes
226
+
227
+ - Updated dependencies [[`becf977`](https://github.com/atlassian-labs/atlaspack/commit/becf977f625d5ee46dae3d4c679f173bf5f40cc0), [`f0f7c71`](https://github.com/atlassian-labs/atlaspack/commit/f0f7c7168a1d3d18c6f30d2daed611275692b7c5)]:
228
+ - @atlaspack/rust@3.4.1
229
+
230
+ ## 2.14.12
231
+
232
+ ### Patch Changes
233
+
234
+ - Updated dependencies [[`c75bf55`](https://github.com/atlassian-labs/atlaspack/commit/c75bf553fff4decc285b5fd499a275853b18f8f2)]:
235
+ - @atlaspack/rust@3.4.0
236
+
237
+ ## 2.14.11
238
+
239
+ ### Patch Changes
240
+
241
+ - [#650](https://github.com/atlassian-labs/atlaspack/pull/650) [`ef3d622`](https://github.com/atlassian-labs/atlaspack/commit/ef3d6228f4e006702198a19c61e051d194d325cb) Thanks [@alshdavid](https://github.com/alshdavid)! - Remove package.json#exports
242
+
243
+ ## 2.14.10
244
+
245
+ ### Patch Changes
246
+
247
+ - Updated dependencies [[`35fdd4b`](https://github.com/atlassian-labs/atlaspack/commit/35fdd4b52da0af20f74667f7b8adfb2f90279b7c), [`6dd4ccb`](https://github.com/atlassian-labs/atlaspack/commit/6dd4ccb753541de32322d881f973d571dd57e4ca)]:
248
+ - @atlaspack/rust@3.3.5
249
+
250
+ ## 2.14.9
251
+
252
+ ### Patch Changes
253
+
254
+ - Updated dependencies [[`124b7ff`](https://github.com/atlassian-labs/atlaspack/commit/124b7fff44f71aac9fbad289a9a9509b3dfc9aaa), [`e052521`](https://github.com/atlassian-labs/atlaspack/commit/e0525210850ed1606146eb86991049cf567c5dec), [`15c6d70`](https://github.com/atlassian-labs/atlaspack/commit/15c6d7000bd89da876bc590aa75b17a619a41896), [`e4d966c`](https://github.com/atlassian-labs/atlaspack/commit/e4d966c3c9c4292c5013372ae65b10d19d4bacc6), [`42a775d`](https://github.com/atlassian-labs/atlaspack/commit/42a775de8eec638ad188f3271964170d8c04d84b), [`29c2f10`](https://github.com/atlassian-labs/atlaspack/commit/29c2f106de9679adfb5afa04e1910471dc65a427), [`1ef91fc`](https://github.com/atlassian-labs/atlaspack/commit/1ef91fcc863fdd2831511937083dbbc1263b3d9d)]:
255
+ - @atlaspack/rust@3.3.4
256
+
3
257
  ## 2.14.8
4
258
 
5
259
  ### Patch Changes
package/dist/Logger.js ADDED
@@ -0,0 +1,179 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.INTERNAL_ORIGINAL_CONSOLE = exports.PluginLogger = exports.instrumentAsync = exports.instrument = void 0;
4
+ exports.patchConsole = patchConsole;
5
+ exports.unpatchConsole = unpatchConsole;
6
+ const events_1 = require("@atlaspack/events");
7
+ const util_1 = require("util");
8
+ const diagnostic_1 = require("@atlaspack/diagnostic");
9
+ var tracer_1 = require("./tracer");
10
+ Object.defineProperty(exports, "instrument", { enumerable: true, get: function () { return tracer_1.instrument; } });
11
+ Object.defineProperty(exports, "instrumentAsync", { enumerable: true, get: function () { return tracer_1.instrumentAsync; } });
12
+ class Logger {
13
+ constructor() {
14
+ this.logEmitter = new events_1.ValueEmitter();
15
+ }
16
+ onLog(cb) {
17
+ return this.logEmitter.addListener(cb);
18
+ }
19
+ verbose(diagnostic) {
20
+ this.logEmitter.emit({
21
+ type: 'log',
22
+ level: 'verbose',
23
+ diagnostics: Array.isArray(diagnostic) ? diagnostic : [diagnostic],
24
+ });
25
+ }
26
+ info(diagnostic) {
27
+ this.log(diagnostic);
28
+ }
29
+ log(diagnostic) {
30
+ this.logEmitter.emit({
31
+ type: 'log',
32
+ level: 'info',
33
+ diagnostics: Array.isArray(diagnostic) ? diagnostic : [diagnostic],
34
+ });
35
+ }
36
+ warn(diagnostic) {
37
+ this.logEmitter.emit({
38
+ type: 'log',
39
+ level: 'warn',
40
+ diagnostics: Array.isArray(diagnostic) ? diagnostic : [diagnostic],
41
+ });
42
+ }
43
+ error(input, realOrigin) {
44
+ let diagnostic = (0, diagnostic_1.anyToDiagnostic)(input);
45
+ if (typeof realOrigin === 'string') {
46
+ diagnostic = Array.isArray(diagnostic)
47
+ ? diagnostic.map((d) => {
48
+ return { ...d, origin: realOrigin };
49
+ })
50
+ : {
51
+ ...diagnostic,
52
+ origin: realOrigin,
53
+ };
54
+ }
55
+ this.logEmitter.emit({
56
+ type: 'log',
57
+ level: 'error',
58
+ diagnostics: Array.isArray(diagnostic) ? diagnostic : [diagnostic],
59
+ });
60
+ }
61
+ progress(message) {
62
+ this.logEmitter.emit({
63
+ type: 'log',
64
+ level: 'progress',
65
+ message,
66
+ });
67
+ }
68
+ }
69
+ const logger = new Logger();
70
+ exports.default = logger;
71
+ class PluginLogger {
72
+ /** @private */
73
+ constructor(opts) {
74
+ this.origin = opts.origin;
75
+ }
76
+ /** @private */
77
+ updateOrigin(diagnostic) {
78
+ return Array.isArray(diagnostic)
79
+ ? diagnostic.map((d) => {
80
+ return { ...d, origin: this.origin };
81
+ })
82
+ : { ...diagnostic, origin: this.origin };
83
+ }
84
+ verbose(diagnostic) {
85
+ logger.verbose(this.updateOrigin(diagnostic));
86
+ }
87
+ info(diagnostic) {
88
+ logger.info(this.updateOrigin(diagnostic));
89
+ }
90
+ log(diagnostic) {
91
+ logger.log(this.updateOrigin(diagnostic));
92
+ }
93
+ warn(diagnostic) {
94
+ logger.warn(this.updateOrigin(diagnostic));
95
+ }
96
+ error(input) {
97
+ logger.error(input, this.origin);
98
+ }
99
+ /** @private */
100
+ progress(message) {
101
+ logger.progress(message);
102
+ }
103
+ }
104
+ exports.PluginLogger = PluginLogger;
105
+ /** @private */
106
+ exports.INTERNAL_ORIGINAL_CONSOLE = { ...console };
107
+ let consolePatched = false;
108
+ /**
109
+ * Patch `console` APIs within workers to forward their messages to the Logger
110
+ * at the appropriate levels.
111
+ * @private
112
+ */
113
+ function patchConsole() {
114
+ // Skip if console is already patched...
115
+ if (consolePatched)
116
+ return;
117
+ /* eslint-disable no-console */
118
+ console.log = console.info = (...messages) => {
119
+ logger.info(messagesToDiagnostic(messages));
120
+ };
121
+ console.debug = (...messages) => {
122
+ // TODO: dedicated debug level?
123
+ logger.verbose(messagesToDiagnostic(messages));
124
+ };
125
+ console.warn = (...messages) => {
126
+ logger.warn(messagesToDiagnostic(messages));
127
+ };
128
+ console.error = (...messages) => {
129
+ logger.error(messagesToDiagnostic(messages));
130
+ };
131
+ /* eslint-enable no-console */
132
+ consolePatched = true;
133
+ }
134
+ /** @private */
135
+ function unpatchConsole() {
136
+ // Skip if console isn't patched...
137
+ if (!consolePatched)
138
+ return;
139
+ /* eslint-disable no-console */
140
+ console.log = exports.INTERNAL_ORIGINAL_CONSOLE.log;
141
+ console.info = exports.INTERNAL_ORIGINAL_CONSOLE.info;
142
+ console.debug = exports.INTERNAL_ORIGINAL_CONSOLE.debug;
143
+ console.warn = exports.INTERNAL_ORIGINAL_CONSOLE.warn;
144
+ console.error = exports.INTERNAL_ORIGINAL_CONSOLE.error;
145
+ /* eslint-enable no-console */
146
+ consolePatched = false;
147
+ }
148
+ function messagesToDiagnostic(messages) {
149
+ if (messages.length === 1 && messages[0] instanceof Error) {
150
+ let error = messages[0];
151
+ let diagnostic = (0, diagnostic_1.errorToDiagnostic)(error);
152
+ if (Array.isArray(diagnostic)) {
153
+ return diagnostic.map((d) => {
154
+ return {
155
+ ...d,
156
+ skipFormatting: true,
157
+ };
158
+ });
159
+ }
160
+ else {
161
+ return {
162
+ ...diagnostic,
163
+ skipFormatting: true,
164
+ };
165
+ }
166
+ }
167
+ else {
168
+ return {
169
+ message: joinLogMessages(messages),
170
+ origin: 'console',
171
+ skipFormatting: true,
172
+ };
173
+ }
174
+ }
175
+ function joinLogMessages(messages) {
176
+ return messages
177
+ .map((m) => (typeof m === 'string' ? m : (0, util_1.inspect)(m)))
178
+ .join(' ');
179
+ }
package/dist/tracer.js ADDED
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.tracer = void 0;
4
+ exports.instrument = instrument;
5
+ exports.instrumentAsync = instrumentAsync;
6
+ const rust_1 = require("@atlaspack/rust");
7
+ exports.tracer = new rust_1.AtlaspackTracer();
8
+ function instrument(label, fn) {
9
+ const span = exports.tracer.enter(label);
10
+ try {
11
+ const result = fn();
12
+ return result;
13
+ }
14
+ finally {
15
+ exports.tracer.exit(span);
16
+ }
17
+ }
18
+ async function instrumentAsync(label, fn) {
19
+ const span = exports.tracer.enter(label);
20
+ let result;
21
+ try {
22
+ result = await fn();
23
+ }
24
+ finally {
25
+ exports.tracer.exit(span);
26
+ }
27
+ return result;
28
+ }
package/lib/Logger.js CHANGED
@@ -41,12 +41,12 @@ function _diagnostic() {
41
41
  }
42
42
  var _tracer = require("./tracer");
43
43
  class Logger {
44
- #logEmitter /*: ValueEmitter<LogEvent> */ = new (_events().ValueEmitter)();
44
+ logEmitter = new (_events().ValueEmitter)();
45
45
  onLog(cb) {
46
- return this.#logEmitter.addListener(cb);
46
+ return this.logEmitter.addListener(cb);
47
47
  }
48
48
  verbose(diagnostic) {
49
- this.#logEmitter.emit({
49
+ this.logEmitter.emit({
50
50
  type: 'log',
51
51
  level: 'verbose',
52
52
  diagnostics: Array.isArray(diagnostic) ? diagnostic : [diagnostic]
@@ -56,14 +56,14 @@ class Logger {
56
56
  this.log(diagnostic);
57
57
  }
58
58
  log(diagnostic) {
59
- this.#logEmitter.emit({
59
+ this.logEmitter.emit({
60
60
  type: 'log',
61
61
  level: 'info',
62
62
  diagnostics: Array.isArray(diagnostic) ? diagnostic : [diagnostic]
63
63
  });
64
64
  }
65
65
  warn(diagnostic) {
66
- this.#logEmitter.emit({
66
+ this.logEmitter.emit({
67
67
  type: 'log',
68
68
  level: 'warn',
69
69
  diagnostics: Array.isArray(diagnostic) ? diagnostic : [diagnostic]
@@ -82,14 +82,14 @@ class Logger {
82
82
  origin: realOrigin
83
83
  };
84
84
  }
85
- this.#logEmitter.emit({
85
+ this.logEmitter.emit({
86
86
  type: 'log',
87
87
  level: 'error',
88
88
  diagnostics: Array.isArray(diagnostic) ? diagnostic : [diagnostic]
89
89
  });
90
90
  }
91
91
  progress(message) {
92
- this.#logEmitter.emit({
92
+ this.logEmitter.emit({
93
93
  type: 'log',
94
94
  level: 'progress',
95
95
  message
@@ -158,23 +158,16 @@ function patchConsole() {
158
158
  if (consolePatched) return;
159
159
 
160
160
  /* eslint-disable no-console */
161
- // $FlowFixMe
162
161
  console.log = console.info = (...messages) => {
163
162
  logger.info(messagesToDiagnostic(messages));
164
163
  };
165
-
166
- // $FlowFixMe
167
164
  console.debug = (...messages) => {
168
165
  // TODO: dedicated debug level?
169
166
  logger.verbose(messagesToDiagnostic(messages));
170
167
  };
171
-
172
- // $FlowFixMe
173
168
  console.warn = (...messages) => {
174
169
  logger.warn(messagesToDiagnostic(messages));
175
170
  };
176
-
177
- // $FlowFixMe
178
171
  console.error = (...messages) => {
179
172
  logger.error(messagesToDiagnostic(messages));
180
173
  };
@@ -189,19 +182,10 @@ function unpatchConsole() {
189
182
  if (!consolePatched) return;
190
183
 
191
184
  /* eslint-disable no-console */
192
- // $FlowFixMe
193
185
  console.log = INTERNAL_ORIGINAL_CONSOLE.log;
194
-
195
- // $FlowFixMe
196
186
  console.info = INTERNAL_ORIGINAL_CONSOLE.info;
197
-
198
- // $FlowFixMe
199
187
  console.debug = INTERNAL_ORIGINAL_CONSOLE.debug;
200
-
201
- // $FlowFixMe
202
188
  console.warn = INTERNAL_ORIGINAL_CONSOLE.warn;
203
-
204
- // $FlowFixMe
205
189
  console.error = INTERNAL_ORIGINAL_CONSOLE.error;
206
190
 
207
191
  /* eslint-enable no-console */