@wdio/logger 7.20.8-alpha.504 → 7.26.0

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/build/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
- import type loggerType from './node';
2
- declare const _default: typeof loggerType;
3
- export default _default;
1
+ /**
2
+ * environment check to allow to use this package in a web context
3
+ */
4
+ declare let mode: any;
5
+ export default mode;
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,UAAU,MAAM,QAAQ,CAAA;;AAqBpC,wBAAgD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA;;GAEG;AAGH,QAAA,IAAI,IAAI,KAA2B,CAAA;AAcnC,eAAe,IAAI,CAAA"}
package/build/index.js CHANGED
@@ -1,19 +1,21 @@
1
+ "use strict";
1
2
  /* istanbul ignore file */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
2
4
  /**
3
5
  * environment check to allow to use this package in a web context
4
6
  */
5
7
  // By default, import the web code using a literal require, so that in webpack
6
8
  // contexts, it will always be bundled
7
- let mode = await import('./web.js');
9
+ let mode = require('./web').default;
8
10
  // Then, if we're in a Node.js context, require the node version of this module
9
11
  // using a variable, so that it will _not_ be included in a bundle, either
10
12
  // during compilation or execution
11
13
  if (typeof process !== 'undefined' && typeof process.release !== 'undefined' && process.release.name === 'node') {
12
- const nodeMode = './node.js';
13
- mode = await import(nodeMode);
14
+ const nodeMode = './node';
15
+ mode = require(nodeMode).default;
14
16
  }
15
17
  // The net result will be that in a Node context, we'll have required both
16
18
  // files but will use the correct one, and in the web context, we'll have only
17
19
  // required the web file, thus ensuring that the Node file and related
18
20
  // dependencies will not be bundled inadvertently.
19
- export default mode.default;
21
+ exports.default = mode;
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAGA,OAAO,GAAG,MAAM,UAAU,CAAA;AA2G1B,iBAAwB,SAAS,CAAE,IAAI,EAAE,MAAM,cAwB9C;kBAxBuB,SAAS;;;;;;eAAT,SAAS;AAgFjC,oBAAY,MAAM,GAAG,GAAG,CAAC,MAAM,CAAA"}
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AACA,OAAO,GAAG,MAAM,UAAU,CAAA;AA4G1B,iBAAwB,SAAS,CAAE,IAAI,EAAE,MAAM,cAwB9C;kBAxBuB,SAAS;;;;;;eAAT,SAAS;AAgFjC,oBAAY,MAAM,GAAG,GAAG,CAAC,MAAM,CAAA"}
package/build/node.js CHANGED
@@ -1,10 +1,15 @@
1
- import fs from 'node:fs';
2
- import util from 'node:util';
3
- import log from 'loglevel';
4
- import chalk from 'chalk';
5
- import prefix from 'loglevel-plugin-prefix';
6
- import ansiStrip from 'strip-ansi';
7
- prefix.reg(log);
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const fs_1 = __importDefault(require("fs"));
7
+ const loglevel_1 = __importDefault(require("loglevel"));
8
+ const util_1 = __importDefault(require("util"));
9
+ const chalk_1 = __importDefault(require("chalk"));
10
+ const loglevel_plugin_prefix_1 = __importDefault(require("loglevel-plugin-prefix"));
11
+ const strip_ansi_1 = __importDefault(require("strip-ansi"));
12
+ loglevel_plugin_prefix_1.default.reg(loglevel_1.default);
8
13
  const DEFAULT_LEVEL = process.env.WDIO_DEBUG
9
14
  ? 'trace'
10
15
  : 'info';
@@ -31,25 +36,25 @@ const SERIALIZERS = [{
31
36
  * color commands blue
32
37
  */
33
38
  matches: (log) => log === matches.COMMAND,
34
- serialize: (log) => chalk.magenta(log)
39
+ serialize: (log) => chalk_1.default.magenta(log)
35
40
  }, {
36
41
  /**
37
42
  * color data yellow
38
43
  */
39
44
  matches: (log) => log === matches.DATA,
40
- serialize: (log) => chalk.yellow(log)
45
+ serialize: (log) => chalk_1.default.yellow(log)
41
46
  }, {
42
47
  /**
43
48
  * color result cyan
44
49
  */
45
50
  matches: (log) => log === matches.RESULT,
46
- serialize: (log) => chalk.cyan(log)
51
+ serialize: (log) => chalk_1.default.cyan(log)
47
52
  }];
48
- const loggers = log.getLoggers();
53
+ const loggers = loglevel_1.default.getLoggers();
49
54
  let logLevelsConfig = {};
50
55
  const logCache = new Set();
51
56
  let logFile;
