@jsenv/server 12.7.1 → 12.7.4
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": "@jsenv/server",
|
|
3
|
-
"version": "12.7.
|
|
3
|
+
"version": "12.7.4",
|
|
4
4
|
"description": "Write your Node.js server using pure functions",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -17,8 +17,7 @@
|
|
|
17
17
|
"node": ">=16.13.0"
|
|
18
18
|
},
|
|
19
19
|
"publishConfig": {
|
|
20
|
-
"access": "public"
|
|
21
|
-
"registry": "https://registry.npmjs.org"
|
|
20
|
+
"access": "public"
|
|
22
21
|
},
|
|
23
22
|
"type": "module",
|
|
24
23
|
"exports": {
|
|
@@ -35,13 +34,13 @@
|
|
|
35
34
|
"test": "node --conditions=development ./scripts/test.mjs"
|
|
36
35
|
},
|
|
37
36
|
"dependencies": {
|
|
38
|
-
"@jsenv/abort": "4.2.
|
|
39
|
-
"@jsenv/
|
|
37
|
+
"@jsenv/abort": "4.2.3",
|
|
38
|
+
"@jsenv/log": "3.0.2",
|
|
40
39
|
"@jsenv/url-meta": "7.0.0",
|
|
41
|
-
"@jsenv/utils": "2.0.
|
|
40
|
+
"@jsenv/utils": "2.0.1"
|
|
42
41
|
},
|
|
43
42
|
"devDependencies": {
|
|
44
43
|
"@jsenv/fetch": "../fetch/",
|
|
45
44
|
"eventsource": "2.0.2"
|
|
46
45
|
}
|
|
47
|
-
}
|
|
46
|
+
}
|
package/src/fetch_filesystem.js
CHANGED
|
@@ -5,13 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { createReadStream, statSync, readFile } from "node:fs"
|
|
8
|
-
import {
|
|
9
|
-
isFileSystemPath,
|
|
10
|
-
fileSystemPathToUrl,
|
|
11
|
-
} from "@jsenv/server/src/internal/filesystem.js"
|
|
12
|
-
import { bufferToEtag } from "@jsenv/server/src/internal/etag.js"
|
|
13
8
|
import { CONTENT_TYPE } from "@jsenv/utils/src/content_type/content_type.js"
|
|
14
9
|
|
|
10
|
+
import { isFileSystemPath, fileSystemPathToUrl } from "./internal/filesystem.js"
|
|
11
|
+
import { bufferToEtag } from "./internal/etag.js"
|
|
15
12
|
import { composeTwoResponses } from "./internal/response_composition.js"
|
|
16
13
|
import { convertFileSystemErrorToResponseProperties } from "./internal/convertFileSystemErrorToResponseProperties.js"
|
|
17
14
|
import { timeFunction } from "./server_timing/timing_measure.js"
|
|
@@ -69,7 +69,7 @@ const createSecureServer = async ({
|
|
|
69
69
|
http1Allowed,
|
|
70
70
|
}) => {
|
|
71
71
|
if (http2) {
|
|
72
|
-
const { createSecureServer } = await import("http2")
|
|
72
|
+
const { createSecureServer } = await import("node:http2")
|
|
73
73
|
return createSecureServer({
|
|
74
74
|
cert: certificate,
|
|
75
75
|
key: privateKey,
|
|
@@ -77,7 +77,7 @@ const createSecureServer = async ({
|
|
|
77
77
|
})
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
const { createServer } = await import("https")
|
|
80
|
+
const { createServer } = await import("node:https")
|
|
81
81
|
return createServer({
|
|
82
82
|
cert: certificate,
|
|
83
83
|
key: privateKey,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { timeFunction } from "
|
|
2
|
-
import { composeTwoResponses } from "
|
|
3
|
-
import { applyRedirectionToRequest } from "
|
|
1
|
+
import { timeFunction } from "../server_timing/timing_measure.js"
|
|
2
|
+
import { composeTwoResponses } from "../internal/response_composition.js"
|
|
3
|
+
import { applyRedirectionToRequest } from "../internal/request_factory.js"
|
|
4
4
|
|
|
5
5
|
export const composeServices = (namedServices) => {
|
|
6
6
|
return async (request, { pushResponse }) => {
|
package/src/startServer.js
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
raceProcessTeardownEvents,
|
|
7
7
|
createCallbackListNotifiedOnce,
|
|
8
8
|
} from "@jsenv/abort"
|
|
9
|
+
import { memoize } from "@jsenv/utils/src/memoize/memoize.js"
|
|
9
10
|
|
|
10
11
|
import { createPolyglotServer } from "./internal/server-polyglot.js"
|
|
11
12
|
import { trackServerPendingConnections } from "./internal/trackServerPendingConnections.js"
|
|
@@ -25,7 +26,6 @@ import { listen, stopListening } from "./internal/listen.js"
|
|
|
25
26
|
import { composeTwoResponses } from "./internal/response_composition.js"
|
|
26
27
|
import { listenRequest } from "./internal/listenRequest.js"
|
|
27
28
|
import { listenServerConnectionError } from "./internal/listenServerConnectionError.js"
|
|
28
|
-
import { memoize } from "./internal/memoize.js"
|
|
29
29
|
import { applyDefaultErrorToResponse } from "./error_to_response_default.js"
|
|
30
30
|
import {
|
|
31
31
|
STOP_REASON_INTERNAL_ERROR,
|
|
@@ -804,7 +804,7 @@ const createNodeServer = async ({
|
|
|
804
804
|
})
|
|
805
805
|
}
|
|
806
806
|
|
|
807
|
-
const { createServer } = await import("https")
|
|
807
|
+
const { createServer } = await import("node:https")
|
|
808
808
|
return createServer({
|
|
809
809
|
cert: certificate,
|
|
810
810
|
key: privateKey,
|
package/src/internal/memoize.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export const memoize = (compute) => {
|
|
2
|
-
let memoized = false
|
|
3
|
-
let memoizedValue
|
|
4
|
-
|
|
5
|
-
const fnWithMemoization = (...args) => {
|
|
6
|
-
if (memoized) {
|
|
7
|
-
return memoizedValue
|
|
8
|
-
}
|
|
9
|
-
// if compute is recursive wait for it to be fully done before storing the value
|
|
10
|
-
// so set memoized boolean after the call
|
|
11
|
-
memoizedValue = compute(...args)
|
|
12
|
-
memoized = true
|
|
13
|
-
return memoizedValue
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
fnWithMemoization.forget = () => {
|
|
17
|
-
const value = memoizedValue
|
|
18
|
-
memoized = false
|
|
19
|
-
memoizedValue = undefined
|
|
20
|
-
return value
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return fnWithMemoization
|
|
24
|
-
}
|