@jsenv/server 15.2.13 → 15.2.14

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": "15.2.13",
3
+ "version": "15.2.14",
4
4
  "description": "Write your Node.js server using pure functions",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@jsenv/abort": "4.3.0",
37
- "@jsenv/humanize": "1.2.4",
37
+ "@jsenv/humanize": "1.2.5",
38
38
  "@jsenv/url-meta": "8.4.2",
39
39
  "@jsenv/utils": "2.1.1",
40
40
  "ws": "8.18.0"
@@ -4,19 +4,19 @@
4
4
  * It is meant to be used inside "requestToResponse"
5
5
  */
6
6
 
7
- import { createReadStream, statSync, readFile } from "node:fs";
8
7
  import { CONTENT_TYPE } from "@jsenv/utils/src/content_type/content_type.js";
8
+ import { createReadStream, readFile, statSync } from "node:fs";
9
9
 
10
+ import { pickContentEncoding } from "./content_negotiation/pick_content_encoding.js";
11
+ import { convertFileSystemErrorToResponseProperties } from "./internal/convertFileSystemErrorToResponseProperties.js";
12
+ import { bufferToEtag } from "./internal/etag.js";
10
13
  import {
11
- isFileSystemPath,
12
14
  fileSystemPathToUrl,
15
+ isFileSystemPath,
13
16
  } from "./internal/filesystem.js";
14
- import { bufferToEtag } from "./internal/etag.js";
15
17
  import { composeTwoResponses } from "./internal/response_composition.js";
16
- import { convertFileSystemErrorToResponseProperties } from "./internal/convertFileSystemErrorToResponseProperties.js";
17
- import { timeFunction } from "./server_timing/timing_measure.js";
18
- import { pickContentEncoding } from "./content_negotiation/pick_content_encoding.js";
19
18
  import { serveDirectory } from "./serve_directory.js";
19
+ import { timeFunction } from "./server_timing/timing_measure.js";
20
20
 
