@parcel/logger 2.0.0-beta.2 → 2.0.0-nightly.1004
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 -23
- 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,28 +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 = privateMap.get(receiver); if (!descriptor) { throw new TypeError("attempted to get private field on non-instance"); } if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
43
|
-
|
44
|
-
var _logEmitter = new WeakMap();
|
45
|
-
|
46
40
|
class Logger {
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
value:
|
51
|
-
/*: ValueEmitter<LogEvent> */
|
52
|
-
new (_events().ValueEmitter)()
|
53
|
-
});
|
54
|
-
}
|
41
|
+
#logEmitter
|
42
|
+
/*: ValueEmitter<LogEvent> */
|
43
|
+
= new (_events().ValueEmitter)();
|
55
44
|
|
56
45
|
onLog(cb) {
|
57
|
-
return
|
46
|
+
return this.#logEmitter.addListener(cb);
|
58
47
|
}
|
59
48
|
|
60
49
|
verbose(diagnostic) {
|
61
|
-
|
50
|
+
this.#logEmitter.emit({
|
62
51
|
type: 'log',
|
63
52
|
level: 'verbose',
|
64
53
|
diagnostics: Array.isArray(diagnostic) ? diagnostic : [diagnostic]
|
@@ -70,7 +59,7 @@ class Logger {
|
|
70
59
|
}
|
71
60
|
|
72
61
|
log(diagnostic) {
|
73
|
-
|
62
|
+
this.#logEmitter.emit({
|
74
63
|
type: 'log',
|
75
64
|
level: 'info',
|
76
65
|
diagnostics: Array.isArray(diagnostic) ? diagnostic : [diagnostic]
|
@@ -78,7 +67,7 @@ class Logger {
|
|
78
67
|
}
|
79
68
|
|
80
69
|
warn(diagnostic) {
|
81
|
-
|
70
|
+
this.#logEmitter.emit({
|
82
71
|
type: 'log',
|
83
72
|
level: 'warn',
|
84
73
|
diagnostics: Array.isArray(diagnostic) ? diagnostic : [diagnostic]
|
@@ -98,7 +87,7 @@ class Logger {
|
|
98
87
|
};
|
99
88
|
}
|
100
89
|
|
101
|
-
|
90
|
+
this.#logEmitter.emit({
|
102
91
|
type: 'log',
|
103
92
|
level: 'error',
|
104
93
|
diagnostics: Array.isArray(diagnostic) ? diagnostic : [diagnostic]
|
@@ -106,7 +95,7 @@ class Logger {
|
|
106
95
|
}
|
107
96
|
|
108
97
|
progress(message) {
|
109
|
-
|
98
|
+
this.#logEmitter.emit({
|
110
99
|
type: 'log',
|
111
100
|
level: 'progress',
|
112
101
|
message
|
@@ -126,8 +115,6 @@ class PluginLogger {
|
|
126
115
|
|
127
116
|
/** @private */
|
128
117
|
constructor(opts) {
|
129
|
-
_defineProperty(this, "origin", void 0);
|
130
|
-
|
131
118
|
this.origin = opts.origin;
|
132
119
|
}
|
133
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.1004+47379bf8",
|
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.1004+47379bf8",
|
24
|
+
"@parcel/events": "2.0.0-nightly.1004+47379bf8"
|
25
25
|
},
|
26
|
-
"gitHead": "
|
26
|
+
"gitHead": "47379bf8fabeb2cfe03ade8802d942388b153e5b"
|
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
|
|