@jsenv/server 16.0.1 → 16.0.3
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/dist/jsenv_server.js
CHANGED
|
@@ -9,10 +9,10 @@ import { Readable, Stream, Writable } from "node:stream";
|
|
|
9
9
|
import http from "node:http";
|
|
10
10
|
import { Http2ServerResponse } from "node:http2";
|
|
11
11
|
import { createReadStream, existsSync, readFileSync, readdirSync, lstatSync, statSync, readFile } from "node:fs";
|
|
12
|
-
import { pathToFileURL, fileURLToPath } from "node:url";
|
|
13
|
-
import { createHash } from "node:crypto";
|
|
14
12
|
import { createRequire } from "node:module";
|
|
13
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
15
14
|
import { lookup } from "node:dns";
|
|
15
|
+
import { createHash } from "node:crypto";
|
|
16
16
|
|
|
17
17
|
const createCallbackListNotifiedOnce = () => {
|
|
18
18
|
let callbacks = [];
|
|
@@ -1499,15 +1499,8 @@ const createObservable = (producer) => {
|
|
|
1499
1499
|
},
|
|
1500
1500
|
{ signal = new AbortController().signal } = {},
|
|
1501
1501
|
) => {
|
|
1502
|
-
let cleanup = () => {};
|
|
1503
1502
|
const subscription = {
|
|
1504
|
-
active: true
|
|
1505
|
-
signal,
|
|
1506
|
-
unsubscribe: () => {
|
|
1507
|
-
subscription.closed = true;
|
|
1508
|
-
cleanup();
|
|
1509
|
-
},
|
|
1510
|
-
};
|
|
1503
|
+
active: true};
|
|
1511
1504
|
|
|
1512
1505
|
const teardownCallbackList = [];
|
|
1513
1506
|
const close = () => {
|
|
@@ -1523,7 +1516,7 @@ const createObservable = (producer) => {
|
|
|
1523
1516
|
close();
|
|
1524
1517
|
});
|
|
1525
1518
|
|
|
1526
|
-
|
|
1519
|
+
producer({
|
|
1527
1520
|
next: (value) => {
|
|
1528
1521
|
if (!subscription.active) {
|
|
1529
1522
|
return;
|
|
@@ -1552,9 +1545,6 @@ const createObservable = (producer) => {
|
|
|
1552
1545
|
teardownCallbackList.push(teardownCallback);
|
|
1553
1546
|
},
|
|
1554
1547
|
});
|
|
1555
|
-
if (typeof producerReturnValue === "function") {
|
|
1556
|
-
cleanup = producerReturnValue;
|
|
1557
|
-
}
|
|
1558
1548
|
return undefined;
|
|
1559
1549
|
},
|
|
1560
1550
|
};
|
|
@@ -1728,7 +1718,7 @@ const fromNodeRequest = (
|
|
|
1728
1718
|
`formData() called on a request with content-type: "${contentType}". multipart/form-data was expected.`,
|
|
1729
1719
|
);
|
|
1730
1720
|
}
|
|
1731
|
-
const { formidable } = await import("./js/
|
|
1721
|
+
const { formidable } = await import("./js/formidable_index.js");
|
|
1732
1722
|
const form = formidable({});
|
|
1733
1723
|
nodeRequest.resume(); // was paused in line #53
|
|
1734
1724
|
const [fields, files] = await form.parse(nodeRequest);
|
|
@@ -3403,35 +3393,6 @@ const resourceToExtension = (resource) => {
|
|
|
3403
3393
|
return pathnameToExtension(pathname);
|
|
3404
3394
|
};
|
|
3405
3395
|
|
|
3406
|
-
const isFileSystemPath$1 = (value) => {
|
|
3407
|
-
if (typeof value !== "string") {
|
|
3408
|
-
throw new TypeError(
|
|
3409
|
-
`isFileSystemPath first arg must be a string, got ${value}`,
|
|
3410
|
-
);
|
|
3411
|
-
}
|
|
3412
|
-
if (value[0] === "/") {
|
|
3413
|
-
return true;
|
|
3414
|
-
}
|
|
3415
|
-
return startsWithWindowsDriveLetter$1(value);
|
|
3416
|
-
};
|
|
3417
|
-
|
|
3418
|
-
const startsWithWindowsDriveLetter$1 = (string) => {
|
|
3419
|
-
const firstChar = string[0];
|
|
3420
|
-
if (!/[a-zA-Z]/.test(firstChar)) return false;
|
|
3421
|
-
|
|
3422
|
-
const secondChar = string[1];
|
|
3423
|
-
if (secondChar !== ":") return false;
|
|
3424
|
-
|
|
3425
|
-
return true;
|
|
3426
|
-
};
|
|
3427
|
-
|
|
3428
|
-
const fileSystemPathToUrl$1 = (value) => {
|
|
3429
|
-
if (!isFileSystemPath$1(value)) {
|
|
3430
|
-
throw new Error(`value must be a filesystem path, got ${value}`);
|
|
3431
|
-
}
|
|
3432
|
-
return String(pathToFileURL(value));
|
|
3433
|
-
};
|
|
3434
|
-
|
|
3435
3396
|
const getCommonPathname = (pathname, otherPathname) => {
|
|
3436
3397
|
if (pathname === otherPathname) {
|
|
3437
3398
|
return pathname;
|
|
@@ -3553,9 +3514,6 @@ const urlToFileSystemPath = (url) => {
|
|
|
3553
3514
|
return fileSystemPath;
|
|
3554
3515
|
};
|
|
3555
3516
|
|
|
3556
|
-
process.platform === "win32";
|
|
3557
|
-
fileSystemPathToUrl$1(process.cwd());
|
|
3558
|
-
|
|
3559
3517
|
const getParentDirectoryUrl = (url) => {
|
|
3560
3518
|
if (url.startsWith("file://")) {
|
|
3561
3519
|
// With node.js new URL('../', 'file:///C:/').href
|
|
@@ -4155,34 +4113,6 @@ const URL_META = {
|
|
|
4155
4113
|
createFilter,
|
|
4156
4114
|
};
|
|
4157
4115
|
|
|
4158
|
-
/*
|
|
4159
|
-
* - stats object documentation on Node.js
|
|
4160
|
-
* https://nodejs.org/docs/latest-v13.x/api/fs.html#fs_class_fs_stats
|
|
4161
|
-
*/
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
process.platform === "win32";
|
|
4165
|
-
|
|
4166
|
-
/*
|
|
4167
|
-
* - stats object documentation on Node.js
|
|
4168
|
-
* https://nodejs.org/docs/latest-v13.x/api/fs.html#fs_class_fs_stats
|
|
4169
|
-
*/
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
process.platform === "win32";
|
|
4173
|
-
|
|
4174
|
-
process.platform === "win32";
|
|
4175
|
-
|
|
4176
|
-
process.platform === "win32";
|
|
4177
|
-
|
|
4178
|
-
process.platform === "win32";
|
|
4179
|
-
|
|
4180
|
-
process.platform === "linux";
|
|
4181
|
-
|
|
4182
|
-
process.platform === "darwin";
|
|
4183
|
-
process.platform === "linux";
|
|
4184
|
-
process.platform === "freebsd";
|
|
4185
|
-
|
|
4186
4116
|
const isEscaped = (i, string) => {
|
|
4187
4117
|
let backslashBeforeCount = 0;
|
|
4188
4118
|
while (i--) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/server",
|
|
3
|
-
"version": "16.0.
|
|
3
|
+
"version": "16.0.3",
|
|
4
4
|
"description": "A modern Node.js HTTP server with declarative routing, content negotiation, and WebSocket support",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"/dist/",
|
|
34
34
|
"/src/"
|
|
35
35
|
],
|
|
36
|
+
"sideEffects": false,
|
|
36
37
|
"scripts": {
|
|
37
38
|
"build": "node --experimental-import-meta-resolve ./scripts/build.mjs",
|
|
38
39
|
"prepublishOnly": "npm run build"
|
|
@@ -40,14 +41,14 @@
|
|
|
40
41
|
"dependencies": {
|
|
41
42
|
"launch-editor": "2.10.0",
|
|
42
43
|
"@jsenv/abort": "4.3.1",
|
|
43
|
-
"@jsenv/humanize": "1.3.
|
|
44
|
+
"@jsenv/humanize": "1.3.1",
|
|
44
45
|
"@jsenv/url-meta": "8.5.4",
|
|
45
|
-
"@jsenv/utils": "2.2.
|
|
46
|
-
"ws": "8.18.
|
|
46
|
+
"@jsenv/utils": "2.2.1",
|
|
47
|
+
"ws": "8.18.1",
|
|
47
48
|
"formidable": "3.5.2"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
50
|
-
"eventsource": "3.0.
|
|
51
|
-
"undici": "7.
|
|
51
|
+
"eventsource": "3.0.5",
|
|
52
|
+
"undici": "7.5.0"
|
|
52
53
|
}
|
|
53
54
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { PassThrough, Transform, Stream } from "node:stream";
|
|
2
1
|
import os from "node:os";
|
|
3
2
|
import path from "node:path";
|
|
4
3
|
import fsPromises from "node:fs/promises";
|
|
5
4
|
import { EventEmitter } from "node:events";
|
|
6
5
|
import { StringDecoder } from "node:string_decoder";
|
|
7
6
|
import require$$0 from "node:domain";
|
|
7
|
+
import { PassThrough, Transform, Stream } from "node:stream";
|
|
8
8
|
import fs from "node:fs";
|
|
9
9
|
import require$$1, { createHash } from "node:crypto";
|
|
10
10
|
|