standard-log 10.2.1 → 11.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "standard-log",
3
- "version": "10.2.1",
3
+ "version": "11.0.0",
4
4
  "description": "The standard log library",
5
5
  "homepage": "https://github.com/unional/standard-log/tree/master/packages/log",
6
6
  "bugs": {
@@ -25,7 +25,8 @@
25
25
  "browser": {
26
26
  "./cjs/platform.js": "./cjs/platform.browser.js",
27
27
  "./esm/platform.js": "./esm/platform.browser.js",
28
- "./ts/platform.js": "./ts/platform.browser.js"
28
+ "./tslib/platform.js": "./tslib/platform.browser.js",
29
+ "./ts/platform.ts": "./ts/platform.browser.ts"
29
30
  },
30
31
  "typings": "./cjs/index.d.ts",
31
32
  "files": [
@@ -36,53 +37,42 @@
36
37
  "!ts/**/*.spec.ts",
37
38
  "!ts/testUtil.ts"
38
39
  ],
39
- "scripts": {
40
- "build": "npm-run-all build:clean -p build:cjs build:esm build:tslib bundle:es5 bundle:esm",
41
- "build:clean": "rimraf .tsbuildinfo || true",
42
- "build:cjs": "tsc -p ./tsconfig.cjs.json",
43
- "build:esm": "tsc -p ./tsconfig.esm.json",
44
- "build:tslib": "tsc -p ./tsconfig.tslib.json",
45
- "bundle": "run-p bundle:es5 bundle:esm",
46
- "bundle:es5": "webpack -c ./webpack.es5.cjs",
47
- "bundle:esm": "webpack -c ./webpack.esm.cjs",
48
- "clean": "rimraf cjs coverage dist esm lib libm tslib .tsbuildinfo && mkdir cjs && echo '{\"type\":\"commonjs\"}' > cjs/package.json || true",
49
- "coverage": "jest --coverage",
50
- "depcheck": "depcheck",
51
- "lint": "cross-env TIMING=1 eslint --ext=ts,js,cjs,mjs .",
52
- "size": "size-limit",
53
- "test": "jest",
54
- "verify": "npm-run-all clean -p build depcheck lint coverage -s size",
55
- "watch": "jest --watch"
56
- },
57
40
  "dependencies": {
58
- "@just-func/types": "^0.2.0",
59
- "iso-error": "^4.3.5",
41
+ "@just-func/types": "^0.2.1",
42
+ "iso-error": "^4.4.0",
60
43
  "ms": "^2.1.3",
61
- "type-plus": "^4.11.2",
44
+ "type-plus": "^4.13.1",
62
45
  "upper-case": "^2.0.2"
63
46
  },
64
47
  "devDependencies": {
65
- "@size-limit/preset-small-lib": "^8.0.0",
48
+ "@size-limit/preset-small-lib": "^8.1.0",
49
+ "@types/jest": "^29.1.1",
66
50
  "@types/ms": "^0.7.31",
67
- "@types/ramda": "^0.28.13",
51
+ "@types/node": "^14.18.31",
52
+ "@types/ramda": "^0.28.15",
68
53
  "assertron": "^10.0.0",
69
54
  "compression-webpack-plugin": "^10.0.0",
70
55
  "cross-env": "^7.0.3",
71
56
  "depcheck": "^1.4.3",
72
- "eslint": "^8.17.0",
73
- "jest": "^29.0.0",
57
+ "eslint": "^8.24.0",
58
+ "jest": "^29.1.2",
59
+ "jest-validate": "^29.1.2",
60
+ "jest-watch-suspend": "^1.1.2",
61
+ "jest-watch-toggle-config": "^2.0.1",
62
+ "jest-watch-typeahead": "^2.2.0",
63
+ "ncp": "^2.0.0",
74
64
  "npm-run-all": "^4.1.5",
75
65
  "param-case": "^3.0.4",
76
66
  "pascal-case": "^3.1.2",
77
67
  "ramda": "^0.28.0",
78
68
  "rimraf": "^3.0.2",
79
- "size-limit": "^8.0.0",
80
- "ts-jest": "^28.0.5",
81
- "ts-loader": "^9.3.0",
69
+ "size-limit": "^8.1.0",
70
+ "ts-jest": "^29.0.3",
71
+ "ts-loader": "^9.4.1",
82
72
  "tslib": "^2.4.0",
83
- "typescript": "^4.7.3",
84
- "webpack": "^5.73.0",
85
- "webpack-bundle-analyzer": "^4.5.0",
73
+ "typescript": "^4.8.4",
74
+ "webpack": "^5.74.0",
75
+ "webpack-bundle-analyzer": "^4.6.1",
86
76
  "webpack-cli": "^4.10.0"
87
77
  },
88
78
  "size-limit": [
@@ -98,5 +88,26 @@
98
88
  "path": "./tslib/index.js",
99
89
  "limit": "20 kB"
100
90
  }
101
- ]
102
- }
91
+ ],
92
+ "scripts": {
93
+ "build": "run-p build:cjs build:esm build:tslib bundle:es5 bundle:esm",
94
+ "build:clean": "rimraf *.tsbuildinfo",
95
+ "build:cjs": "tsc -p ./tsconfig.cjs.json && ncp package.cjs.json cjs/package.json",
96
+ "build:esm": "tsc -p ./tsconfig.esm.json",
97
+ "build:tslib": "tsc -p ./tsconfig.tslib.json",
98
+ "bundle": "run-p bundle:es5 bundle:esm",
99
+ "bundle:es5": "webpack -c ./webpack.es5.cjs",
100
+ "bundle:esm": "webpack -c ./webpack.esm.cjs",
101
+ "clean": "rimraf cjs coverage dist esm lib libm tslib *.tsbuildinfo",
102
+ "coverage": "jest --coverage",
103
+ "depcheck": "depcheck",
104
+ "lint": "cross-env TIMING=1 eslint --ext=ts,js,cjs,mjs .",
105
+ "nuke": "run-s clean nuke:local",
106
+ "nuke:local": "rimraf node_modules",
107
+ "size": "size-limit",
108
+ "test": "jest",
109
+ "test:watch": "jest --watch",
110
+ "verify": "npm-run-all -p build depcheck lint coverage -p size",
111
+ "watch": "jest --watch"
112
+ }
113
+ }
package/ts/memory.ts CHANGED
@@ -2,6 +2,7 @@ import { required } from 'type-plus'
2
2
  import { toInspectLogEntry } from './platform.js'
