@nxtedition/lib 15.0.25 → 15.0.27

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
@@ -42,14 +42,6 @@ module.exports.createLogger = function (
42
42
  stream,
43
43
  )
44
44
 
45
- function flush() {
46
- if (!stream.destroyed) {
47
- stream?.end?.()
48
- stream?.flush?.()
49
- stream?.flushSync?.()
50
- }
51
- }
52
-
53
45
  let called = false
54
46
  const finalHandler = async (err, evt) => {
55
47
  if (called) {
@@ -63,7 +55,7 @@ module.exports.createLogger = function (
63
55
  }
64
56
  logger.fatal({ err }, evt || 'error caused exit')
65
57
 
66
- flush()
58
+ logger.flush()
67
59
 
68
60
  process.exit(1)
69
61
  } else {
@@ -76,7 +68,7 @@ module.exports.createLogger = function (
76
68
  logger.warn({ err })
77
69
  }
78
70
 
79
- flush()
71
+ logger.flush()
80
72
 
81
73
  logger.info({ exitSignal }, 'exit')
82
74
  process.exit(!exitSignal ? 0 : exitSignal)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "15.0.25",
3
+ "version": "15.0.27",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "files": [
@@ -108,7 +108,7 @@ module.exports = ({ ds, proxify }) => {
108
108
  ret[indices[n]] = values[n]
109
109
  }
110
110
  return ret
111
- })
111
+ }),
112
112
  )
113
113
  }
114
114
  : null
@@ -145,7 +145,7 @@ module.exports = ({ ds, proxify }) => {
145
145
  ret[indices[n]] = values[n]
146
146
  }
147
147
  return ret
148
- })
148
+ }),
149
149
  )
150
150
  }
151
151
  : null
@@ -174,7 +174,7 @@ module.exports = ({ ds, proxify }) => {
174
174
  compileStringTemplate(post)?.(str, args$) ?? rxjs.of(post),
175
175
  ])
176
176
  .pipe(
177
- rx.map(([pre, body, post]) => (pre || post ? `${pre}${stringify(body)}${post}` : body))
177
+ rx.map(([pre, body, post]) => (pre || post ? `${pre}${stringify(body)}${post}` : body)),
178
178
  )
179
179
  } else if (type === 'nxt') {
180
180
  const expr = compilers.nxt(body)
@@ -185,7 +185,7 @@ module.exports = ({ ds, proxify }) => {
185
185
 
186
186
  return (str, args$) =>
187
187
  expr(args$).pipe(
188
- rx.switchMap((body) => onResolveTemplate(`${pre}${stringify(body, true)}${post}`, args$))
188
+ rx.switchMap((body) => onResolveTemplate(`${pre}${stringify(body, true)}${post}`, args$)),
189
189
  )
190
190
  } else {
191
191
  throw new Error('unknown expression type: ' + type)
@@ -219,12 +219,13 @@ module.exports = ({ ds, proxify }) => {
219
219
  return null
220
220
  }
221
221
  },
222
- (template, hash) => hash
222
+ (template, hash) => hash,
223
223
  )
224
224
 
225
225
  function compileTemplate(template) {
226
226
  const hash = hashTemplate(template)
227
- return hash ? compileTemplateCache(template, hash) : null
227
+ const resolver = hash ? compileTemplateCache(template, hash) : null
228
+ return resolver ? (args$) => resolver(template, args$) : null
228
229
  }
229
230
 
230
231
  async function resolveTemplate(template, args$, options) {
@@ -233,7 +234,7 @@ module.exports = ({ ds, proxify }) => {
233
234
 
234
235
  function onResolveTemplate(template, args$) {
235
236
  try {
236
- return compileTemplate(template)?.(template, args$) ?? rxjs.of(template)
237
+ return compileTemplate(template)?.(args$) ?? rxjs.of(template)
237
238
  } catch (err) {
238
239
  return rxjs.throwError(() => err)
239
240
  }