21
21
  export const fetchFileSystem = async (
22
22
  filesystemUrl,
@@ -1,5 +1,5 @@
1
- import { Stream, Writable, Readable } from "node:stream";
2
1
  import { createReadStream } from "node:fs";
2
+ import { Readable, Stream, Writable } from "node:stream";
3
3
 
4
4
  import { isObservable, observableFromValue } from "./observable.js";
5
5
  import { observableFromNodeStream } from "./observable_from_node_stream.js";
@@ -1,5 +1,5 @@
1
- import { observableFromNodeStream } from "./observable_from_node_stream.js";
2
1
  import { headersFromObject } from "../internal/headersFromObject.js";
2
+ import { observableFromNodeStream } from "./observable_from_node_stream.js";
3
3
 
4
4
  export const fromNodeRequest = (
5
5
  nodeRequest,
@@ -1,6 +1,6 @@
1
+ import { raceCallbacks } from "@jsenv/abort";
1
2
  import http from "node:http";
2
3
  import { Http2ServerResponse } from "node:http2";
3
- import { raceCallbacks } from "@jsenv/abort";
4
4
 
5
5
  import { normalizeBodyMethods } from "./body.js";
6
6
 
@@ -1,4 +1,4 @@
1
- import { pathToFileURL, fileURLToPath } from "node:url";
1
+ import { fileURLToPath, pathToFileURL } from "node:url";
2
2
 
3
3
  export const isFileSystemPath = (value) => {
4
4
  if (typeof value !== "string") {
@@ -1,5 +1,5 @@
1
- import { createServer } from "node:net";
2
1
  import { Abort } from "@jsenv/abort";
2
+ import { createServer } from "node:net";
3
3
 
4
4
  const listen = async ({
5
5
  signal = new AbortController().signal,
@@ -1,5 +1,5 @@
1
- import { composeTwoObjects } from "./object_composition.js";
2
1
  import { composeTwoHeaders } from "./headers_composition.js";
2
+ import { composeTwoObjects } from "./object_composition.js";
3
3
 
4
4
  export const composeTwoResponses = (firstResponse, secondResponse) => {
5
5
  return composeTwoObjects(firstResponse, secondResponse, {
package/src/main.js CHANGED
@@ -4,6 +4,8 @@
4
4
  * Ideally this file should be kept simple to help discovering codebase progressively.
5
5
  */
6
6
 
7
+ // tslint:disable:ordered-imports
8
+
7
9
  export { startServer } from "./start_server.js";
8
10
  export { setupRoutes } from "./service_composition/routing.js";
9
11
  export { readRequestBody } from "./readRequestBody.js";
@@ -1,4 +1,4 @@
1
- import { readdirSync, lstatSync } from "node:fs";
1
+ import { lstatSync, readdirSync } from "node:fs";
2
2
 
3
3
  import { pickContentType } from "./content_negotiation/pick_content_type.js";
4
4
 
@@ -1,6 +1,6 @@
1
- import { pickContentType } from "@jsenv/server/src/content_negotiation/pick_content_type.js";
2
- import { pickContentLanguage } from "@jsenv/server/src/content_negotiation/pick_content_language.js";
3
1
  import { pickContentEncoding } from "@jsenv/server/src/content_negotiation/pick_content_encoding.js";
2
+ import { pickContentLanguage } from "@jsenv/server/src/content_negotiation/pick_content_language.js";
3
+ import { pickContentType } from "@jsenv/server/src/content_negotiation/pick_content_type.js";
4
4
 
5
5
  export const jsenvServiceResponseAcceptanceCheck = () => {
6
6
  return {
@@ -1,8 +1,8 @@
1
1
  import { createLogger } from "@jsenv/humanize";
2
2
 
3
3
  import {
4
- createObservable,
5
4
  createCompositeProducer,
5
+ createObservable,
6
6
  } from "@jsenv/server/src/interfacing_with_node/observable.js";
7
7
 
8
8
  // https://www.html5rocks.com/en/tutorials/eventsource/basics/
@@ -1,43 +1,43 @@
1
- import { isIP } from "node:net";
2
- import cluster from "node:cluster";
3
- import { createDetailedMessage, createLogger } from "@jsenv/humanize";
4
1
  import { Abort, raceProcessTeardownEvents } from "@jsenv/abort";
2
+ import { createDetailedMessage, createLogger } from "@jsenv/humanize";
5
3
  import { memoize } from "@jsenv/utils/src/memoize/memoize.js";
4
+ import cluster from "node:cluster";
5
+ import { isIP } from "node:net";
6
6
 
7
- import { createServiceController } from "./service_controller.js";
8
- import { timingToServerTimingResponseHeaders } from "./server_timing/timing_header.js";
9
- import { createPolyglotServer } from "./internal/server-polyglot.js";
10
- import { trackServerPendingConnections } from "./internal/trackServerPendingConnections.js";
11
- import { trackServerPendingRequests } from "./internal/trackServerPendingRequests.js";
12
7
  import {
13
- fromNodeRequest,
14
- createPushRequest,
15
8
  applyRedirectionToRequest,
9
+ createPushRequest,
10
+ fromNodeRequest,
16
11
  } from "./interfacing_with_node/request_factory.js";
17
12
  import { writeNodeResponse } from "./interfacing_with_node/write_node_response.js";
18
13
  import {
19
- statusToType,
20
14
  colorizeResponseStatus,
15
+ statusToType,
21
16
  } from "./internal/colorizeResponseStatus.js";
17
+ import { composeTwoHeaders } from "./internal/headers_composition.js";
22
18
  import { listen, stopListening } from "./internal/listen.js";
23
- import { composeTwoResponses } from "./internal/response_composition.js";
24
- import { listenRequest } from "./internal/listenRequest.js";
25
19
  import { listenEvent } from "./internal/listenEvent.js";
20
+ import { listenRequest } from "./internal/listenRequest.js";
26
21
  import { listenServerConnectionError } from "./internal/listenServerConnectionError.js";
22
+ import { composeTwoResponses } from "./internal/response_composition.js";
23
+ import { createPolyglotServer } from "./internal/server-polyglot.js";
24
+ import { trackServerPendingConnections } from "./internal/trackServerPendingConnections.js";
25
+ import { trackServerPendingRequests } from "./internal/trackServerPendingRequests.js";
26
+ import { timingToServerTimingResponseHeaders } from "./server_timing/timing_header.js";
27
+ import { createServiceController } from "./service_controller.js";
27
28
  import {
28
29
  STOP_REASON_INTERNAL_ERROR,
29
- STOP_REASON_PROCESS_SIGHUP,
30
- STOP_REASON_PROCESS_SIGTERM,
31
- STOP_REASON_PROCESS_SIGINT,
30
+ STOP_REASON_NOT_SPECIFIED,
32
31
  STOP_REASON_PROCESS_BEFORE_EXIT,
33
32
  STOP_REASON_PROCESS_EXIT,
34
- STOP_REASON_NOT_SPECIFIED,
33
+ STOP_REASON_PROCESS_SIGHUP,
34
+ STOP_REASON_PROCESS_SIGINT,
35
+ STOP_REASON_PROCESS_SIGTERM,
35
36
  } from "./stopReasons.js";
36
- import { composeTwoHeaders } from "./internal/headers_composition.js";
37
37
 
38
- import { createIpGetters } from "./internal/server_ips.js";
39
- import { parseHostname } from "./internal/hostname_parser.js";
40
38
  import { applyDnsResolution } from "./internal/dns_resolution.js";
39
+ import { parseHostname } from "./internal/hostname_parser.js";
40
+ import { createIpGetters } from "./internal/server_ips.js";
41
41
 
42
42
  export const startServer = async ({
43
43
  signal = new AbortController().signal,