@nxtedition/lib 23.3.7 → 23.3.9

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.
Files changed (3) hide show
  1. package/app.js +3 -0
  2. package/package.json +1 -1
  3. package/serializers.js +25 -13
package/app.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as inspector from 'node:inspector'
2
+ import fs from 'node:fs'
2
3
  import os from 'node:os'
3
4
  import http from 'node:http'
4
5
  import net from 'node:net'
@@ -64,6 +65,8 @@ export function makeApp(appConfig, onTerminate) {
64
65
  const isProduction = process.env.NODE_ENV === 'production'
65
66
  const ac = new AbortController()
66
67
 
68
+ fs.mkdirSync('./.nxt', { recursive: true })
69
+
67
70
  // Crash on unhandledRejection
68
71
  process.on('unhandledRejection', (err) => {
69
72
  throw err
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "23.3.7",
3
+ "version": "23.3.9",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",
package/serializers.js CHANGED
@@ -27,28 +27,40 @@ function getUrl(obj) {
27
27
  return undefined
28
28
  }
29
29
 
30
- if (obj.url?.href) {
31
- return obj.url.href
30
+ const { origin, path, hostname, protocol, port, url } = obj
31
+
32
+ const href = url?.href
33
+ if (typeof href === 'string' && href) {
34
+ return href
32
35
  }
33
36
 
34
- if (typeof obj.url === 'string') {
35
- return obj.url
37
+ if (typeof url === 'string' && url) {
38
+ return url
36
39
  }
37
40
 
38
- if (obj.origin) {
39
- const { origin, path } = obj
40
- if (path && path.startsWith('/') && origin.endsWith('/')) {
41
- return `${origin.slice(0, -1)}${path}`
42
- } else {
43
- return `${origin}${path || ''}`
41
+ if (origin && (!path || typeof path === 'string')) {
42
+ if (typeof origin === 'object') {
43
+ return `${origin.protocol || 'http:'}//${origin.hostname}:${origin.port || { 'http:': 80, 'https:': 443 }[origin.protocol]}${path || ''}`
44
+ }
45
+
46
+ if (typeof origin === 'string') {
47
+ if (path?.startsWith('/') && origin.endsWith('/')) {
48
+ return `${origin.slice(0, -1)}${path || ''}`
49
+ } else {
50
+ return `${origin}${path || ''}`
51
+ }
44
52
  }
45
53
  }
46
54
 
47
- if (obj.hostname) {
48
- return `${obj.protocol || 'http:'}//${obj.hostname}:${obj.port || { 'http:': 80, 'https:': 443 }[obj.protocol]}${obj.path || ''}`
55
+ if (typeof hostname === 'string') {
56
+ return `${protocol || 'http:'}//${hostname}:${port || { 'http:': 80, 'https:': 443 }[protocol || 'http:']}${path || ''}`
57
+ }
58
+
59
+ if (typeof path === 'string' && path) {
60
+ return path
49
61
  }
50
62
 
51
- return obj.path || obj.pathname
63
+ return null
52
64
  }
53
65
 
54
66
  function getTiming(obj) {