@nxtedition/lib 16.0.9 → 16.0.11

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/logger.js CHANGED
@@ -1,6 +1,8 @@
1
+ import fs from 'node:fs'
1
2
  import { isMainThread } from 'node:worker_threads'
2
3
  import serializers from './serializers.js'
3
4
  import pino from 'pino'
5
+ import xuid from 'xuid'
4
6
 
5
7
  const isProduction = process.env.NODE_ENV === 'production'
6
8
 
@@ -59,6 +61,12 @@ export function createLogger(
59
61
  }
60
62
  called = true
61
63
 
64
+ try {
65
+ fs.writeFileSync(`/tmp/${new Date()}-${xuid()}`, JSON.stringify(err, undefined, 2), 'utf8')
66
+ } catch {
67
+ // Do nothing...
68
+ }
69
+
62
70
  if (err) {
63
71
  if (!(err instanceof Error)) {
64
72
  err = new Error(err)
@@ -66,10 +74,9 @@ export function createLogger(
66
74
  logger.fatal({ err }, evt || 'error caused exit')
67
75
 
68
76
  logger.flush()
69
-
70
- process.exit(1)
71
77
  } else {
72
78
  logger.info(`${evt} caught`)
79
+
73
80
  let exitSignal
74
81
  try {
75
82
  exitSignal = onTerminate ? await onTerminate(logger) : null
@@ -78,10 +85,9 @@ export function createLogger(
78
85
  logger.warn({ err })
79
86
  }
80
87
 
81
- logger.flush()
82
-
83
88
  logger.info({ exitSignal }, 'exit')
84
- process.exit(!exitSignal ? 0 : exitSignal)
89
+
90
+ logger.flush()
85
91
  }
86
92
  }
87
93
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "16.0.9",
3
+ "version": "16.0.11",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",
@@ -75,7 +75,7 @@
75
75
  "dependencies": {
76
76
  "@elastic/elasticsearch": "^8.10.0",
77
77
  "@elastic/transport": "^8.3.4",
78
- "@nxtedition/nxt-undici": "^2.0.7",
78
+ "@nxtedition/nxt-undici": "^2.0.17",
79
79
  "date-fns": "^2.29.3",
80
80
  "fast-querystring": "^1.1.1",
81
81
  "hasha": "^6.0.0",
@@ -83,7 +83,7 @@
83
83
  "json5": "^2.2.3",
84
84
  "koa-compose": "^4.1.0",
85
85
  "lodash": "^4.17.21",
86
- "mime": "^3.0.0",
86
+ "mime": "^4.0.0",
87
87
  "moment-timezone": "^0.5.43",
88
88
  "nconf": "^0.12.1",
89
89
  "nested-error-stacks": "^2.1.1",
@@ -95,22 +95,22 @@
95
95
  "split-string": "^6.0.0",
96
96
  "split2": "^4.2.0",
97
97
  "toobusy-js": "^0.5.1",
98
- "undici": "^5.27.2",
98
+ "undici": "^5.28.2",
99
99
  "url-join": "^5.0.0"
100
100
  },
101
101
  "devDependencies": {
102
102
  "@nxtedition/deepstream.io-client-js": ">=24.1.0",
103
103
  "@types/lodash": "^4.14.202",
104
- "@types/node": "^20.9.4",
105
- "eslint": "^8.53.0",
106
- "eslint-config-prettier": "^9.0.0",
104
+ "@types/node": "^20.10.3",
105
+ "eslint": "^8.55.0",
106
+ "eslint-config-prettier": "^9.1.0",
107
107
  "eslint-config-standard": "^17.0.0",
108
108
  "eslint-plugin-import": "^2.29.0",
109
109
  "eslint-plugin-n": "^16.3.1",
110
110
  "eslint-plugin-node": "^11.1.0",
111
111
  "eslint-plugin-promise": "^6.0.0",
112
112
  "husky": "^8.0.3",
113
- "lint-staged": "^15.1.0",
113
+ "lint-staged": "^15.2.0",
114
114
  "pinst": "^3.0.0",
115
115
  "prettier": "^3.1.0",
116
116
  "rxjs": "^7.5.6",
@@ -7,6 +7,10 @@ import datefns from 'date-fns'
7
7
  import JSON5 from 'json5'
8
8
  import { request } from '@nxtedition/nxt-undici'
9
9
  import undici from 'undici'
10
+ import fp from 'lodash/fp.js'
11
+ import _ from 'lodash'
12
+ import moment from 'moment-timezone'
13
+ import Timecode from 'smpte-timecode'
10
14
 
11
15
  const kSuspend = Symbol('kSuspend')
12
16
  const kEmpty = Symbol('kEmpty')
@@ -178,10 +182,10 @@ function pipe(value, ...fns) {
178
182
  }
179
183
 
180
184
  const globals = {
181
- fp: await import('lodash/fp.js'),
182
- _: await import('lodash'),
183
- moment: await import('moment-timezone'),
184
- Timecode: await import('smpte-timecode'),
185
+ fp,
186
+ _,
187
+ moment,
188
+ Timecode,
185
189
  datefns,
186
190
  JSON5,
187
191
  pipe,