@parcel/logger 2.0.0-beta.3.1 → 2.0.0-nightly.1006
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/lib/Logger.js +10 -27
- package/package.json +4 -4
- package/src/Logger.js +6 -2
package/lib/Logger.js
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
+
exports.default = exports.PluginLogger = exports.INTERNAL_ORIGINAL_CONSOLE = void 0;
|
6
7
|
exports.patchConsole = patchConsole;
|
7
8
|
exports.unpatchConsole = unpatchConsole;
|
8
|
-
exports.INTERNAL_ORIGINAL_CONSOLE = exports.PluginLogger = exports.default = void 0;
|
9
9
|
|
10
10
|
function _events() {
|
11
11
|
const data = require("@parcel/events");
|
@@ -37,32 +37,17 @@ function _diagnostic() {
|
|
37
37
|
return data;
|
38
38
|
}
|
39
39
|
|
40
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
41
|
-
|
42
|
-
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
43
|
-
|
44
|
-
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
45
|
-
|
46
|
-
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
47
|
-
|
48
|
-
var _logEmitter = new WeakMap();
|
49
|
-
|
50
40
|
class Logger {
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
value:
|
55
|
-
/*: ValueEmitter<LogEvent> */
|
56
|
-
new (_events().ValueEmitter)()
|
57
|
-
});
|
58
|
-
}
|
41
|
+
#logEmitter
|
42
|
+
/*: ValueEmitter<LogEvent> */
|
43
|
+
= new (_events().ValueEmitter)();
|
59
44
|
|
60
45
|
onLog(cb) {
|
61
|
-
return
|
46
|
+
return this.#logEmitter.addListener(cb);
|
62
47
|
}
|
63
48
|
|
64
49
|
verbose(diagnostic) {
|
65
|
-
|
50
|
+
this.#logEmitter.emit({
|
66
51
|
type: 'log',
|
67
52
|
level: 'verbose',
|
68
53
|
diagnostics: Array.isArray(diagnostic) ? diagnostic : [diagnostic]
|
@@ -74,7 +59,7 @@ class Logger {
|
|
74
59
|
}
|
75
60
|
|
76
61
|
log(diagnostic) {
|
77
|
-
|
62
|
+
this.#logEmitter.emit({
|
78
63
|
type: 'log',
|
79
64
|
level: 'info',
|
80
65
|
diagnostics: Array.isArray(diagnostic) ? diagnostic : [diagnostic]
|
@@ -82,7 +67,7 @@ class Logger {
|
|
82
67
|
}
|
83
68
|
|
84
69
|
warn(diagnostic) {
|
85
|
-
|
70
|
+
this.#logEmitter.emit({
|
86
71
|
type: 'log',
|
87
72
|
level: 'warn',
|
88
73
|
diagnostics: Array.isArray(diagnostic) ? diagnostic : [diagnostic]
|
@@ -102,7 +87,7 @@ class Logger {
|
|
102
87
|
};
|
103
88
|
}
|
104
89
|
|
105
|
-
|
90
|
+
this.#logEmitter.emit({
|
106
91
|
type: 'log',
|
107
92
|
level: 'error',
|
108
93
|
diagnostics: Array.isArray(diagnostic) ? diagnostic : [diagnostic]
|
@@ -110,7 +95,7 @@ class Logger {
|
|
110
95
|
}
|
111
96
|
|
112
97
|
progress(message) {
|
113
|
-
|
98
|
+
this.#logEmitter.emit({
|
114
99
|
type: 'log',
|
115
100
|
level: 'progress',
|
116
101
|
message
|
@@ -130,8 +115,6 @@ class PluginLogger {
|
|
130
115
|
|
131
116
|
/** @private */
|
132
117
|
constructor(opts) {
|
133
|
-
_defineProperty(this, "origin", void 0);
|
134
|
-
|
135
118
|
this.origin = opts.origin;
|
136
119
|
}
|
137
120
|
/** @private */
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@parcel/logger",
|
3
|
-
"version": "2.0.0-
|
3
|
+
"version": "2.0.0-nightly.1006+18b038d5",
|
4
4
|
"description": "Blazing fast, zero configuration web application bundler",
|
5
5
|
"license": "MIT",
|
6
6
|
"publishConfig": {
|
@@ -20,8 +20,8 @@
|
|
20
20
|
"node": ">= 12.0.0"
|
21
21
|
},
|
22
22
|
"dependencies": {
|
23
|
-
"@parcel/diagnostic": "2.0.0-
|
24
|
-
"@parcel/events": "2.0.0-
|
23
|
+
"@parcel/diagnostic": "2.0.0-nightly.1006+18b038d5",
|
24
|
+
"@parcel/events": "2.0.0-nightly.1006+18b038d5"
|
25
25
|
},
|
26
|
-
"gitHead": "
|
26
|
+
"gitHead": "18b038d57043965afb31077db1f46dadb11a6a78"
|
27
27
|
}
|
package/src/Logger.js
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
// @flow strict-local
|
2
2
|
|
3
|
-
import type {
|
3
|
+
import type {
|
4
|
+
IDisposable,
|
5
|
+
LogEvent,
|
6
|
+
PluginLogger as IPluginLogger,
|
7
|
+
} from '@parcel/types';
|
4
8
|
import type {
|
5
9
|
Diagnostic,
|
6
10
|
Diagnostifiable,
|
@@ -83,7 +87,7 @@ export type PluginLoggerOpts = {|
|
|
83
87
|
origin: string,
|
84
88
|
|};
|
85
89
|
|
86
|
-
export class PluginLogger {
|
90
|
+
export class PluginLogger implements IPluginLogger {
|
87
91
|
/** @private */
|
88
92
|
origin: string;
|
89
93
|
|