52
- const originalFactory = log.methodFactory;
57
+ const originalFactory = loglevel_1.default.methodFactory;
53
58
  const wdioLoggerMethodFactory = function (methodName, logLevel, loggerName) {
54
59
  const rawMethod = originalFactory(methodName, logLevel, loggerName);
55
60
  return (...args) => {
@@ -57,7 +62,7 @@ const wdioLoggerMethodFactory = function (methodName, logLevel, loggerName) {
57
62
  * create logFile lazily
58
63
  */
59
64
  if (!logFile && process.env.WDIO_LOG_PATH) {
60
- logFile = fs.createWriteStream(process.env.WDIO_LOG_PATH);
65
+ logFile = fs_1.default.createWriteStream(process.env.WDIO_LOG_PATH);
61
66
  }
62
67
  /**
63
68
  * split `prefixer: value` sting to `prefixer: ` and `value`
@@ -76,7 +81,7 @@ const wdioLoggerMethodFactory = function (methodName, logLevel, loggerName) {
76
81
  }
77
82
  return arg;
78
83
  });
79
- const logText = ansiStrip(`${util.format.apply(this, args)}\n`);
84
+ const logText = (0, strip_ansi_1.default)(`${util_1.default.format.apply(this, args)}\n`);
80
85
  if (logFile && logFile.writable) {
81
86
  /**
82
87
  * empty logging cache if stuff got logged before
@@ -95,7 +100,7 @@ const wdioLoggerMethodFactory = function (methodName, logLevel, loggerName) {
95
100
  rawMethod(...args);
96
101
  };
97
102
  };
98
- export default function getLogger(name) {
103
+ function getLogger(name) {
99
104
  /**
100
105
  * check if logger was already initiated
101
106
  */
@@ -107,17 +112,18 @@ export default function getLogger(name) {
107
112
  if (logLevelsConfig[logLevelName]) {
108
113
  logLevel = logLevelsConfig[logLevelName];
109
114
  }
110
- loggers[name] = log.getLogger(name);
115
+ loggers[name] = loglevel_1.default.getLogger(name);
111
116
  loggers[name].setLevel(logLevel);
112
117
  loggers[name].methodFactory = wdioLoggerMethodFactory;
113
- prefix.apply(loggers[name], {
118
+ loglevel_plugin_prefix_1.default.apply(loggers[name], {
114
119
  template: '%t %l %n:',
115
- timestampFormatter: (date) => chalk.gray(date.toISOString()),
116
- levelFormatter: (level) => chalk[COLORS[level]](level.toUpperCase()),
117
- nameFormatter: (name) => chalk.whiteBright(name)
120
+ timestampFormatter: (date) => chalk_1.default.gray(date.toISOString()),
121
+ levelFormatter: (level) => chalk_1.default[COLORS[level]](level.toUpperCase()),
122
+ nameFormatter: (name) => chalk_1.default.whiteBright(name)
118
123
  });
119
124
  return loggers[name];
120
125
  }
126
+ exports.default = getLogger;
121
127
  /**
122
128
  * Wait for writable stream to be flushed.
123
129
  * Calling this prevents part of the logs in the very env to be lost.
package/build/web.js CHANGED
@@ -1,6 +1,8 @@
1
+ "use strict";
1
2
  /* istanbul ignore file */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
2
4
  const LOG_METHODS = ['error', 'warn', 'info', 'debug', 'trace', 'silent'];
3
- export default function getLogger(component) {
5
+ function getLogger(component) {
4
6
  return LOG_METHODS.reduce((acc, cur) => {
5
7
  const prop = cur;
6
8
  // check if the method is available on console (web doesn't have
@@ -14,6 +16,7 @@ export default function getLogger(component) {
14
16
  return acc;
15
17
  }, {});
16
18
  }
19
+ exports.default = getLogger;
17
20
  // logging interface expects a 'setLevel' method
18
21
  getLogger.setLevel = () => { };
19
22
  getLogger.setLogLevelsConfig = () => { };
package/package.json CHANGED
@@ -1,21 +1,17 @@
1
1
  {
2
2
  "name": "@wdio/logger",
3
- "version": "7.20.8-alpha.504+428a9d729",
3
+ "version": "7.26.0",
4
4
  "description": "A helper utility for logging of WebdriverIO packages",
5
5
  "author": "Christian Bromann <mail@bromann.dev>",
6
6
  "homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-logger",
7
7
  "license": "MIT",
8
- "type": "module",
9
- "exports": "./build/index.js",
10
- "types": "./build/index.d.ts",
11
- "typeScriptVersion": "3.8.3",
8
+ "main": "./build/node",
12
9
  "engines": {
13
- "node": "^16.13 || >=18"
10
+ "node": ">=12.0.0"
14
11
  },
15
12
  "repository": {
16
13
  "type": "git",
17
- "url": "git://github.com/webdriverio/webdriverio.git",
18
- "directory": "packages/wdio-logger"
14
+ "url": "git://github.com/webdriverio/webdriverio.git"
19
15
  },
20
16
  "keywords": [
21
17
  "webdriver",
@@ -25,8 +21,10 @@
25
21
  "bugs": {
26
22
  "url": "https://github.com/webdriverio/webdriverio/issues"
27
23
  },
24
+ "types": "./build/node.d.ts",
25
+ "typeScriptVersion": "3.8.3",
28
26
  "dependencies": {
29
- "chalk": "^5.1.2",
27
+ "chalk": "^4.0.0",
30
28
  "loglevel": "^1.6.0",
31
29
  "loglevel-plugin-prefix": "^0.8.4",
32
30
  "strip-ansi": "^6.0.0"
@@ -34,5 +32,5 @@
34
32
  "publishConfig": {
35
33
  "access": "public"
36
34
  },
37
- "gitHead": "428a9d729ae6231968a60908732fa3f607d195e9"
35
+ "gitHead": "573927a79dc0a2b9d9a9e19e7d1b8c1ff9fac308"
38
36
  }