@teambit/logger 0.0.0-0147ce868254fc4ff0b5e38344f4ce9b2c09e7a7

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/dist/esm.d.mts ADDED
@@ -0,0 +1,4 @@
1
+ export const Logger: any;
2
+ export const LoggerAspect: any;
3
+ export const LongProcessLogger: any;
4
+ export default cjsModule;
package/dist/esm.mjs ADDED
@@ -0,0 +1,9 @@
1
+ // eslint-disable-next-line import/no-unresolved
2
+ import cjsModule from './index.js';
3
+
4
+ export const Logger = cjsModule.Logger;
5
+ export const LoggerAspect = cjsModule.LoggerAspect;
6
+ export const LongProcessLogger = cjsModule.LongProcessLogger;
7
+
8
+ export default cjsModule;
9
+
@@ -0,0 +1,4 @@
1
+ export { Logger } from './logger';
2
+ export type { LoggerMain } from './logger.main.runtime';
3
+ export { LoggerAspect } from './logger.aspect';
4
+ export { LongProcessLogger } from './long-process-logger';
package/dist/index.js ADDED
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Logger", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _logger().Logger;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "LoggerAspect", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _logger2().LoggerAspect;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "LongProcessLogger", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _longProcessLogger().LongProcessLogger;
22
+ }
23
+ });
24
+ function _logger() {
25
+ const data = require("./logger");
26
+ _logger = function () {
27
+ return data;
28
+ };
29
+ return data;
30
+ }
31
+ function _logger2() {
32
+ const data = require("./logger.aspect");
33
+ _logger2 = function () {
34
+ return data;
35
+ };
36
+ return data;
37
+ }
38
+ function _longProcessLogger() {
39
+ const data = require("./long-process-logger");
40
+ _longProcessLogger = function () {
41
+ return data;
42
+ };
43
+ return data;
44
+ }
45
+
46
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_logger","data","require","_logger2","_longProcessLogger"],"sources":["index.ts"],"sourcesContent":["export { Logger } from './logger';\nexport type { LoggerMain } from './logger.main.runtime';\nexport { LoggerAspect } from './logger.aspect';\nexport { LongProcessLogger } from './long-process-logger';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,mBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,kBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ import { Aspect } from '@teambit/harmony';
2
+ export declare const LoggerAspect: Aspect;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.LoggerAspect = void 0;
7
+ function _harmony() {
8
+ const data = require("@teambit/harmony");
9
+ _harmony = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ const LoggerAspect = exports.LoggerAspect = _harmony().Aspect.create({
15
+ id: 'teambit.harmony/logger',
16
+ dependencies: [],
17
+ defaultConfig: {}
18
+ });
19
+
20
+ //# sourceMappingURL=logger.aspect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_harmony","data","require","LoggerAspect","exports","Aspect","create","id","dependencies","defaultConfig"],"sources":["logger.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const LoggerAspect = Aspect.create({\n id: 'teambit.harmony/logger',\n dependencies: [],\n defaultConfig: {},\n});\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAME,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAGE,iBAAM,CAACC,MAAM,CAAC;EACxCC,EAAE,EAAE,wBAAwB;EAC5BC,YAAY,EAAE,EAAE;EAChBC,aAAa,EAAE,CAAC;AAClB,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export declare const Logo: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Logo = void 0;
7
+ function _react() {
8
+ const data = _interopRequireDefault(require("react"));
9
+ _react = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
16
+ style: {
17
+ height: '100%',
18
+ display: 'flex',
19
+ justifyContent: 'center'
20
+ }
21
+ }, /*#__PURE__*/_react().default.createElement("img", {
22
+ style: {
23
+ width: 70
24
+ },
25
+ src: "https://static.bit.dev/extensions-icons/logger.svg"
26
+ }));
27
+ exports.Logo = Logo;
28
+
29
+ //# sourceMappingURL=logger.composition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","data","_interopRequireDefault","require","e","__esModule","default","Logo","createElement","style","height","display","justifyContent","width","src","exports"],"sources":["logger.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/logger.svg\" />\n </div>\n);\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0B,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEnB,MAAMG,IAAI,GAAGA,CAAA,kBAClBP,MAAA,GAAAM,OAAA,CAAAE,aAAA;EAAKC,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxEZ,MAAA,GAAAM,OAAA,CAAAE,aAAA;EAAKC,KAAK,EAAE;IAAEI,KAAK,EAAE;EAAG,CAAE;EAACC,GAAG,EAAC;AAAoD,CAAE,CAClF,CACN;AAACC,OAAA,CAAAR,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -0,0 +1,82 @@
1
+ import Spinnies from 'dreidels';
2
+ import type { IBitLogger } from '@teambit/legacy.logger';
3
+ import type { ConsoleOnStart } from './long-process-logger';
4
+ import { LongProcessLogger } from './long-process-logger';
5
+ export declare class Logger implements IBitLogger {
6
+ private extensionName;
7
+ private spinnies?;
8
+ constructor(extensionName: string);
9
+ trace(message: string, ...meta: any[]): void;
10
+ debug(message: string, ...meta: any[]): void;
11
+ info(message: string, ...meta: any[]): void;
12
+ warn(message: string, ...meta: any[]): void;
13
+ error(message: string, ...meta: any[]): void;
14
+ fatal(message: string, ...meta: any[]): void;
15
+ get isLoaderStarted(): boolean;
16
+ get isSpinning(): boolean | undefined;
17
+ get multiSpinner(): Spinnies;
18
+ /**
19
+ * use it for a long running process. upon creation it logs the `processDescription`.
20
+ * if the process involves iteration over a list of items, such as running tag on a list of
21
+ * components, then pass the `totalItems` as the total of the total components in the list.
22
+ * later, during the iteration, call `LongProcessLogger.logProgress(componentName)`.
23
+ * once done, call `LongProcessLogger.end()`
24
+ * the status-line will show all messages in the terminal.
25
+ */
26
+ createLongProcessLogger(processDescription: string, totalItems?: number, shouldConsole?: ConsoleOnStart): LongProcessLogger;
27
+ /**
28
+ * single status-line on the bottom of the screen.
29
+ * the text is replaced every time this method is called.
30
+ */
31
+ setStatusLine(text: string, shouldPrintOnCI?: boolean): void;
32
+ /**
33
+ * remove the text from the last line on the screen.
34
+ */
35
+ clearStatusLine(): void;
36
+ /**
37
+ * print to the screen. if message is empty, print the last logged message.
38
+ */
39
+ console(message?: string, ...meta: any[]): void;
40
+ /**
41
+ * @deprecated
42
+ * try using consoleWarning. if not possible, rename this method to a clearer one
43
+ */
44
+ consoleWarn(message?: string, ...meta: any[]): void;
45
+ /**
46
+ * @deprecated
47
+ * try using consoleFailure. if not possible, rename this method to a clearer one
48
+ */
49
+ consoleError(message?: string, ...meta: any[]): void;
50
+ /**
51
+ * print to the screen as a title, with bold text.
52
+ */
53
+ consoleTitle(message: string): void;
54
+ /**
55
+ * print to the screen with a green `✔` prefix. if message is empty, print the last logged message.
56
+ */
57
+ consoleSuccess(message?: string, startTime?: [number, number]): void;
58
+ /**
59
+ * turn off the logger.
60
+ */
61
+ off(): import("@teambit/legacy.loader").Loader;
62
+ on(): import("@teambit/legacy.loader").Loader;
63
+ profile(id: string, console?: boolean): void;
64
+ /**
65
+ * by default, the "profile" writes the message as "info". use this method to write it as "trace".
66
+ */
67
+ profileTrace(id: string): void;
68
+ /**
69
+ * print to the screen with a red `✖` prefix. if message is empty, print the last logged message.
70
+ */
71
+ consoleFailure(message?: string): void;
72
+ /**
73
+ * print to the screen with a red `⚠` prefix. if message is empty, print the last logged message.
74
+ */
75
+ consoleWarning(message?: string): void;
76
+ private colorMessage;
77
+ /**
78
+ * a recent change on Windows caused the check mark to be printed as purple.
79
+ * see https://github.com/chalk/chalk/issues/625
80
+ */
81
+ static successSymbol(): string;
82
+ }
@@ -0,0 +1,8 @@
1
+ ---
2
+ description: A component-driven logger.
3
+ labels: ['logger', 'component-based', 'bit']
4
+ ---
5
+
6
+ import { Logger } from '@teambit/harmony.aspect-docs.logger';
7
+
8
+ <Logger />
package/dist/logger.js ADDED
@@ -0,0 +1,228 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Logger = void 0;
7
+ function _dreidels() {
8
+ const data = _interopRequireDefault(require("dreidels"));
9
+ _dreidels = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _legacy() {
15
+ const data = require("@teambit/legacy.loader");
16
+ _legacy = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
21
+ function _legacy2() {
22
+ const data = require("@teambit/legacy.logger");
23
+ _legacy2 = function () {
24
+ return data;
25
+ };
26
+ return data;
27
+ }
28
+ function _chalk() {
29
+ const data = _interopRequireDefault(require("chalk"));
30
+ _chalk = function () {
31
+ return data;
32
+ };
33
+ return data;
34
+ }
35
+ function _os() {
36
+ const data = require("os");
37
+ _os = function () {
38
+ return data;
39
+ };
40
+ return data;
41
+ }
42
+ function _longProcessLogger() {
43
+ const data = require("./long-process-logger");
44
+ _longProcessLogger = function () {
45
+ return data;
46
+ };
47
+ return data;
48
+ }
49
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
50
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
51
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
52
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
53
+ class Logger {
54
+ constructor(extensionName) {
55
+ this.extensionName = extensionName;
56
+ _defineProperty(this, "spinnies", void 0);
57
+ }
58
+ trace(message, ...meta) {
59
+ _legacy2().logger.trace(this.colorMessage(message), ...meta);
60
+ }
61
+ debug(message, ...meta) {
62
+ _legacy2().logger.debug(this.colorMessage(message), ...meta);
63
+ }
64
+ info(message, ...meta) {
65
+ _legacy2().logger.info(this.colorMessage(message), ...meta);
66
+ }
67
+ warn(message, ...meta) {
68
+ _legacy2().logger.warn(this.colorMessage(message), ...meta);
69
+ }
70
+ error(message, ...meta) {
71
+ _legacy2().logger.error(this.colorMessage(message), ...meta);
72
+ }
73
+ fatal(message, ...meta) {
74
+ _legacy2().logger.fatal(this.colorMessage(message), ...meta);
75
+ }
76
+ get isLoaderStarted() {
77
+ return _legacy().loader.isStarted;
78
+ }
79
+ get isSpinning() {
80
+ return _legacy().loader.isSpinning;
81
+ }
82
+ get multiSpinner() {
83
+ if (!this.spinnies) this.spinnies = new (_dreidels().default)();
84
+ return this.spinnies;
85
+ }
86
+
87
+ /**
88
+ * use it for a long running process. upon creation it logs the `processDescription`.
89
+ * if the process involves iteration over a list of items, such as running tag on a list of
90
+ * components, then pass the `totalItems` as the total of the total components in the list.
91
+ * later, during the iteration, call `LongProcessLogger.logProgress(componentName)`.
92
+ * once done, call `LongProcessLogger.end()`
93
+ * the status-line will show all messages in the terminal.
94
+ */
95
+ createLongProcessLogger(processDescription, totalItems, shouldConsole) {
96
+ return new (_longProcessLogger().LongProcessLogger)(this, this.extensionName, processDescription, totalItems, shouldConsole);
97
+ }
98
+ /**
99
+ * single status-line on the bottom of the screen.
100
+ * the text is replaced every time this method is called.
101
+ */
102
+ setStatusLine(text, shouldPrintOnCI = false) {
103
+ if (process.env.CI && !shouldPrintOnCI) return;
104
+ _legacy().loader.setTextAndRestart(text);
105
+ }
106
+ /**
107
+ * remove the text from the last line on the screen.
108
+ */
109
+ clearStatusLine() {
110
+ _legacy().loader.stop();
111
+ }
112
+ /**
113
+ * print to the screen. if message is empty, print the last logged message.
114
+ */
115
+ console(message, ...meta) {
116
+ if (message) this.info(message, meta);
117
+ if (!_legacy().loader.isStarted && _legacy2().logger.shouldWriteToConsole) {
118
+ // eslint-disable-next-line no-console
119
+ console.log(message, ...meta);
120
+ } else {
121
+ _legacy().loader.stopAndPersist({
122
+ text: message
123
+ });
124
+ }
125
+ }
126
+
127
+ /**
128
+ * @deprecated
129
+ * try using consoleWarning. if not possible, rename this method to a clearer one
130
+ */
131
+ consoleWarn(message, ...meta) {
132
+ if (message) this.warn(message, ...meta);
133
+ if (!_legacy().loader.isStarted && _legacy2().logger.shouldWriteToConsole) {
134
+ // eslint-disable-next-line no-console
135
+ console.warn(message, ...meta);
136
+ } else {
137
+ _legacy().loader.stopAndPersist({
138
+ text: message
139
+ });
140
+ }
141
+ }
142
+
143
+ /**
144
+ * @deprecated
145
+ * try using consoleFailure. if not possible, rename this method to a clearer one
146
+ */
147
+ consoleError(message, ...meta) {
148
+ if (message) this.error(message, ...meta);
149
+ if (!_legacy().loader.isStarted && _legacy2().logger.shouldWriteToConsole) {
150
+ // eslint-disable-next-line no-console
151
+ console.error(message, ...meta);
152
+ } else {
153
+ _legacy().loader.stopAndPersist({
154
+ text: message
155
+ });
156
+ }
157
+ }
158
+
159
+ /**
160
+ * print to the screen as a title, with bold text.
161
+ */
162
+ consoleTitle(message) {
163
+ this.info(message);
164
+ _legacy().loader.stopAndPersist({
165
+ text: _chalk().default.bold(message)
166
+ });
167
+ }
168
+ /**
169
+ * print to the screen with a green `✔` prefix. if message is empty, print the last logged message.
170
+ */
171
+ consoleSuccess(message, startTime) {
172
+ if (message) this.info(message);
173
+ _legacy().loader.succeed(message, startTime);
174
+ }
175
+
176
+ /**
177
+ * turn off the logger.
178
+ */
179
+ off() {
180
+ return _legacy().loader.off();
181
+ }
182
+ on() {
183
+ return _legacy().loader.on();
184
+ }
185
+ profile(id, console) {
186
+ _legacy2().logger.profile(id, console);
187
+ }
188
+
189
+ /**
190
+ * by default, the "profile" writes the message as "info". use this method to write it as "trace".
191
+ */
192
+ profileTrace(id) {
193
+ _legacy2().logger.profile(id, false, 'trace');
194
+ }
195
+
196
+ /**
197
+ * print to the screen with a red `✖` prefix. if message is empty, print the last logged message.
198
+ */
199
+ consoleFailure(message) {
200
+ if (message) this.error(message);
201
+ _legacy().loader.fail(message);
202
+ }
203
+ /**
204
+ * print to the screen with a red `⚠` prefix. if message is empty, print the last logged message.
205
+ */
206
+ consoleWarning(message) {
207
+ if (message) {
208
+ this.warn(message);
209
+ message = _chalk().default.yellow(message);
210
+ }
211
+ _legacy().loader.warn(message);
212
+ }
213
+ colorMessage(message) {
214
+ if (_legacy2().logger.isJsonFormat) return `${this.extensionName}, ${message}`;
215
+ return `${_chalk().default.bold(this.extensionName)}, ${message}`;
216
+ }
217
+
218
+ /**
219
+ * a recent change on Windows caused the check mark to be printed as purple.
220
+ * see https://github.com/chalk/chalk/issues/625
221
+ */
222
+ static successSymbol() {
223
+ return (0, _os().platform)() === 'win32' ? _chalk().default.green('✓') : _chalk().default.green('✔');
224
+ }
225
+ }
226
+ exports.Logger = Logger;
227
+
228
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_dreidels","data","_interopRequireDefault","require","_legacy","_legacy2","_chalk","_os","_longProcessLogger","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","Logger","constructor","extensionName","trace","message","meta","logger","colorMessage","debug","info","warn","error","fatal","isLoaderStarted","loader","isStarted","isSpinning","multiSpinner","spinnies","Spinnies","createLongProcessLogger","processDescription","totalItems","shouldConsole","LongProcessLogger","setStatusLine","text","shouldPrintOnCI","process","env","CI","setTextAndRestart","clearStatusLine","stop","console","shouldWriteToConsole","log","stopAndPersist","consoleWarn","consoleError","consoleTitle","chalk","bold","consoleSuccess","startTime","succeed","off","on","profile","id","profileTrace","consoleFailure","fail","consoleWarning","yellow","isJsonFormat","successSymbol","platform","green","exports"],"sources":["logger.ts"],"sourcesContent":["import Spinnies from 'dreidels';\nimport { loader } from '@teambit/legacy.loader';\nimport type { IBitLogger } from '@teambit/legacy.logger';\nimport { logger } from '@teambit/legacy.logger';\nimport chalk from 'chalk';\nimport { platform } from 'os';\nimport type { ConsoleOnStart } from './long-process-logger';\nimport { LongProcessLogger } from './long-process-logger';\n\nexport class Logger implements IBitLogger {\n private spinnies?: Spinnies;\n constructor(private extensionName: string) {}\n\n trace(message: string, ...meta: any[]) {\n logger.trace(this.colorMessage(message), ...meta);\n }\n debug(message: string, ...meta: any[]) {\n logger.debug(this.colorMessage(message), ...meta);\n }\n info(message: string, ...meta: any[]) {\n logger.info(this.colorMessage(message), ...meta);\n }\n warn(message: string, ...meta: any[]) {\n logger.warn(this.colorMessage(message), ...meta);\n }\n error(message: string, ...meta: any[]) {\n logger.error(this.colorMessage(message), ...meta);\n }\n fatal(message: string, ...meta: any[]) {\n logger.fatal(this.colorMessage(message), ...meta);\n }\n\n get isLoaderStarted() {\n return loader.isStarted;\n }\n\n get isSpinning() {\n return loader.isSpinning;\n }\n\n get multiSpinner(): Spinnies {\n if (!this.spinnies) this.spinnies = new Spinnies();\n return this.spinnies;\n }\n\n /**\n * use it for a long running process. upon creation it logs the `processDescription`.\n * if the process involves iteration over a list of items, such as running tag on a list of\n * components, then pass the `totalItems` as the total of the total components in the list.\n * later, during the iteration, call `LongProcessLogger.logProgress(componentName)`.\n * once done, call `LongProcessLogger.end()`\n * the status-line will show all messages in the terminal.\n */\n createLongProcessLogger(\n processDescription: string,\n totalItems?: number,\n shouldConsole?: ConsoleOnStart\n ): LongProcessLogger {\n return new LongProcessLogger(this, this.extensionName, processDescription, totalItems, shouldConsole);\n }\n /**\n * single status-line on the bottom of the screen.\n * the text is replaced every time this method is called.\n */\n setStatusLine(text: string, shouldPrintOnCI = false) {\n if (process.env.CI && !shouldPrintOnCI) return;\n loader.setTextAndRestart(text);\n }\n /**\n * remove the text from the last line on the screen.\n */\n clearStatusLine() {\n loader.stop();\n }\n /**\n * print to the screen. if message is empty, print the last logged message.\n */\n console(message?: string, ...meta: any[]) {\n if (message) this.info(message, meta);\n if (!loader.isStarted && logger.shouldWriteToConsole) {\n // eslint-disable-next-line no-console\n console.log(message, ...meta);\n } else {\n loader.stopAndPersist({ text: message });\n }\n }\n\n /**\n * @deprecated\n * try using consoleWarning. if not possible, rename this method to a clearer one\n */\n consoleWarn(message?: string, ...meta: any[]) {\n if (message) this.warn(message, ...meta);\n if (!loader.isStarted && logger.shouldWriteToConsole) {\n // eslint-disable-next-line no-console\n console.warn(message, ...meta);\n } else {\n loader.stopAndPersist({ text: message });\n }\n }\n\n /**\n * @deprecated\n * try using consoleFailure. if not possible, rename this method to a clearer one\n */\n consoleError(message?: string, ...meta: any[]) {\n if (message) this.error(message, ...meta);\n if (!loader.isStarted && logger.shouldWriteToConsole) {\n // eslint-disable-next-line no-console\n console.error(message, ...meta);\n } else {\n loader.stopAndPersist({ text: message });\n }\n }\n\n /**\n * print to the screen as a title, with bold text.\n */\n consoleTitle(message: string) {\n this.info(message);\n loader.stopAndPersist({ text: chalk.bold(message) });\n }\n /**\n * print to the screen with a green `✔` prefix. if message is empty, print the last logged message.\n */\n consoleSuccess(message?: string, startTime?: [number, number]) {\n if (message) this.info(message);\n loader.succeed(message, startTime);\n }\n\n /**\n * turn off the logger.\n */\n off() {\n return loader.off();\n }\n\n on() {\n return loader.on();\n }\n\n profile(id: string, console?: boolean) {\n logger.profile(id, console);\n }\n\n /**\n * by default, the \"profile\" writes the message as \"info\". use this method to write it as \"trace\".\n */\n profileTrace(id: string) {\n logger.profile(id, false, 'trace');\n }\n\n /**\n * print to the screen with a red `✖` prefix. if message is empty, print the last logged message.\n */\n consoleFailure(message?: string) {\n if (message) this.error(message);\n loader.fail(message);\n }\n /**\n * print to the screen with a red `⚠` prefix. if message is empty, print the last logged message.\n */\n consoleWarning(message?: string) {\n if (message) {\n this.warn(message);\n message = chalk.yellow(message);\n }\n loader.warn(message);\n }\n\n private colorMessage(message: string) {\n if (logger.isJsonFormat) return `${this.extensionName}, ${message}`;\n return `${chalk.bold(this.extensionName)}, ${message}`;\n }\n\n /**\n * a recent change on Windows caused the check mark to be printed as purple.\n * see https://github.com/chalk/chalk/issues/625\n */\n static successSymbol() {\n return platform() === 'win32' ? chalk.green('✓') : chalk.green('✔');\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,OAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,MAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,IAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,GAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAO,mBAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,kBAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0D,SAAAC,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,E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,OAAO,EAAE;IACnE,OAAO,GAAGqC,gBAAK,CAACC,IAAI,CAAC,IAAI,CAACxC,aAAa,CAAC,KAAKE,OAAO,EAAE;EACxD;;EAEA;AACF;AACA;AACA;EACE,OAAOoD,aAAaA,CAAA,EAAG;IACrB,OAAO,IAAAC,cAAQ,EAAC,CAAC,KAAK,OAAO,GAAGhB,gBAAK,CAACiB,KAAK,CAAC,GAAG,CAAC,GAAGjB,gBAAK,CAACiB,KAAK,CAAC,GAAG,CAAC;EACrE;AACF;AAACC,OAAA,CAAA3D,MAAA,GAAAA,MAAA","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import { Logger } from './logger';
2
+ export declare class LoggerMain {
3
+ static runtime: import("@teambit/harmony").RuntimeDefinition;
4
+ static dependencies: never[];
5
+ createLogger(extensionName: string): Logger;
6
+ static provider(): Promise<LoggerMain>;
7
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.LoggerMain = void 0;
7
+ function _cli() {
8
+ const data = require("@teambit/cli");
9
+ _cli = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _logger() {
15
+ const data = require("./logger");
16
+ _logger = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
21
+ function _logger2() {
22
+ const data = require("./logger.aspect");
23
+ _logger2 = function () {
24
+ return data;
25
+ };
26
+ return data;
27
+ }
28
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
29
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
30
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
31
+ class LoggerMain {
32
+ createLogger(extensionName) {
33
+ return new (_logger().Logger)(extensionName);
34
+ }
35
+ static async provider() {
36
+ return new LoggerMain();
37
+ }
38
+ }
39
+ exports.LoggerMain = LoggerMain;
40
+ _defineProperty(LoggerMain, "runtime", _cli().MainRuntime);
41
+ _defineProperty(LoggerMain, "dependencies", []);
42
+ _logger2().LoggerAspect.addRuntime(LoggerMain);
43
+
44
+ //# sourceMappingURL=logger.main.runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_cli","data","require","_logger","_logger2","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","LoggerMain","createLogger","extensionName","Logger","provider","exports","MainRuntime","LoggerAspect","addRuntime"],"sources":["logger.main.runtime.ts"],"sourcesContent":["import { MainRuntime } from '@teambit/cli';\n\nimport { Logger } from './logger';\nimport { LoggerAspect } from './logger.aspect';\n\nexport class LoggerMain {\n static runtime = MainRuntime;\n static dependencies = [];\n\n createLogger(extensionName: string): Logger {\n return new Logger(extensionName);\n }\n\n static async provider() {\n return new LoggerMain();\n }\n}\n\nLoggerAspect.addRuntime(LoggerMain);\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA+C,SAAAI,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAb,CAAA,QAAAU,CAAA,GAAAV,CAAA,CAAAc,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAExC,MAAMgB,UAAU,CAAC;EAItBC,YAAYA,CAACC,aAAqB,EAAU;IAC1C,OAAO,KAAIC,gBAAM,EAACD,aAAa,CAAC;EAClC;EAEA,aAAaE,QAAQA,CAAA,EAAG;IACtB,OAAO,IAAIJ,UAAU,CAAC,CAAC;EACzB;AACF;AAACK,OAAA,CAAAL,UAAA,GAAAA,UAAA;AAAAnB,eAAA,CAXYmB,UAAU,aACJM,kBAAW;AAAAzB,eAAA,CADjBmB,UAAU,kBAEC,EAAE;AAW1BO,uBAAY,CAACC,UAAU,CAACR,UAAU,CAAC","ignoreList":[]}
@@ -0,0 +1,24 @@
1
+ import type { Logger } from './logger';
2
+ export type ConsoleOnStart = 'normal' | 'title';
3
+ /**
4
+ * use it for a long running process. upon creation it logs the `processDescription`.
5
+ * if the process involves iteration over a list of items, such as running tag on a list of
6
+ * components, then pass the `totalItems` as the total components in the list.
7
+ * later, during the iteration, call `logProgress(componentName)`.
8
+ * once done, call `end()`.
9
+ * the status-line will show all messages in the terminal.
10
+ * see README for more data.
11
+ */
12
+ export declare class LongProcessLogger {
13
+ private logPublisher;
14
+ private extensionName;
15
+ private processDescription;
16
+ private totalItems?;
17
+ private currentItem;
18
+ private startTime;
19
+ constructor(logPublisher: Logger, extensionName: string, processDescription: string, totalItems?: number | undefined, shouldConsole?: ConsoleOnStart);
20
+ logProgress(itemName?: string, showProcessDescription?: boolean): void;
21
+ end(shouldConsole?: 'success' | 'error'): void;
22
+ getProgress(): string;
23
+ private start;
24
+ }
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.LongProcessLogger = void 0;
7
+ function _prettyTime() {
8
+ const data = _interopRequireDefault(require("pretty-time"));
9
+ _prettyTime = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
16
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
17
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
18
+ /**
19
+ * use it for a long running process. upon creation it logs the `processDescription`.
20
+ * if the process involves iteration over a list of items, such as running tag on a list of
21
+ * components, then pass the `totalItems` as the total components in the list.
22
+ * later, during the iteration, call `logProgress(componentName)`.
23
+ * once done, call `end()`.
24
+ * the status-line will show all messages in the terminal.
25
+ * see README for more data.
26
+ */
27
+ class LongProcessLogger {
28
+ constructor(logPublisher, extensionName, processDescription, totalItems, shouldConsole) {
29
+ this.logPublisher = logPublisher;
30
+ this.extensionName = extensionName;
31
+ this.processDescription = processDescription;
32
+ this.totalItems = totalItems;
33
+ _defineProperty(this, "currentItem", 0);
34
+ _defineProperty(this, "startTime", process.hrtime());
35
+ this.start(shouldConsole);
36
+ }
37
+ logProgress(itemName = '', showProcessDescription = true) {
38
+ this.currentItem += 1;
39
+ const processDesc = showProcessDescription ? `${this.processDescription} ` : '';
40
+ const message = `${processDesc}${this.getProgress()} ${itemName}`;
41
+ this.logPublisher.debug(message);
42
+ this.logPublisher.setStatusLine(message, true);
43
+ }
44
+ end(shouldConsole) {
45
+ if (process.env.CI && !shouldConsole) shouldConsole = 'success';
46
+ const description = this.processDescription;
47
+ const duration = process.hrtime(this.startTime);
48
+ const completedOrFailedStr = !shouldConsole || shouldConsole === 'success' ? 'Succeeded' : 'Failed';
49
+ const message = `${description}. ${completedOrFailedStr} in ${(0, _prettyTime().default)(duration)}`;
50
+ this.logPublisher.info(message);
51
+ if (shouldConsole) {
52
+ if (shouldConsole === 'success') this.logPublisher.consoleSuccess(message);else this.logPublisher.consoleFailure(message);
53
+ } else this.logPublisher.setStatusLine(message);
54
+ }
55
+ getProgress() {
56
+ return `(${this.currentItem}/${this.totalItems})`;
57
+ }
58
+ start(shouldConsole) {
59
+ if (process.env.CI && !shouldConsole) shouldConsole = 'normal';
60
+ const totalItemsStr = this.totalItems ? `(total: ${this.totalItems})` : '';
61
+ const message = `${this.processDescription} ${totalItemsStr}`;
62
+ this.logPublisher.info(message);
63
+ if (shouldConsole) {
64
+ if (shouldConsole === 'title') this.logPublisher.consoleTitle(message);else this.logPublisher.console(message);
65
+ } else this.logPublisher.setStatusLine(message);
66
+ }
67
+ }
68
+ exports.LongProcessLogger = LongProcessLogger;
69
+
70
+ //# sourceMappingURL=long-process-logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_prettyTime","data","_interopRequireDefault","require","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","LongProcessLogger","constructor","logPublisher","extensionName","processDescription","totalItems","shouldConsole","process","hrtime","start","logProgress","itemName","showProcessDescription","currentItem","processDesc","message","getProgress","debug","setStatusLine","end","env","CI","description","duration","startTime","completedOrFailedStr","prettyTime","info","consoleSuccess","consoleFailure","totalItemsStr","consoleTitle","console","exports"],"sources":["long-process-logger.ts"],"sourcesContent":["import prettyTime from 'pretty-time';\nimport type { Logger } from './logger';\n\nexport type ConsoleOnStart = 'normal' | 'title';\n\n/**\n * use it for a long running process. upon creation it logs the `processDescription`.\n * if the process involves iteration over a list of items, such as running tag on a list of\n * components, then pass the `totalItems` as the total components in the list.\n * later, during the iteration, call `logProgress(componentName)`.\n * once done, call `end()`.\n * the status-line will show all messages in the terminal.\n * see README for more data.\n */\nexport class LongProcessLogger {\n private currentItem = 0;\n private startTime = process.hrtime();\n constructor(\n private logPublisher: Logger,\n private extensionName: string,\n private processDescription: string,\n private totalItems?: number,\n shouldConsole?: ConsoleOnStart\n ) {\n this.start(shouldConsole);\n }\n\n logProgress(itemName = '', showProcessDescription = true) {\n this.currentItem += 1;\n const processDesc = showProcessDescription ? `${this.processDescription} ` : '';\n const message = `${processDesc}${this.getProgress()} ${itemName}`;\n this.logPublisher.debug(message);\n this.logPublisher.setStatusLine(message, true);\n }\n\n end(shouldConsole?: 'success' | 'error') {\n if (process.env.CI && !shouldConsole) shouldConsole = 'success';\n const description = this.processDescription;\n const duration = process.hrtime(this.startTime);\n const completedOrFailedStr = !shouldConsole || shouldConsole === 'success' ? 'Succeeded' : 'Failed';\n const message = `${description}. ${completedOrFailedStr} in ${prettyTime(duration)}`;\n this.logPublisher.info(message);\n if (shouldConsole) {\n if (shouldConsole === 'success') this.logPublisher.consoleSuccess(message);\n else this.logPublisher.consoleFailure(message);\n } else this.logPublisher.setStatusLine(message);\n }\n\n getProgress() {\n return `(${this.currentItem}/${this.totalItems})`;\n }\n\n private start(shouldConsole?: ConsoleOnStart) {\n if (process.env.CI && !shouldConsole) shouldConsole = 'normal';\n const totalItemsStr = this.totalItems ? `(total: ${this.totalItems})` : '';\n const message = `${this.processDescription} ${totalItemsStr}`;\n this.logPublisher.info(message);\n if (shouldConsole) {\n if (shouldConsole === 'title') this.logPublisher.consoleTitle(message);\n else this.logPublisher.console(message);\n } else this.logPublisher.setStatusLine(message);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAqC,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAL,CAAA,GAAAK,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAhB,CAAA,QAAAa,CAAA,GAAAb,CAAA,CAAAiB,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAKrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA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C,qBAAU,EAACH,QAAQ,CAAC,EAAE;IACpF,IAAI,CAACrB,YAAY,CAACyB,IAAI,CAACZ,OAAO,CAAC;IAC/B,IAAIT,aAAa,EAAE;MACjB,IAAIA,aAAa,KAAK,SAAS,EAAE,IAAI,CAACJ,YAAY,CAAC0B,cAAc,CAACb,OAAO,CAAC,CAAC,KACtE,IAAI,CAACb,YAAY,CAAC2B,cAAc,CAACd,OAAO,CAAC;IAChD,CAAC,MAAM,IAAI,CAACb,YAAY,CAACgB,aAAa,CAACH,OAAO,CAAC;EACjD;EAEAC,WAAWA,CAAA,EAAG;IACZ,OAAO,IAAI,IAAI,CAACH,WAAW,IAAI,IAAI,CAACR,UAAU,GAAG;EACnD;EAEQI,KAAKA,CAACH,aAA8B,EAAE;IAC5C,IAAIC,OAAO,CAACa,GAAG,CAACC,EAAE,IAAI,CAACf,aAAa,EAAEA,aAAa,GAAG,QAAQ;IAC9D,MAAMwB,aAAa,GAAG,IAAI,CAACzB,UAAU,GAAG,WAAW,IAAI,CAACA,UAAU,GAAG,GAAG,EAAE;IAC1E,MAAMU,OAAO,GAAG,GAAG,IAAI,CAACX,kBAAkB,IAAI0B,aAAa,EAAE;IAC7D,IAAI,CAAC5B,YAAY,CAACyB,IAAI,CAACZ,OAAO,CAAC;IAC/B,IAAIT,aAAa,EAAE;MACjB,IAAIA,aAAa,KAAK,OAAO,EAAE,IAAI,CAACJ,YAAY,CAAC6B,YAAY,CAAChB,OAAO,CAAC,CAAC,KAClE,IAAI,CAACb,YAAY,CAAC8B,OAAO,CAACjB,OAAO,CAAC;IACzC,CAAC,MAAM,IAAI,CAACb,YAAY,CAACgB,aAAa,CAACH,OAAO,CAAC;EACjD;AACF;AAACkB,OAAA,CAAAjC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_logger@0147ce868254fc4ff0b5e38344f4ce9b2c09e7a7/dist/logger.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_logger@0147ce868254fc4ff0b5e38344f4ce9b2c09e7a7/dist/logger.docs.mdx';
3
+
4
+ export const compositions = [compositions_0];
5
+ export const overview = [overview_0];
6
+
7
+ export const compositions_metadata = {"compositions":[{"displayName":"Logo","identifier":"Logo"}]};
package/esm.mjs ADDED
@@ -0,0 +1,9 @@
1
+ // eslint-disable-next-line import/no-unresolved
2
+ import cjsModule from './index.js';
3
+
4
+ export const Logger = cjsModule.Logger;
5
+ export const LoggerAspect = cjsModule.LoggerAspect;
6
+ export const LongProcessLogger = cjsModule.LongProcessLogger;
7
+
8
+ export default cjsModule;
9
+
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+
3
+ export const Logo = () => (
4
+ <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>
5
+ <img style={{ width: 70 }} src="https://static.bit.dev/extensions-icons/logger.svg" />
6
+ </div>
7
+ );
@@ -0,0 +1,8 @@
1
+ ---
2
+ description: A component-driven logger.
3
+ labels: ['logger', 'component-based', 'bit']
4
+ ---
5
+
6
+ import { Logger } from '@teambit/harmony.aspect-docs.logger';
7
+
8
+ <Logger />
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@teambit/logger",
3
+ "version": "0.0.0-0147ce868254fc4ff0b5e38344f4ce9b2c09e7a7",
4
+ "homepage": "https://bit.cloud/teambit/harmony/logger",
5
+ "main": "dist/index.js",
6
+ "componentId": {
7
+ "scope": "teambit.harmony",
8
+ "name": "logger",
9
+ "version": "0147ce868254fc4ff0b5e38344f4ce9b2c09e7a7"
10
+ },
11
+ "dependencies": {
12
+ "chalk": "4.1.2",
13
+ "dreidels": "0.6.1",
14
+ "pretty-time": "1.1.0",
15
+ "@teambit/harmony": "0.4.7",
16
+ "@teambit/legacy.loader": "0.0.9",
17
+ "@teambit/legacy.logger": "0.0.24",
18
+ "@teambit/cli": "0.0.0-e56376984abe78deb023b2d7acac6b2bf260397c"
19
+ },
20
+ "devDependencies": {
21
+ "@types/pretty-time": "^1.1.5",
22
+ "@types/mocha": "9.1.0",
23
+ "@teambit/harmony.aspect-docs.logger": "0.0.171",
24
+ "@teambit/harmony.envs.core-aspect-env": "0.0.75"
25
+ },
26
+ "peerDependencies": {
27
+ "react": "^17.0.0 || ^18.0.0",
28
+ "@types/react": "^17.0.73"
29
+ },
30
+ "license": "Apache-2.0",
31
+ "optionalDependencies": {},
32
+ "peerDependenciesMeta": {},
33
+ "exports": {
34
+ ".": {
35
+ "node": {
36
+ "require": "./dist/index.js",
37
+ "import": "./dist/esm.mjs"
38
+ },
39
+ "default": "./dist/index.js"
40
+ },
41
+ "./dist/*": "./dist/*",
42
+ "./artifacts/*": "./artifacts/*",
43
+ "./*": "./*.ts"
44
+ },
45
+ "private": false,
46
+ "engines": {
47
+ "node": ">=16.0.0"
48
+ },
49
+ "repository": {
50
+ "type": "git",
51
+ "url": "https://github.com/teambit/bit"
52
+ },
53
+ "keywords": [
54
+ "bit",
55
+ "bit-aspect",
56
+ "bit-core-aspect",
57
+ "components",
58
+ "collaboration",
59
+ "web"
60
+ ]
61
+ }
@@ -0,0 +1,41 @@
1
+ declare module '*.png' {
2
+ const value: any;
3
+ export = value;
4
+ }
5
+ declare module '*.svg' {
6
+ import type { FunctionComponent, SVGProps } from 'react';
7
+
8
+ export const ReactComponent: FunctionComponent<
9
+ SVGProps<SVGSVGElement> & { title?: string }
10
+ >;
11
+ const src: string;
12
+ export default src;
13
+ }
14
+ declare module '*.jpg' {
15
+ const value: any;
16
+ export = value;
17
+ }
18
+ declare module '*.jpeg' {
19
+ const value: any;
20
+ export = value;
21
+ }
22
+ declare module '*.gif' {
23
+ const value: any;
24
+ export = value;
25
+ }
26
+ declare module '*.bmp' {
27
+ const value: any;
28
+ export = value;
29
+ }
30
+ declare module '*.otf' {
31
+ const value: any;
32
+ export = value;
33
+ }
34
+ declare module '*.woff' {
35
+ const value: any;
36
+ export = value;
37
+ }
38
+ declare module '*.woff2' {
39
+ const value: any;
40
+ export = value;
41
+ }
@@ -0,0 +1,42 @@
1
+ declare module '*.module.css' {
2
+ const classes: { readonly [key: string]: string };
3
+ export default classes;
4
+ }
5
+ declare module '*.module.scss' {
6
+ const classes: { readonly [key: string]: string };
7
+ export default classes;
8
+ }
9
+ declare module '*.module.sass' {
10
+ const classes: { readonly [key: string]: string };
11
+ export default classes;
12
+ }
13
+
14
+ declare module '*.module.less' {
15
+ const classes: { readonly [key: string]: string };
16
+ export default classes;
17
+ }
18
+
19
+ declare module '*.less' {
20
+ const classes: { readonly [key: string]: string };
21
+ export default classes;
22
+ }
23
+
24
+ declare module '*.css' {
25
+ const classes: { readonly [key: string]: string };
26
+ export default classes;
27
+ }
28
+
29
+ declare module '*.sass' {
30
+ const classes: { readonly [key: string]: string };
31
+ export default classes;
32
+ }
33
+
34
+ declare module '*.scss' {
35
+ const classes: { readonly [key: string]: string };
36
+ export default classes;
37
+ }
38
+
39
+ declare module '*.mdx' {
40
+ const component: any;
41
+ export default component;
42
+ }