@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.
- package/app.js +3 -0
- package/package.json +1 -1
- 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
package/serializers.js
CHANGED
|
@@ -27,28 +27,40 @@ function getUrl(obj) {
|
|
|
27
27
|
return undefined
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
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
|
|
35
|
-
return
|
|
37
|
+
if (typeof url === 'string' && url) {
|
|
38
|
+
return url
|
|
36
39
|
}
|
|
37
40
|
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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 (
|
|
48
|
-
return `${
|
|
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
|
|
63
|
+
return null
|
|
52
64
|
}
|
|
53
65
|
|
|
54
66
|
function getTiming(obj) {
|