nightingale-console 11.7.0 → 12.0.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/.eslintrc.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "root": true,
3
- "extends": ["@pob/eslint-config/root", "@pob/eslint-config-node"],
3
+ "extends": ["@pob/eslint-config/root-commonjs"],
4
4
  "ignorePatterns": ["*.d.ts", "/dist"]
5
5
  }
package/CHANGELOG.md CHANGED
@@ -3,6 +3,60 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [12.0.0](https://github.com/christophehurpeau/nightingale/compare/v11.9.0...v12.0.0) (2021-12-11)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * missed legacy pob-babel ([82a38fa](https://github.com/christophehurpeau/nightingale/commit/82a38fa9743cfac3347386800070fea44d533321))
12
+
13
+
14
+ ### Build System
15
+
16
+ * node 14 and remove dev builds ([432ecd1](https://github.com/christophehurpeau/nightingale/commit/432ecd1faafd0419f57dea00fce560e4cccc207f))
17
+
18
+
19
+ ### Features
20
+
21
+ * drop default exports ([8878e49](https://github.com/christophehurpeau/nightingale/commit/8878e492b94852fcb892fd6d12c02c15c31b38b9))
22
+
23
+
24
+ ### BREAKING CHANGES
25
+
26
+ * use named imports instead of default exports
27
+ * requires node 14
28
+
29
+
30
+
31
+
32
+
33
+ ## [11.7.4](https://github.com/christophehurpeau/nightingale/compare/v11.7.3...v11.7.4) (2021-11-27)
34
+
35
+ **Note:** Version bump only for package nightingale-console
36
+
37
+
38
+
39
+
40
+
41
+ ## [11.7.2](https://github.com/christophehurpeau/nightingale/compare/v11.7.1...v11.7.2) (2021-11-27)
42
+
43
+ **Note:** Version bump only for package nightingale-console
44
+
45
+
46
+
47
+
48
+
49
+ ## [11.7.1](https://github.com/christophehurpeau/nightingale/compare/v11.7.0...v11.7.1) (2021-06-29)
50
+
51
+
52
+ ### Bug Fixes
53
+
54
+ * update pob-babel to bring back webpack 4 support ([4887431](https://github.com/christophehurpeau/nightingale/commit/4887431b3b272496511f879af022638723b9056e))
55
+
56
+
57
+
58
+
59
+
6
60
  # [11.7.0](https://github.com/christophehurpeau/nightingale/compare/v11.6.0...v11.7.0) (2021-03-29)
7
61
 
8
62
  **Note:** Version bump only for package nightingale-console
package/README.md CHANGED
@@ -20,7 +20,7 @@ npm install --save nightingale nightingale-console
20
20
 
21
21
  ```js
22
22
  import { configure, levels } from 'nightingale';
23
- import ConsoleHandler from 'nightingale-console';
23
+ import { ConsoleHandler } from 'nightingale-console';
24
24
 
25
25
  configure([{ handlers: [new ConsoleHandler(Level.INFO)] }]);
26
26
  ```
@@ -29,7 +29,7 @@ configure([{ handlers: [new ConsoleHandler(Level.INFO)] }]);
29
29
 
30
30
  `DEBUG=* node .`
31
31
 
32
- ```
32
+ ```js
33
33
  DEBUG='*'; # debug everything
34
34
  DEBUG=app # debug for logger with key 'app'
35
35
  DEBUG=app:* # debug for logger with key 'app' and all its children
@@ -39,3 +39,9 @@ DEBUG=/^(app|nightingale$)/ # debug for logger with key starting with 'app' and
39
39
  DEBUG='*,-app'; # debug everything except app
40
40
  DEBUG='*,-app:*'; # debug everything except app and all its children
41
41
  ```
42
+
43
+ ## Use source maps to display error stack trace
44
+
45
+ Since node 12.12.0, you can use `--enable-source-maps` while running node.
46
+
47
+ ![error with source maps](https://static.hurpeau.com/images/npm/nightingale/screenshot-errors-with-source-maps.png)
@@ -4,30 +4,29 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const formatterANSI = require('nightingale-ansi-formatter');
6
6
  const consoleOutput = require('nightingale-console-output');
7
- const createFindDebugLevel = require('nightingale-debug');
7
+ const nightingaleDebug = require('nightingale-debug');
8
8
  const formatterJSON = require('nightingale-json-formatter');
9
- const Level = require('nightingale-levels');
9
+ const nightingaleLevels = require('nightingale-levels');
10
10
 
11
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
11
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
12
12
 
13
13
  const formatterANSI__default = /*#__PURE__*/_interopDefaultLegacy(formatterANSI);
14
14
  const consoleOutput__default = /*#__PURE__*/_interopDefaultLegacy(consoleOutput);
15
- const createFindDebugLevel__default = /*#__PURE__*/_interopDefaultLegacy(createFindDebugLevel);
16
15
  const formatterJSON__default = /*#__PURE__*/_interopDefaultLegacy(formatterJSON);
17
- const Level__default = /*#__PURE__*/_interopDefaultLegacy(Level);
18
16
 
19
17
  const defaultFormatter = !process.stdout.isTTY && process.env.NIGHTINGALE_CONSOLE_FORMATTER !== 'ansi' ? formatterJSON__default : formatterANSI__default;
20
18
 
21
19
  const createHandle = (formatter = defaultFormatter, output = consoleOutput__default) => {
22
20
  return record => {
23
- return output(formatter(record), record);
21
+ output(formatter(record), record);
24
22
  };
25
23
  };
26
24
 
27
- const findDebugLevel = createFindDebugLevel__default(process.env.DEBUG);
25
+ const findDebugLevel = nightingaleDebug.createFindDebugLevel(process.env.DEBUG);
28
26
  class ConsoleHandler {
27
+ minLevel = nightingaleLevels.Level.ALL;
28
+
29
29
  constructor(minLevel, options = {}) {
30
- this.minLevel = Level__default.ALL;
31
30
  this.minLevel = minLevel;
32
31
 
33
32
  this.isHandling = (level, key) => level >= findDebugLevel(minLevel, key);
@@ -38,5 +37,4 @@ class ConsoleHandler {
38
37
  }
39
38
 
40
39
  exports.ConsoleHandler = ConsoleHandler;
41
- exports.default = ConsoleHandler;
42
- //# sourceMappingURL=index-node12.cjs.js.map
40
+ //# sourceMappingURL=index-node14.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-node14.cjs.js","sources":["../src/index.ts"],"sourcesContent":["import formatterANSI from 'nightingale-ansi-formatter';\nimport consoleOutput from 'nightingale-console-output';\nimport { createFindDebugLevel } from 'nightingale-debug';\nimport formatterJSON from 'nightingale-json-formatter';\nimport { Level } from 'nightingale-levels';\nimport type {\n IsHandling,\n Handle,\n LogRecord,\n Metadata,\n Handler,\n} from 'nightingale-types';\n\nconst defaultFormatter =\n __POB_TARGET__ === 'node' &&\n !process.stdout.isTTY &&\n process.env.NIGHTINGALE_CONSOLE_FORMATTER !== 'ansi'\n ? formatterJSON\n : formatterANSI;\n\nconst createHandle = (\n formatter = defaultFormatter,\n output = consoleOutput,\n): Handle => {\n return <T extends Metadata>(record: LogRecord<T>): void => {\n output(formatter(record), record);\n };\n};\nconst findDebugLevel = createFindDebugLevel(process.env.DEBUG);\n\ninterface ConsoleHandlerOptions {\n formatter?: <T extends Metadata>(record: LogRecord<T>) => string;\n output?: <T extends Metadata>(\n param: string | string[],\n record: LogRecord<T>,\n ) => void;\n // compat with nightingale-app-console, not used yet\n theme?: 'dark' | 'light';\n}\n\nexport class ConsoleHandler implements Handler {\n minLevel: Level = Level.ALL;\n\n isHandling: IsHandling;\n\n handle: Handle;\n\n constructor(minLevel: Level, options: ConsoleHandlerOptions = {}) {\n this.minLevel = minLevel;\n this.isHandling = (level: Level, key: string) =>\n level >= findDebugLevel(minLevel, key);\n this.handle = createHandle(options.formatter, options.output);\n }\n}\n"],"names":["defaultFormatter","process","stdout","isTTY","env","NIGHTINGALE_CONSOLE_FORMATTER","formatterJSON","formatterANSI","createHandle","formatter","output","consoleOutput","record","findDebugLevel","createFindDebugLevel","DEBUG","ConsoleHandler","minLevel","Level","ALL","constructor","options","isHandling","level","key","handle"],"mappings":";;;;;;;;;;;;;;;;AAaA,MAAMA,gBAAgB,GAEpB,CAACC,OAAO,CAACC,MAAR,CAAeC,KADhB,IAEAF,OAAO,CAACG,GAAR,CAAYC,6BAAZ,KAA8C,MAF9C,GAGIC,sBAHJ,GAIIC,sBALN;;AAOA,MAAMC,YAAY,GAAG,CACnBC,SAAS,GAAGT,gBADO,EAEnBU,MAAM,GAAGC,sBAFU,KAGR;AACX,SAA4BC,MAArB,IAAoD;AACzDF,IAAAA,MAAM,CAACD,SAAS,CAACG,MAAD,CAAV,EAAoBA,MAApB,CAAN;AACD,GAFD;AAGD,CAPD;;AAQA,MAAMC,cAAc,GAAGC,qCAAoB,CAACb,OAAO,CAACG,GAAR,CAAYW,KAAb,CAA3C;AAYO,MAAMC,cAAN,CAAwC;AAC7CC,EAAAA,QAAQ,GAAUC,uBAAK,CAACC,GAAhB;;AAMRC,EAAAA,WAAW,CAACH,QAAD,EAAkBI,OAA8B,GAAG,EAAnD,EAAuD;AAChE,SAAKJ,QAAL,GAAgBA,QAAhB;;AACA,SAAKK,UAAL,GAAkB,CAACC,KAAD,EAAeC,GAAf,KAChBD,KAAK,IAAIV,cAAc,CAACI,QAAD,EAAWO,GAAX,CADzB;;AAEA,SAAKC,MAAL,GAAcjB,YAAY,CAACa,OAAO,CAACZ,SAAT,EAAoBY,OAAO,CAACX,MAA5B,CAA1B;AACD;;AAZ4C;;;;"}
@@ -1,21 +1,22 @@
1
1
  import formatterANSI from 'nightingale-ansi-formatter';
2
2
  import consoleOutput from 'nightingale-console-output';
3
- import createFindDebugLevel from 'nightingale-debug';
3
+ import { createFindDebugLevel } from 'nightingale-debug';
4
4
  import formatterJSON from 'nightingale-json-formatter';
5
- import Level from 'nightingale-levels';
5
+ import { Level } from 'nightingale-levels';
6
6
 
7
7
  const defaultFormatter = !process.stdout.isTTY && process.env.NIGHTINGALE_CONSOLE_FORMATTER !== 'ansi' ? formatterJSON : formatterANSI;
8
8
 
9
9
  const createHandle = (formatter = defaultFormatter, output = consoleOutput) => {
10
10
  return record => {
11
- return output(formatter(record), record);
11
+ output(formatter(record), record);
12
12
  };
13
13
  };
14
14
 
15
15
  const findDebugLevel = createFindDebugLevel(process.env.DEBUG);
16
16
  class ConsoleHandler {
17
+ minLevel = Level.ALL;
18
+
17
19
  constructor(minLevel, options = {}) {
18
- this.minLevel = Level.ALL;
19
20
  this.minLevel = minLevel;
20
21
 
21
22
  this.isHandling = (level, key) => level >= findDebugLevel(minLevel, key);
@@ -25,6 +26,5 @@ class ConsoleHandler {
25
26
 
26
27
  }
27
28
 
28
- export default ConsoleHandler;
29
29
  export { ConsoleHandler };
30
- //# sourceMappingURL=index-node12.mjs.map
30
+ //# sourceMappingURL=index-node14.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-node14.mjs","sources":["../src/index.ts"],"sourcesContent":["import formatterANSI from 'nightingale-ansi-formatter';\nimport consoleOutput from 'nightingale-console-output';\nimport { createFindDebugLevel } from 'nightingale-debug';\nimport formatterJSON from 'nightingale-json-formatter';\nimport { Level } from 'nightingale-levels';\nimport type {\n IsHandling,\n Handle,\n LogRecord,\n Metadata,\n Handler,\n} from 'nightingale-types';\n\nconst defaultFormatter =\n __POB_TARGET__ === 'node' &&\n !process.stdout.isTTY &&\n process.env.NIGHTINGALE_CONSOLE_FORMATTER !== 'ansi'\n ? formatterJSON\n : formatterANSI;\n\nconst createHandle = (\n formatter = defaultFormatter,\n output = consoleOutput,\n): Handle => {\n return <T extends Metadata>(record: LogRecord<T>): void => {\n output(formatter(record), record);\n };\n};\nconst findDebugLevel = createFindDebugLevel(process.env.DEBUG);\n\ninterface ConsoleHandlerOptions {\n formatter?: <T extends Metadata>(record: LogRecord<T>) => string;\n output?: <T extends Metadata>(\n param: string | string[],\n record: LogRecord<T>,\n ) => void;\n // compat with nightingale-app-console, not used yet\n theme?: 'dark' | 'light';\n}\n\nexport class ConsoleHandler implements Handler {\n minLevel: Level = Level.ALL;\n\n isHandling: IsHandling;\n\n handle: Handle;\n\n constructor(minLevel: Level, options: ConsoleHandlerOptions = {}) {\n this.minLevel = minLevel;\n this.isHandling = (level: Level, key: string) =>\n level >= findDebugLevel(minLevel, key);\n this.handle = createHandle(options.formatter, options.output);\n }\n}\n"],"names":["defaultFormatter","process","stdout","isTTY","env","NIGHTINGALE_CONSOLE_FORMATTER","formatterJSON","formatterANSI","createHandle","formatter","output","consoleOutput","record","findDebugLevel","createFindDebugLevel","DEBUG","ConsoleHandler","minLevel","Level","ALL","constructor","options","isHandling","level","key","handle"],"mappings":";;;;;;AAaA,MAAMA,gBAAgB,GAEpB,CAACC,OAAO,CAACC,MAAR,CAAeC,KADhB,IAEAF,OAAO,CAACG,GAAR,CAAYC,6BAAZ,KAA8C,MAF9C,GAGIC,aAHJ,GAIIC,aALN;;AAOA,MAAMC,YAAY,GAAG,CACnBC,SAAS,GAAGT,gBADO,EAEnBU,MAAM,GAAGC,aAFU,KAGR;AACX,SAA4BC,MAArB,IAAoD;AACzDF,IAAAA,MAAM,CAACD,SAAS,CAACG,MAAD,CAAV,EAAoBA,MAApB,CAAN;AACD,GAFD;AAGD,CAPD;;AAQA,MAAMC,cAAc,GAAGC,oBAAoB,CAACb,OAAO,CAACG,GAAR,CAAYW,KAAb,CAA3C;AAYO,MAAMC,cAAN,CAAwC;AAC7CC,EAAAA,QAAQ,GAAUC,KAAK,CAACC,GAAhB;;AAMRC,EAAAA,WAAW,CAACH,QAAD,EAAkBI,OAA8B,GAAG,EAAnD,EAAuD;AAChE,SAAKJ,QAAL,GAAgBA,QAAhB;;AACA,SAAKK,UAAL,GAAkB,CAACC,KAAD,EAAeC,GAAf,KAChBD,KAAK,IAAIV,cAAc,CAACI,QAAD,EAAWO,GAAX,CADzB;;AAEA,SAAKC,MAAL,GAAcjB,YAAY,CAACa,OAAO,CAACZ,SAAT,EAAoBY,OAAO,CAACX,MAA5B,CAA1B;AACD;;AAZ4C;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import Level from 'nightingale-levels';
1
+ import { Level } from 'nightingale-levels';
2
2
  import type { IsHandling, Handle, LogRecord, Metadata, Handler } from 'nightingale-types';
3
3
  interface ConsoleHandlerOptions {
4
4
  formatter?: <T extends Metadata>(record: LogRecord<T>) => string;
@@ -11,6 +11,5 @@ export declare class ConsoleHandler implements Handler {
11
11
  handle: Handle;
12
12
  constructor(minLevel: Level, options?: ConsoleHandlerOptions);
13
13
  }
14
- /** @deprecated use named export instead */
15
- export default ConsoleHandler;
14
+ export {};
16
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,oBAAoB,CAAC;AACvC,OAAO,KAAK,EACV,UAAU,EACV,MAAM,EACN,SAAS,EACT,QAAQ,EACR,OAAO,EACR,MAAM,mBAAmB,CAAC;AAmB3B,UAAU,qBAAqB;IAC7B,SAAS,CAAC,EAAE,CAAC,CAAC,SAAS,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC;IACjE,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,QAAQ,EAC1B,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EACxB,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,KACjB,IAAI,CAAC;IAEV,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED,qBAAa,cAAe,YAAW,OAAO;IAC5C,QAAQ,EAAE,KAAK,CAAa;IAE5B,UAAU,EAAE,UAAU,CAAC;IAEvB,MAAM,EAAE,MAAM,CAAC;gBAEH,QAAQ,EAAE,KAAK,EAAE,OAAO,GAAE,qBAA0B;CAMjE;AAED,2CAA2C;AAC3C,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,EACV,UAAU,EACV,MAAM,EACN,SAAS,EACT,QAAQ,EACR,OAAO,EACR,MAAM,mBAAmB,CAAC;AAmB3B,UAAU,qBAAqB;IAC7B,SAAS,CAAC,EAAE,CAAC,CAAC,SAAS,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC;IACjE,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,QAAQ,EAC1B,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EACxB,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,KACjB,IAAI,CAAC;IAEV,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED,qBAAa,cAAe,YAAW,OAAO;IAC5C,QAAQ,EAAE,KAAK,CAAa;IAE5B,UAAU,EAAE,UAAU,CAAC;IAEvB,MAAM,EAAE,MAAM,CAAC;gBAEH,QAAQ,EAAE,KAAK,EAAE,OAAO,GAAE,qBAA0B;CAMjE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nightingale-console",
3
- "version": "11.7.0",
3
+ "version": "12.0.0",
4
4
  "description": "Console handler for nightingale",
5
5
  "keywords": [
6
6
  "nightingale",
@@ -14,32 +14,29 @@
14
14
  "directory": "packages/nightingale-console"
15
15
  },
16
16
  "homepage": "https://github.com/christophehurpeau/nightingale",
17
+ "type": "commonjs",
17
18
  "engines": {
18
- "node": ">=12.10.0"
19
+ "node": "^14.13.1 || >=16.0.0"
19
20
  },
20
- "main": "./index.js",
21
+ "main": "./dist/index-node14.cjs.js",
21
22
  "types": "./dist/index.d.ts",
22
23
  "exports": {
24
+ "./package.json": "./package.json",
23
25
  ".": {
24
26
  "node": {
25
- "development": {
26
- "import": "./dist/index-node12-dev.mjs",
27
- "require": "./dist/index-node12-dev.cjs.js"
28
- },
29
- "import": "./dist/index-node12.mjs",
30
- "require": "./dist/index-node12.cjs.js"
27
+ "import": "./dist/index-node14.mjs",
28
+ "require": "./dist/index-node14.cjs.js"
31
29
  }
32
30
  }
33
31
  },
34
- "module:node": "./dist/index-node12.mjs",
35
- "module:node-dev": "./dist/index-node12-dev.mjs",
32
+ "module:node": "./dist/index-node14.mjs",
36
33
  "sideEffects": false,
37
34
  "scripts": {
38
35
  "build": "pob-build && yarn run build:definitions",
39
36
  "build:definitions": "tsc -p tsconfig.build.json",
40
- "clean": "rm -Rf docs dist test/node6 coverage",
37
+ "clean": "rm -Rf dist",
41
38
  "lint": "yarn run lint:eslint",
42
- "lint:eslint": "yarn --cwd ../.. run eslint --ext .js,.mjs,.ts --report-unused-disable-directives --quiet packages/nightingale-console",
39
+ "lint:eslint": "cd ../.. && yarn run eslint --report-unused-disable-directives --resolve-plugins-relative-to . --quiet packages/nightingale-console",
43
40
  "watch": "pob-watch"
44
41
  },
45
42
  "prettier": {
@@ -51,7 +48,7 @@
51
48
  "babelEnvs": [
52
49
  {
53
50
  "target": "node",
54
- "version": "12",
51
+ "version": "14",
55
52
  "formats": [
56
53
  "cjs",
57
54
  "es"
@@ -63,31 +60,18 @@
63
60
  ]
64
61
  },
65
62
  "dependencies": {
66
- "@types/node": ">=12.0.0",
67
- "nightingale-ansi-formatter": "^11.7.0",
68
- "nightingale-console-output": "^11.7.0",
69
- "nightingale-debug": "^11.7.0",
70
- "nightingale-json-formatter": "^11.7.0",
71
- "nightingale-levels": "^11.7.0",
72
- "nightingale-types": "^11.7.0"
63
+ "@types/node": ">=14.0.0",
64
+ "nightingale-ansi-formatter": "^12.0.0",
65
+ "nightingale-console-output": "^12.0.0",
66
+ "nightingale-debug": "^12.0.0",
67
+ "nightingale-json-formatter": "^12.0.0",
68
+ "nightingale-levels": "^12.0.0",
69
+ "nightingale-types": "^12.0.0"
73
70
  },
74
71
  "devDependencies": {
75
- "@babel/core": "7.13.10",
76
- "@pob/eslint-config": "43.0.0",
77
- "@pob/eslint-config-node": "43.1.0",
78
- "@pob/eslint-config-typescript": "43.0.0",
79
- "@pob/eslint-config-typescript-node": "43.0.0",
80
- "@typescript-eslint/eslint-plugin": "4.19.0",
81
- "@typescript-eslint/parser": "4.19.0",
82
- "babel-preset-latest-node": "5.5.1",
83
- "eslint": "7.23.0",
84
- "eslint-import-resolver-node": "0.3.4",
85
- "eslint-plugin-import": "2.22.1",
86
- "eslint-plugin-node": "11.1.0",
87
- "eslint-plugin-unicorn": "25.0.1",
88
- "pob-babel": "26.8.0",
89
- "rollup": "2.43.1",
90
- "typescript": "4.2.3"
72
+ "@babel/core": "7.16.0",
73
+ "pob-babel": "29.3.0",
74
+ "typescript": "4.5.3"
91
75
  },
92
- "gitHead": "cc85b26dbfce264e968f288517a1af98d6f5156d"
76
+ "gitHead": "682f57fa30eaca9732681d16008abb2680b24174"
93
77
  }
@@ -0,0 +1,3 @@
1
+ import createRollupConfig from 'pob-babel/createRollupConfig.js';
2
+
3
+ export default createRollupConfig({});
@@ -7,7 +7,24 @@
7
7
  "plugins": ["@typescript-eslint"],
8
8
  "extends": [
9
9
  "@pob/eslint-config-typescript",
10
- "@pob/eslint-config-typescript-node"
10
+ "@pob/eslint-config-typescript/node"
11
11
  ],
12
- "ignorePatterns": ["*.d.ts"]
12
+ "ignorePatterns": ["*.d.ts"],
13
+ "overrides": [
14
+ {
15
+ "files": ["**/*.test.ts", "__tests__/**/*.ts"],
16
+ "extends": ["@pob/eslint-config-typescript/test"],
17
+ "env": {
18
+ "jest": true
19
+ },
20
+ "rules": {
21
+ "import/no-extraneous-dependencies": [
22
+ "error",
23
+ {
24
+ "devDependencies": true
25
+ }
26
+ ]
27
+ }
28
+ }
29
+ ]
13
30
  }
package/src/index.ts CHANGED
@@ -1,9 +1,8 @@
1
- import { POB_TARGET } from 'pob-babel';
2
1
  import formatterANSI from 'nightingale-ansi-formatter';
3
2
  import consoleOutput from 'nightingale-console-output';
4
- import createFindDebugLevel from 'nightingale-debug';
3
+ import { createFindDebugLevel } from 'nightingale-debug';
5
4
  import formatterJSON from 'nightingale-json-formatter';
6
- import Level from 'nightingale-levels';
5
+ import { Level } from 'nightingale-levels';
7
6
  import type {
8
7
  IsHandling,
9
8
  Handle,
@@ -13,7 +12,7 @@ import type {
13
12
  } from 'nightingale-types';
14
13
 
15
14
  const defaultFormatter =
16
- POB_TARGET === 'node' &&
15
+ __POB_TARGET__ === 'node' &&
17
16
  !process.stdout.isTTY &&
18
17
  process.env.NIGHTINGALE_CONSOLE_FORMATTER !== 'ansi'
19
18
  ? formatterJSON
@@ -24,7 +23,7 @@ const createHandle = (
24
23
  output = consoleOutput,
25
24
  ): Handle => {
26
25
  return <T extends Metadata>(record: LogRecord<T>): void => {
27
- return output(formatter(record), record);
26
+ output(formatter(record), record);
28
27
  };
29
28
  };
30
29
  const findDebugLevel = createFindDebugLevel(process.env.DEBUG);
@@ -53,6 +52,3 @@ export class ConsoleHandler implements Handler {
53
52
  this.handle = createHandle(options.formatter, options.output);
54
53
  }
55
54
  }
56
-
57
- /** @deprecated use named export instead */
58
- export default ConsoleHandler;
@@ -0,0 +1 @@
1
+ /// <reference types="pob-babel" />
@@ -1,42 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const formatterANSI = require('nightingale-ansi-formatter');
6
- const consoleOutput = require('nightingale-console-output');
7
- const createFindDebugLevel = require('nightingale-debug');
8
- const formatterJSON = require('nightingale-json-formatter');
9
- const Level = require('nightingale-levels');
10
-
11
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
12
-
13
- const formatterANSI__default = /*#__PURE__*/_interopDefaultLegacy(formatterANSI);
14
- const consoleOutput__default = /*#__PURE__*/_interopDefaultLegacy(consoleOutput);
15
- const createFindDebugLevel__default = /*#__PURE__*/_interopDefaultLegacy(createFindDebugLevel);
16
- const formatterJSON__default = /*#__PURE__*/_interopDefaultLegacy(formatterJSON);
17
- const Level__default = /*#__PURE__*/_interopDefaultLegacy(Level);
18
-
19
- const defaultFormatter = !process.stdout.isTTY && process.env.NIGHTINGALE_CONSOLE_FORMATTER !== 'ansi' ? formatterJSON__default : formatterANSI__default;
20
-
21
- const createHandle = (formatter = defaultFormatter, output = consoleOutput__default) => {
22
- return record => {
23
- return output(formatter(record), record);
24
- };
25
- };
26
-
27
- const findDebugLevel = createFindDebugLevel__default(process.env.DEBUG);
28
- class ConsoleHandler {
29
- constructor(minLevel, options = {}) {
30
- this.minLevel = Level__default.ALL;
31
- this.minLevel = minLevel;
32
-
33
- this.isHandling = (level, key) => level >= findDebugLevel(minLevel, key);
34
-
35
- this.handle = createHandle(options.formatter, options.output);
36
- }
37
-
38
- }
39
-
40
- exports.ConsoleHandler = ConsoleHandler;
41
- exports.default = ConsoleHandler;
42
- //# sourceMappingURL=index-node12-dev.cjs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-node12-dev.cjs.js","sources":["../src/index.ts"],"sourcesContent":["import { POB_TARGET } from 'pob-babel';\nimport formatterANSI from 'nightingale-ansi-formatter';\nimport consoleOutput from 'nightingale-console-output';\nimport createFindDebugLevel from 'nightingale-debug';\nimport formatterJSON from 'nightingale-json-formatter';\nimport Level from 'nightingale-levels';\nimport type {\n IsHandling,\n Handle,\n LogRecord,\n Metadata,\n Handler,\n} from 'nightingale-types';\n\nconst defaultFormatter =\n POB_TARGET === 'node' &&\n !process.stdout.isTTY &&\n process.env.NIGHTINGALE_CONSOLE_FORMATTER !== 'ansi'\n ? formatterJSON\n : formatterANSI;\n\nconst createHandle = (\n formatter = defaultFormatter,\n output = consoleOutput,\n): Handle => {\n return <T extends Metadata>(record: LogRecord<T>): void => {\n return output(formatter(record), record);\n };\n};\nconst findDebugLevel = createFindDebugLevel(process.env.DEBUG);\n\ninterface ConsoleHandlerOptions {\n formatter?: <T extends Metadata>(record: LogRecord<T>) => string;\n output?: <T extends Metadata>(\n param: string | string[],\n record: LogRecord<T>,\n ) => void;\n // compat with nightingale-app-console, not used yet\n theme?: 'dark' | 'light';\n}\n\nexport class ConsoleHandler implements Handler {\n minLevel: Level = Level.ALL;\n\n isHandling: IsHandling;\n\n handle: Handle;\n\n constructor(minLevel: Level, options: ConsoleHandlerOptions = {}) {\n this.minLevel = minLevel;\n this.isHandling = (level: Level, key: string) =>\n level >= findDebugLevel(minLevel, key);\n this.handle = createHandle(options.formatter, options.output);\n }\n}\n\n/** @deprecated use named export instead */\nexport default ConsoleHandler;\n"],"names":["defaultFormatter","process","stdout","isTTY","env","NIGHTINGALE_CONSOLE_FORMATTER","formatterJSON","formatterANSI","createHandle","formatter","output","consoleOutput","record","findDebugLevel","createFindDebugLevel","DEBUG","ConsoleHandler","constructor","minLevel","options","Level","ALL","isHandling","level","key","handle"],"mappings":";;;;;;;;;;;;;;;;;;AAcA,MAAMA,gBAAgB,GAEpB,CAACC,OAAO,CAACC,MAAR,CAAeC,KADhB,IAEAF,OAAO,CAACG,GAAR,CAAYC,6BAAZ,KAA8C,MAF9C,GAGIC,sBAHJ,GAIIC,sBALN;;AAOA,MAAMC,YAAY,GAAG,CACnBC,SAAS,GAAGT,gBADO,EAEnBU,MAAM,GAAGC,sBAFU,KAGR;AACX,SAA4BC,MAArB,IAAoD;AACzD,WAAOF,MAAM,CAACD,SAAS,CAACG,MAAD,CAAV,EAAoBA,MAApB,CAAb;AACD,GAFD;AAGD,CAPD;;AAQA,MAAMC,cAAc,GAAGC,6BAAoB,CAACb,OAAO,CAACG,GAAR,CAAYW,KAAb,CAA3C;AAYO,MAAMC,cAAN,CAAwC;AAO7CC,EAAAA,WAAW,CAACC,QAAD,EAAkBC,OAA8B,GAAG,EAAnD,EAAuD;AAAA,SANlED,QAMkE,GANhDE,cAAK,CAACC,GAM0C;AAChE,SAAKH,QAAL,GAAgBA,QAAhB;;AACA,SAAKI,UAAL,GAAkB,CAACC,KAAD,EAAeC,GAAf,KAChBD,KAAK,IAAIV,cAAc,CAACK,QAAD,EAAWM,GAAX,CADzB;;AAEA,SAAKC,MAAL,GAAcjB,YAAY,CAACW,OAAO,CAACV,SAAT,EAAoBU,OAAO,CAACT,MAA5B,CAA1B;AACD;;AAZ4C;;;;;"}
@@ -1,30 +0,0 @@
1
- import formatterANSI from 'nightingale-ansi-formatter';
2
- import consoleOutput from 'nightingale-console-output';
3
- import createFindDebugLevel from 'nightingale-debug';
4
- import formatterJSON from 'nightingale-json-formatter';
5
- import Level from 'nightingale-levels';
6
-
7
- const defaultFormatter = !process.stdout.isTTY && process.env.NIGHTINGALE_CONSOLE_FORMATTER !== 'ansi' ? formatterJSON : formatterANSI;
8
-
9
- const createHandle = (formatter = defaultFormatter, output = consoleOutput) => {
10
- return record => {
11
- return output(formatter(record), record);
12
- };
13
- };
14
-
15
- const findDebugLevel = createFindDebugLevel(process.env.DEBUG);
16
- class ConsoleHandler {
17
- constructor(minLevel, options = {}) {
18
- this.minLevel = Level.ALL;
19
- this.minLevel = minLevel;
20
-
21
- this.isHandling = (level, key) => level >= findDebugLevel(minLevel, key);
22
-
23
- this.handle = createHandle(options.formatter, options.output);
24
- }
25
-
26
- }
27
-
28
- export default ConsoleHandler;
29
- export { ConsoleHandler };
30
- //# sourceMappingURL=index-node12-dev.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-node12-dev.mjs","sources":["../src/index.ts"],"sourcesContent":["import { POB_TARGET } from 'pob-babel';\nimport formatterANSI from 'nightingale-ansi-formatter';\nimport consoleOutput from 'nightingale-console-output';\nimport createFindDebugLevel from 'nightingale-debug';\nimport formatterJSON from 'nightingale-json-formatter';\nimport Level from 'nightingale-levels';\nimport type {\n IsHandling,\n Handle,\n LogRecord,\n Metadata,\n Handler,\n} from 'nightingale-types';\n\nconst defaultFormatter =\n POB_TARGET === 'node' &&\n !process.stdout.isTTY &&\n process.env.NIGHTINGALE_CONSOLE_FORMATTER !== 'ansi'\n ? formatterJSON\n : formatterANSI;\n\nconst createHandle = (\n formatter = defaultFormatter,\n output = consoleOutput,\n): Handle => {\n return <T extends Metadata>(record: LogRecord<T>): void => {\n return output(formatter(record), record);\n };\n};\nconst findDebugLevel = createFindDebugLevel(process.env.DEBUG);\n\ninterface ConsoleHandlerOptions {\n formatter?: <T extends Metadata>(record: LogRecord<T>) => string;\n output?: <T extends Metadata>(\n param: string | string[],\n record: LogRecord<T>,\n ) => void;\n // compat with nightingale-app-console, not used yet\n theme?: 'dark' | 'light';\n}\n\nexport class ConsoleHandler implements Handler {\n minLevel: Level = Level.ALL;\n\n isHandling: IsHandling;\n\n handle: Handle;\n\n constructor(minLevel: Level, options: ConsoleHandlerOptions = {}) {\n this.minLevel = minLevel;\n this.isHandling = (level: Level, key: string) =>\n level >= findDebugLevel(minLevel, key);\n this.handle = createHandle(options.formatter, options.output);\n }\n}\n\n/** @deprecated use named export instead */\nexport default ConsoleHandler;\n"],"names":["defaultFormatter","process","stdout","isTTY","env","NIGHTINGALE_CONSOLE_FORMATTER","formatterJSON","formatterANSI","createHandle","formatter","output","consoleOutput","record","findDebugLevel","createFindDebugLevel","DEBUG","ConsoleHandler","constructor","minLevel","options","Level","ALL","isHandling","level","key","handle"],"mappings":";;;;;;AAcA,MAAMA,gBAAgB,GAEpB,CAACC,OAAO,CAACC,MAAR,CAAeC,KADhB,IAEAF,OAAO,CAACG,GAAR,CAAYC,6BAAZ,KAA8C,MAF9C,GAGIC,aAHJ,GAIIC,aALN;;AAOA,MAAMC,YAAY,GAAG,CACnBC,SAAS,GAAGT,gBADO,EAEnBU,MAAM,GAAGC,aAFU,KAGR;AACX,SAA4BC,MAArB,IAAoD;AACzD,WAAOF,MAAM,CAACD,SAAS,CAACG,MAAD,CAAV,EAAoBA,MAApB,CAAb;AACD,GAFD;AAGD,CAPD;;AAQA,MAAMC,cAAc,GAAGC,oBAAoB,CAACb,OAAO,CAACG,GAAR,CAAYW,KAAb,CAA3C;AAYO,MAAMC,cAAN,CAAwC;AAO7CC,EAAAA,WAAW,CAACC,QAAD,EAAkBC,OAA8B,GAAG,EAAnD,EAAuD;AAAA,SANlED,QAMkE,GANhDE,KAAK,CAACC,GAM0C;AAChE,SAAKH,QAAL,GAAgBA,QAAhB;;AACA,SAAKI,UAAL,GAAkB,CAACC,KAAD,EAAeC,GAAf,KAChBD,KAAK,IAAIV,cAAc,CAACK,QAAD,EAAWM,GAAX,CADzB;;AAEA,SAAKC,MAAL,GAAcjB,YAAY,CAACW,OAAO,CAACV,SAAT,EAAoBU,OAAO,CAACT,MAA5B,CAA1B;AACD;;AAZ4C;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-node12.cjs.js","sources":["../src/index.ts"],"sourcesContent":["import { POB_TARGET } from 'pob-babel';\nimport formatterANSI from 'nightingale-ansi-formatter';\nimport consoleOutput from 'nightingale-console-output';\nimport createFindDebugLevel from 'nightingale-debug';\nimport formatterJSON from 'nightingale-json-formatter';\nimport Level from 'nightingale-levels';\nimport type {\n IsHandling,\n Handle,\n LogRecord,\n Metadata,\n Handler,\n} from 'nightingale-types';\n\nconst defaultFormatter =\n POB_TARGET === 'node' &&\n !process.stdout.isTTY &&\n process.env.NIGHTINGALE_CONSOLE_FORMATTER !== 'ansi'\n ? formatterJSON\n : formatterANSI;\n\nconst createHandle = (\n formatter = defaultFormatter,\n output = consoleOutput,\n): Handle => {\n return <T extends Metadata>(record: LogRecord<T>): void => {\n return output(formatter(record), record);\n };\n};\nconst findDebugLevel = createFindDebugLevel(process.env.DEBUG);\n\ninterface ConsoleHandlerOptions {\n formatter?: <T extends Metadata>(record: LogRecord<T>) => string;\n output?: <T extends Metadata>(\n param: string | string[],\n record: LogRecord<T>,\n ) => void;\n // compat with nightingale-app-console, not used yet\n theme?: 'dark' | 'light';\n}\n\nexport class ConsoleHandler implements Handler {\n minLevel: Level = Level.ALL;\n\n isHandling: IsHandling;\n\n handle: Handle;\n\n constructor(minLevel: Level, options: ConsoleHandlerOptions = {}) {\n this.minLevel = minLevel;\n this.isHandling = (level: Level, key: string) =>\n level >= findDebugLevel(minLevel, key);\n this.handle = createHandle(options.formatter, options.output);\n }\n}\n\n/** @deprecated use named export instead */\nexport default ConsoleHandler;\n"],"names":["defaultFormatter","process","stdout","isTTY","env","NIGHTINGALE_CONSOLE_FORMATTER","formatterJSON","formatterANSI","createHandle","formatter","output","consoleOutput","record","findDebugLevel","createFindDebugLevel","DEBUG","ConsoleHandler","constructor","minLevel","options","Level","ALL","isHandling","level","key","handle"],"mappings":";;;;;;;;;;;;;;;;;;AAcA,MAAMA,gBAAgB,GAEpB,CAACC,OAAO,CAACC,MAAR,CAAeC,KADhB,IAEAF,OAAO,CAACG,GAAR,CAAYC,6BAAZ,KAA8C,MAF9C,GAGIC,sBAHJ,GAIIC,sBALN;;AAOA,MAAMC,YAAY,GAAG,CACnBC,SAAS,GAAGT,gBADO,EAEnBU,MAAM,GAAGC,sBAFU,KAGR;AACX,SAA4BC,MAArB,IAAoD;AACzD,WAAOF,MAAM,CAACD,SAAS,CAACG,MAAD,CAAV,EAAoBA,MAApB,CAAb;AACD,GAFD;AAGD,CAPD;;AAQA,MAAMC,cAAc,GAAGC,6BAAoB,CAACb,OAAO,CAACG,GAAR,CAAYW,KAAb,CAA3C;AAYO,MAAMC,cAAN,CAAwC;AAO7CC,EAAAA,WAAW,CAACC,QAAD,EAAkBC,OAA8B,GAAG,EAAnD,EAAuD;AAAA,SANlED,QAMkE,GANhDE,cAAK,CAACC,GAM0C;AAChE,SAAKH,QAAL,GAAgBA,QAAhB;;AACA,SAAKI,UAAL,GAAkB,CAACC,KAAD,EAAeC,GAAf,KAChBD,KAAK,IAAIV,cAAc,CAACK,QAAD,EAAWM,GAAX,CADzB;;AAEA,SAAKC,MAAL,GAAcjB,YAAY,CAACW,OAAO,CAACV,SAAT,EAAoBU,OAAO,CAACT,MAA5B,CAA1B;AACD;;AAZ4C;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-node12.mjs","sources":["../src/index.ts"],"sourcesContent":["import { POB_TARGET } from 'pob-babel';\nimport formatterANSI from 'nightingale-ansi-formatter';\nimport consoleOutput from 'nightingale-console-output';\nimport createFindDebugLevel from 'nightingale-debug';\nimport formatterJSON from 'nightingale-json-formatter';\nimport Level from 'nightingale-levels';\nimport type {\n IsHandling,\n Handle,\n LogRecord,\n Metadata,\n Handler,\n} from 'nightingale-types';\n\nconst defaultFormatter =\n POB_TARGET === 'node' &&\n !process.stdout.isTTY &&\n process.env.NIGHTINGALE_CONSOLE_FORMATTER !== 'ansi'\n ? formatterJSON\n : formatterANSI;\n\nconst createHandle = (\n formatter = defaultFormatter,\n output = consoleOutput,\n): Handle => {\n return <T extends Metadata>(record: LogRecord<T>): void => {\n return output(formatter(record), record);\n };\n};\nconst findDebugLevel = createFindDebugLevel(process.env.DEBUG);\n\ninterface ConsoleHandlerOptions {\n formatter?: <T extends Metadata>(record: LogRecord<T>) => string;\n output?: <T extends Metadata>(\n param: string | string[],\n record: LogRecord<T>,\n ) => void;\n // compat with nightingale-app-console, not used yet\n theme?: 'dark' | 'light';\n}\n\nexport class ConsoleHandler implements Handler {\n minLevel: Level = Level.ALL;\n\n isHandling: IsHandling;\n\n handle: Handle;\n\n constructor(minLevel: Level, options: ConsoleHandlerOptions = {}) {\n this.minLevel = minLevel;\n this.isHandling = (level: Level, key: string) =>\n level >= findDebugLevel(minLevel, key);\n this.handle = createHandle(options.formatter, options.output);\n }\n}\n\n/** @deprecated use named export instead */\nexport default ConsoleHandler;\n"],"names":["defaultFormatter","process","stdout","isTTY","env","NIGHTINGALE_CONSOLE_FORMATTER","formatterJSON","formatterANSI","createHandle","formatter","output","consoleOutput","record","findDebugLevel","createFindDebugLevel","DEBUG","ConsoleHandler","constructor","minLevel","options","Level","ALL","isHandling","level","key","handle"],"mappings":";;;;;;AAcA,MAAMA,gBAAgB,GAEpB,CAACC,OAAO,CAACC,MAAR,CAAeC,KADhB,IAEAF,OAAO,CAACG,GAAR,CAAYC,6BAAZ,KAA8C,MAF9C,GAGIC,aAHJ,GAIIC,aALN;;AAOA,MAAMC,YAAY,GAAG,CACnBC,SAAS,GAAGT,gBADO,EAEnBU,MAAM,GAAGC,aAFU,KAGR;AACX,SAA4BC,MAArB,IAAoD;AACzD,WAAOF,MAAM,CAACD,SAAS,CAACG,MAAD,CAAV,EAAoBA,MAApB,CAAb;AACD,GAFD;AAGD,CAPD;;AAQA,MAAMC,cAAc,GAAGC,oBAAoB,CAACb,OAAO,CAACG,GAAR,CAAYW,KAAb,CAA3C;AAYO,MAAMC,cAAN,CAAwC;AAO7CC,EAAAA,WAAW,CAACC,QAAD,EAAkBC,OAA8B,GAAG,EAAnD,EAAuD;AAAA,SANlED,QAMkE,GANhDE,KAAK,CAACC,GAM0C;AAChE,SAAKH,QAAL,GAAgBA,QAAhB;;AACA,SAAKI,UAAL,GAAkB,CAACC,KAAD,EAAeC,GAAf,KAChBD,KAAK,IAAIV,cAAc,CAACK,QAAD,EAAWM,GAAX,CADzB;;AAEA,SAAKC,MAAL,GAAcjB,YAAY,CAACW,OAAO,CAACV,SAAT,EAAoBU,OAAO,CAACT,MAA5B,CAA1B;AACD;;AAZ4C;;;;;"}
package/index.js DELETED
@@ -1,6 +0,0 @@
1
- /* eslint-disable import/no-dynamic-require */
2
-
3
- 'use strict';
4
-
5
- const production = process.env.NODE_ENV === 'production';
6
- module.exports = require(`./dist/index-node12${production ? '' : '-dev'}.cjs`);