3
3
  import { formatLogLevel } from './formatter.js'
4
4
  import type { LogEntry, LogFormatter, LogReporter, LogReporterOptions } from './types.js'
5
+ import { createConsoleLogReporter } from './console.js'
5
6
 
6
7
  export type MemoryLogReporter = LogReporter<LogEntry> & {
7
8
  logs: LogEntry[],
@@ -11,7 +12,9 @@ export type MemoryLogReporter = LogReporter<LogEntry> & {
11
12
  */
12
13
  getLogMessage(): string,
13
14
  getLogMessages(): string[],
14
- getLogMessageWithLevel(): string
15
+ getLogMessageWithLevel(): string,
16
+ getLogMessagesWithIdAndLevel(): string[],
17
+ emit(): void
15
18
  }
16
19
 
17
20
  export type MemoryLogFormatter = LogFormatter<LogEntry>
@@ -45,6 +48,17 @@ export function createMemoryLogReporter(options?: LogReporterOptions<LogEntry>):
45
48
  return logs.map(toInspectLogEntry)
46
49
  .map(log => log.args.join(' '))
47
50
  },
48
- getLogMessageWithLevel() { return toMessageWithLevel(logs) }
51
+ getLogMessagesWithIdAndLevel() {
52
+ return logs.map(toInspectLogEntry)
53
+ .map(log => `${log.id} ${formatLogLevel(log.level)} ${log.args.join(' ')}`)
54
+ },
55
+ getLogMessageWithLevel() { return toMessageWithLevel(logs) },
56
+ /**
57
+ * emit the saved log to console for easy debugging
58
+ */
59
+ emit() {
60
+ const reporter = createConsoleLogReporter()
61
+ logs.forEach(l => reporter.write(l))
62
+ }
49
63
  })
50
64
  }