woodland 18.2.4 → 18.2.5
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/LICENSE +1 -1
- package/README.md +1 -1
- package/dist/cli.cjs +20 -20
- package/dist/woodland.cjs +34 -33
- package/dist/woodland.js +10 -9
- package/package.json +11 -11
- package/types/constants.d.ts +139 -139
- package/types/utility.d.ts +21 -21
- package/types/woodland.d.ts +84 -84
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -246,6 +246,6 @@ Woodland defaults to [Common Log Format](https://en.wikipedia.org/wiki/Common_Lo
|
|
|
246
246
|
You can disable woodland's logging by configuration with `{logging: {enabled: false}}`.
|
|
247
247
|
|
|
248
248
|
## License
|
|
249
|
-
Copyright (c)
|
|
249
|
+
Copyright (c) 2024 Jason Mulligan
|
|
250
250
|
|
|
251
251
|
Licensed under the BSD-3 license.
|
package/dist/cli.cjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* woodland
|
|
4
|
-
*
|
|
5
|
-
* @copyright
|
|
6
|
-
* @license BSD-3-Clause
|
|
7
|
-
* @version 18.2.
|
|
8
|
-
*/
|
|
9
|
-
'use strict';
|
|
10
|
-
|
|
11
|
-
var node_http = require('node:http');
|
|
12
|
-
var tinyCoerce = require('tiny-coerce');
|
|
13
|
-
var woodland = require('woodland');
|
|
14
|
-
var node_module = require('node:module');
|
|
15
|
-
var node_path = require('node:path');
|
|
16
|
-
var node_url = require('node:url');
|
|
17
|
-
|
|
18
|
-
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
2
|
+
/**
|
|
3
|
+
* woodland
|
|
4
|
+
*
|
|
5
|
+
* @copyright 2024 Jason Mulligan <jason.mulligan@avoidwork.com>
|
|
6
|
+
* @license BSD-3-Clause
|
|
7
|
+
* @version 18.2.5
|
|
8
|
+
*/
|
|
9
|
+
'use strict';
|
|
10
|
+
|
|
11
|
+
var node_http = require('node:http');
|
|
12
|
+
var tinyCoerce = require('tiny-coerce');
|
|
13
|
+
var woodland = require('woodland');
|
|
14
|
+
var node_module = require('node:module');
|
|
15
|
+
var node_path = require('node:path');
|
|
16
|
+
var node_url = require('node:url');
|
|
17
|
+
|
|
18
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
19
19
|
const __dirname$1 = node_url.fileURLToPath(new node_url.URL(".", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('cli.cjs', document.baseURI).href))));
|
|
20
20
|
const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('cli.cjs', document.baseURI).href)));
|
|
21
21
|
require$1(node_path.join(__dirname$1, "..", "package.json"));
|
|
@@ -37,8 +37,8 @@ Object.freeze(Array.from(Array(12).values()).map((i, idx) => {
|
|
|
37
37
|
}));
|
|
38
38
|
const NO_CACHE = "no-cache";
|
|
39
39
|
const TEXT_PLAIN = "text/plain";
|
|
40
|
-
`nodejs/${process.version}, ${process.platform}/${process.arch}`;
|
|
41
|
-
|
|
40
|
+
`nodejs/${process.version}, ${process.platform}/${process.arch}`;
|
|
41
|
+
|
|
42
42
|
const app = woodland.woodland({
|
|
43
43
|
autoindex: true,
|
|
44
44
|
defaultHeaders: {[CACHE_CONTROL]: NO_CACHE, [CONTENT_TYPE]: `${TEXT_PLAIN}; ${CHAR_SET}`},
|
|
@@ -56,4 +56,4 @@ const app = woodland.woodland({
|
|
|
56
56
|
|
|
57
57
|
app.staticFiles();
|
|
58
58
|
node_http.createServer(app.route).listen(port, ip);
|
|
59
|
-
app.log(`id=woodland, hostname=localhost, ip=${ip}, port=${port}`, INFO);
|
|
59
|
+
app.log(`id=woodland, hostname=localhost, ip=${ip}, port=${port}`, INFO);
|
package/dist/woodland.cjs
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* woodland
|
|
3
|
-
*
|
|
4
|
-
* @copyright
|
|
5
|
-
* @license BSD-3-Clause
|
|
6
|
-
* @version 18.2.
|
|
7
|
-
*/
|
|
8
|
-
'use strict';
|
|
9
|
-
|
|
10
|
-
var node_http = require('node:http');
|
|
11
|
-
var node_path = require('node:path');
|
|
12
|
-
var node_events = require('node:events');
|
|
13
|
-
var promises = require('node:fs/promises');
|
|
14
|
-
var tinyEtag = require('tiny-etag');
|
|
15
|
-
var precise = require('precise');
|
|
16
|
-
var tinyLru = require('tiny-lru');
|
|
17
|
-
var node_module = require('node:module');
|
|
18
|
-
var node_url = require('node:url');
|
|
19
|
-
var node_fs = require('node:fs');
|
|
20
|
-
var tinyCoerce = require('tiny-coerce');
|
|
21
|
-
var mimeDb = require('mime-db');
|
|
22
|
-
|
|
23
|
-
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
1
|
+
/**
|
|
2
|
+
* woodland
|
|
3
|
+
*
|
|
4
|
+
* @copyright 2024 Jason Mulligan <jason.mulligan@avoidwork.com>
|
|
5
|
+
* @license BSD-3-Clause
|
|
6
|
+
* @version 18.2.5
|
|
7
|
+
*/
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
var node_http = require('node:http');
|
|
11
|
+
var node_path = require('node:path');
|
|
12
|
+
var node_events = require('node:events');
|
|
13
|
+
var promises = require('node:fs/promises');
|
|
14
|
+
var tinyEtag = require('tiny-etag');
|
|
15
|
+
var precise = require('precise');
|
|
16
|
+
var tinyLru = require('tiny-lru');
|
|
17
|
+
var node_module = require('node:module');
|
|
18
|
+
var node_url = require('node:url');
|
|
19
|
+
var node_fs = require('node:fs');
|
|
20
|
+
var tinyCoerce = require('tiny-coerce');
|
|
21
|
+
var mimeDb = require('mime-db');
|
|
22
|
+
|
|
23
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
24
24
|
const __dirname$2 = node_url.fileURLToPath(new node_url.URL(".", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('woodland.cjs', document.baseURI).href))));
|
|
25
25
|
const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('woodland.cjs', document.baseURI).href)));
|
|
26
26
|
const {name, version} = require$1(node_path.join(__dirname$2, "..", "package.json"));
|
|
@@ -162,8 +162,8 @@ const WILDCARD = "*";
|
|
|
162
162
|
const X_FORWARDED_FOR = "x-forwarded-for";
|
|
163
163
|
const X_POWERED_BY = "x-powered-by";
|
|
164
164
|
const X_POWERED_BY_VALUE = `nodejs/${process.version}, ${process.platform}/${process.arch}`;
|
|
165
|
-
const X_RESPONSE_TIME = "x-response-time";
|
|
166
|
-
|
|
165
|
+
const X_RESPONSE_TIME = "x-response-time";
|
|
166
|
+
|
|
167
167
|
const __dirname$1 = node_url.fileURLToPath(new node_url.URL(".", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('woodland.cjs', document.baseURI).href)))),
|
|
168
168
|
html = node_fs.readFileSync(node_path.join(__dirname$1, "..", "tpl", "autoindex.html"), {encoding: UTF8}),
|
|
169
169
|
valid = Object.entries(mimeDb).filter(i => EXTENSIONS in i[1]),
|
|
@@ -316,7 +316,7 @@ function stream (req, res, file = {
|
|
|
316
316
|
}
|
|
317
317
|
|
|
318
318
|
if (req.method === GET) {
|
|
319
|
-
if ((file.etag.length > INT_0 && req.headers[IF_NONE_MATCH] === file.etag) || (req.headers[IF_NONE_MATCH] === void 0 && Date.parse(req.headers[IF_MODIFIED_SINCE]) >= file.stats.mtime)) {
|
|
319
|
+
if ((file.etag.length > INT_0 && req.headers[IF_NONE_MATCH] === file.etag) || (req.headers[IF_NONE_MATCH] === void 0 && Date.parse(req.headers[IF_MODIFIED_SINCE]) >= file.stats.mtime)) {
|
|
320
320
|
res.removeHeader(CONTENT_LENGTH);
|
|
321
321
|
res.send(EMPTY, INT_304);
|
|
322
322
|
} else {
|
|
@@ -362,8 +362,8 @@ function timeOffset (arg = INT_0) {
|
|
|
362
362
|
|
|
363
363
|
function writeHead (res, headers = {}) {
|
|
364
364
|
res.writeHead(res.statusCode, node_http.STATUS_CODES[res.statusCode], headers);
|
|
365
|
-
}
|
|
366
|
-
|
|
365
|
+
}
|
|
366
|
+
|
|
367
367
|
class Woodland extends node_events.EventEmitter {
|
|
368
368
|
constructor ({
|
|
369
369
|
autoindex = false,
|
|
@@ -403,7 +403,7 @@ class Woodland extends node_events.EventEmitter {
|
|
|
403
403
|
this.indexes = structuredClone(indexes);
|
|
404
404
|
this.permissions = tinyLru.lru(cacheSize, cacheTTL);
|
|
405
405
|
this.logging = {
|
|
406
|
-
enabled: logging?.enabled !== false
|
|
406
|
+
enabled: (logging?.enabled ?? true) !== false,
|
|
407
407
|
format: logging?.format ?? LOG_FORMAT,
|
|
408
408
|
level: logging?.level ?? INFO
|
|
409
409
|
};
|
|
@@ -812,6 +812,7 @@ class Woodland extends node_events.EventEmitter {
|
|
|
812
812
|
|
|
813
813
|
try {
|
|
814
814
|
stats = await promises.stat(fp, {bigint: false});
|
|
815
|
+
// eslint-disable-next-line no-unused-vars
|
|
815
816
|
} catch (e) {
|
|
816
817
|
valid = false;
|
|
817
818
|
}
|
|
@@ -938,7 +939,7 @@ function woodland (arg) {
|
|
|
938
939
|
app.route = app.route.bind(app);
|
|
939
940
|
|
|
940
941
|
return app;
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
exports.Woodland = Woodland;
|
|
944
|
-
exports.woodland = woodland;
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
exports.Woodland = Woodland;
|
|
945
|
+
exports.woodland = woodland;
|
package/dist/woodland.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* woodland
|
|
3
|
-
*
|
|
4
|
-
* @copyright
|
|
5
|
-
* @license BSD-3-Clause
|
|
6
|
-
* @version 18.2.
|
|
7
|
-
*/
|
|
1
|
+
/**
|
|
2
|
+
* woodland
|
|
3
|
+
*
|
|
4
|
+
* @copyright 2024 Jason Mulligan <jason.mulligan@avoidwork.com>
|
|
5
|
+
* @license BSD-3-Clause
|
|
6
|
+
* @version 18.2.5
|
|
7
|
+
*/
|
|
8
8
|
import {STATUS_CODES,METHODS}from'node:http';import {join,extname,resolve}from'node:path';import {EventEmitter}from'node:events';import {stat,readdir}from'node:fs/promises';import {etag}from'tiny-etag';import {precise}from'precise';import {lru}from'tiny-lru';import {createRequire}from'node:module';import {fileURLToPath,URL}from'node:url';import {readFileSync,createReadStream}from'node:fs';import {coerce}from'tiny-coerce';import mimeDb from'mime-db';const __dirname$1 = fileURLToPath(new URL(".", import.meta.url));
|
|
9
9
|
const require = createRequire(import.meta.url);
|
|
10
10
|
const {name, version} = require(join(__dirname$1, "..", "package.json"));
|
|
@@ -298,7 +298,7 @@ function stream (req, res, file = {
|
|
|
298
298
|
}
|
|
299
299
|
|
|
300
300
|
if (req.method === GET) {
|
|
301
|
-
if ((file.etag.length > INT_0 && req.headers[IF_NONE_MATCH] === file.etag) || (req.headers[IF_NONE_MATCH] === void 0 && Date.parse(req.headers[IF_MODIFIED_SINCE]) >= file.stats.mtime)) {
|
|
301
|
+
if ((file.etag.length > INT_0 && req.headers[IF_NONE_MATCH] === file.etag) || (req.headers[IF_NONE_MATCH] === void 0 && Date.parse(req.headers[IF_MODIFIED_SINCE]) >= file.stats.mtime)) {
|
|
302
302
|
res.removeHeader(CONTENT_LENGTH);
|
|
303
303
|
res.send(EMPTY, INT_304);
|
|
304
304
|
} else {
|
|
@@ -383,7 +383,7 @@ function writeHead (res, headers = {}) {
|
|
|
383
383
|
this.indexes = structuredClone(indexes);
|
|
384
384
|
this.permissions = lru(cacheSize, cacheTTL);
|
|
385
385
|
this.logging = {
|
|
386
|
-
enabled: logging?.enabled !== false
|
|
386
|
+
enabled: (logging?.enabled ?? true) !== false,
|
|
387
387
|
format: logging?.format ?? LOG_FORMAT,
|
|
388
388
|
level: logging?.level ?? INFO
|
|
389
389
|
};
|
|
@@ -792,6 +792,7 @@ function writeHead (res, headers = {}) {
|
|
|
792
792
|
|
|
793
793
|
try {
|
|
794
794
|
stats = await stat(fp, {bigint: false});
|
|
795
|
+
// eslint-disable-next-line no-unused-vars
|
|
795
796
|
} catch (e) {
|
|
796
797
|
valid = false;
|
|
797
798
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "woodland",
|
|
3
|
-
"version": "18.2.
|
|
3
|
+
"version": "18.2.5",
|
|
4
4
|
"description": "Lightweight HTTP framework with automatic headers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "types/woodland.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
],
|
|
19
19
|
"scripts": {
|
|
20
20
|
"benchmark": "node benchmark.js",
|
|
21
|
-
"build": "npm run lint &&
|
|
21
|
+
"build": "npm run lint && npm run rollup && npm run mocha",
|
|
22
22
|
"changelog": "auto-changelog -p",
|
|
23
23
|
"fix": "eslint --fix *.js src/*.js test/*.js",
|
|
24
24
|
"lint": "eslint *.js src/*.js test/*.js",
|
|
@@ -60,18 +60,18 @@
|
|
|
60
60
|
"precise": "^4.0.3",
|
|
61
61
|
"tiny-coerce": "^3.0.2",
|
|
62
62
|
"tiny-etag": "^4.0.5",
|
|
63
|
-
"tiny-lru": "^11.2.
|
|
63
|
+
"tiny-lru": "^11.2.6"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"auto-changelog": "^2.4.0",
|
|
67
|
-
"autocannon": "^7.
|
|
67
|
+
"autocannon": "^7.15.0",
|
|
68
68
|
"concurrently": "^8.2.2",
|
|
69
|
-
"eslint": "^
|
|
70
|
-
"husky": "^
|
|
71
|
-
"mocha": "^10.
|
|
72
|
-
"nyc": "^
|
|
73
|
-
"rollup": "^4.
|
|
74
|
-
"tiny-httptest": "^4.0.
|
|
75
|
-
"typescript": "^5.
|
|
69
|
+
"eslint": "^9.5.0",
|
|
70
|
+
"husky": "^9.0.11",
|
|
71
|
+
"mocha": "^10.4.0",
|
|
72
|
+
"nyc": "^17.0.0",
|
|
73
|
+
"rollup": "^4.18.0",
|
|
74
|
+
"tiny-httptest": "^4.0.11",
|
|
75
|
+
"typescript": "^5.4.5"
|
|
76
76
|
}
|
|
77
77
|
}
|
package/types/constants.d.ts
CHANGED
|
@@ -1,139 +1,139 @@
|
|
|
1
|
-
export const ACCESS_CONTROL_ALLOW_CREDENTIALS: "access-control-allow-credentials";
|
|
2
|
-
export const ACCESS_CONTROL_ALLOW_HEADERS: "access-control-allow-headers";
|
|
3
|
-
export const ACCESS_CONTROL_ALLOW_METHODS: "access-control-allow-methods";
|
|
4
|
-
export const ACCESS_CONTROL_ALLOW_ORIGIN: "access-control-allow-origin";
|
|
5
|
-
export const ACCESS_CONTROL_EXPOSE_HEADERS: "access-control-expose-headers";
|
|
6
|
-
export const ACCESS_CONTROL_REQUEST_HEADERS: "access-control-request-headers";
|
|
7
|
-
export const ALLOW: "allow";
|
|
8
|
-
export const APPLICATION_JSON: "application/json";
|
|
9
|
-
export const APPLICATION_OCTET_STREAM: "application/octet-stream";
|
|
10
|
-
export const ARRAY: "array";
|
|
11
|
-
export const CACHE_CONTROL: "cache-control";
|
|
12
|
-
export const CHAR_SET: "charset=utf-8";
|
|
13
|
-
export const COLON: ":";
|
|
14
|
-
export const COMMA: ",";
|
|
15
|
-
export const COMMA_SPACE: ", ";
|
|
16
|
-
export const CONNECT: "CONNECT";
|
|
17
|
-
export const CONTENT_LENGTH: "content-length";
|
|
18
|
-
export const CONTENT_RANGE: "content-range";
|
|
19
|
-
export const CONTENT_TYPE: "content-type";
|
|
20
|
-
export const DEBUG: "debug";
|
|
21
|
-
export const DELETE: "DELETE";
|
|
22
|
-
export const DELIMITER: "|";
|
|
23
|
-
export const EQUAL: "=";
|
|
24
|
-
export const EMPTY: "";
|
|
25
|
-
export const EN_US: "en-US";
|
|
26
|
-
export const END: "end";
|
|
27
|
-
export const ETAG: "etag";
|
|
28
|
-
export const ERROR: "error";
|
|
29
|
-
export const EXTENSIONS: "extensions";
|
|
30
|
-
export const FILES: "files";
|
|
31
|
-
export const FINISH: "finish";
|
|
32
|
-
export const FUNCTION: "function";
|
|
33
|
-
export const GET: "GET";
|
|
34
|
-
export const HEAD: "HEAD";
|
|
35
|
-
export const HYPHEN: "-";
|
|
36
|
-
export const IF_NONE_MATCH: "if-none-match";
|
|
37
|
-
export const IF_MODIFIED_SINCE: "if-modified-since";
|
|
38
|
-
export const INDEX_HTM: "index.htm";
|
|
39
|
-
export const INDEX_HTML: "index.html";
|
|
40
|
-
export const INFO: "info";
|
|
41
|
-
export const INT_0: 0;
|
|
42
|
-
export const INT_2: 2;
|
|
43
|
-
export const INT_3: 3;
|
|
44
|
-
export const INT_4: 4;
|
|
45
|
-
export const INT_10: 10;
|
|
46
|
-
export const INT_60: 60;
|
|
47
|
-
export const INT_200: 200;
|
|
48
|
-
export const INT_204: 204;
|
|
49
|
-
export const INT_206: 206;
|
|
50
|
-
export const INT_304: 304;
|
|
51
|
-
export const INT_307: 307;
|
|
52
|
-
export const INT_308: 308;
|
|
53
|
-
export const INT_403: 403;
|
|
54
|
-
export const INT_404: 404;
|
|
55
|
-
export const INT_405: 405;
|
|
56
|
-
export const INT_416: 416;
|
|
57
|
-
export const INT_500: 500;
|
|
58
|
-
export const INT_8000: 8000;
|
|
59
|
-
export const INT_1e3: 1000;
|
|
60
|
-
export const INT_1e4: 10000;
|
|
61
|
-
export const INT_1e6: 1000000;
|
|
62
|
-
export const IP_TOKEN: "%IP";
|
|
63
|
-
export const KEY_BYTES: "bytes=";
|
|
64
|
-
export const LAST_MODIFIED: "last-modified";
|
|
65
|
-
export const LEFT_PAREN: "(";
|
|
66
|
-
export const LEVELS: Readonly<{
|
|
67
|
-
emerg: 0;
|
|
68
|
-
alert: 1;
|
|
69
|
-
crit: 2;
|
|
70
|
-
error: 3;
|
|
71
|
-
warn: 4;
|
|
72
|
-
notice: 5;
|
|
73
|
-
info: 6;
|
|
74
|
-
debug: 7;
|
|
75
|
-
}>;
|
|
76
|
-
export const LOCALHOST: "127.0.0.1";
|
|
77
|
-
export const LOCATION: "location";
|
|
78
|
-
export const LOG: "log";
|
|
79
|
-
export const LOG_B: "%b";
|
|
80
|
-
export const LOG_FORMAT: "%h %l %u %t \"%r\" %>s %b";
|
|
81
|
-
export const LOG_H: "%h";
|
|
82
|
-
export const LOG_L: "%l";
|
|
83
|
-
export const LOG_R: "%r";
|
|
84
|
-
export const LOG_REFERRER: "%{Referer}i";
|
|
85
|
-
export const LOG_S: "%>s";
|
|
86
|
-
export const LOG_T: "%t";
|
|
87
|
-
export const LOG_U: "%u";
|
|
88
|
-
export const LOG_USER_AGENT: "%{User-agent}i";
|
|
89
|
-
export const LOG_V: "%v";
|
|
90
|
-
export const SHORT: "short";
|
|
91
|
-
export const MONTHS: any;
|
|
92
|
-
export const MSG_DETERMINED_ALLOW: "Determined 'allow' header value";
|
|
93
|
-
export const MSG_ERROR_HEAD_ROUTE: "Cannot set HEAD route, use GET";
|
|
94
|
-
export const MSG_ERROR_INVALID_METHOD: "Invalid HTTP method";
|
|
95
|
-
export const MSG_SENDING_BODY: "Sending response body";
|
|
96
|
-
export const MSG_DECORATED_IP: "Decorated request from %IP";
|
|
97
|
-
export const MSG_ERROR_IP: "Handled error response for %IP";
|
|
98
|
-
export const MSG_IGNORED_FN: "Added function to ignored Set";
|
|
99
|
-
export const MSG_ROUTING: "Routing request";
|
|
100
|
-
export const MSG_ROUTING_FILE: "Routing request to file system";
|
|
101
|
-
export const MSG_RETRIEVED_MIDDLEWARE: "Retrieved middleware for request";
|
|
102
|
-
export const MSG_REGISTERING_MIDDLEWARE: "Registering middleware";
|
|
103
|
-
export const MSG_HEADERS_SENT: "Headers already sent";
|
|
104
|
-
export const NO_CACHE: "no-cache";
|
|
105
|
-
export const OBJECT: "object";
|
|
106
|
-
export const OPTIONS: "OPTIONS";
|
|
107
|
-
export const OPTIONS_BODY: "Make a GET request to retrieve the file";
|
|
108
|
-
export const ORIGIN: "origin";
|
|
109
|
-
export const PARAMS_GROUP: "/(?<$1>[^/]+)";
|
|
110
|
-
export const PATCH: "PATCH";
|
|
111
|
-
export const PERIOD: ".";
|
|
112
|
-
export const POST: "POST";
|
|
113
|
-
export const PUT: "PUT";
|
|
114
|
-
export const RANGE: "range";
|
|
115
|
-
export const READ_HEADERS: "GET, HEAD, OPTIONS";
|
|
116
|
-
export const SERVER: "server";
|
|
117
|
-
export const SERVER_VALUE: string;
|
|
118
|
-
export const SLASH: "/";
|
|
119
|
-
export const START: "start";
|
|
120
|
-
export const STRING: "string";
|
|
121
|
-
export const STRING_0: "0";
|
|
122
|
-
export const STRING_00: "00";
|
|
123
|
-
export const STRING_30: "30";
|
|
124
|
-
export const TEXT_PLAIN: "text/plain";
|
|
125
|
-
export const TIME_MS: "%N ms";
|
|
126
|
-
export const TIMING_ALLOW_ORIGIN: "timing-allow-origin";
|
|
127
|
-
export const TITLE: "title";
|
|
128
|
-
export const TO_STRING: "toString";
|
|
129
|
-
export const TOKEN_N: "%N";
|
|
130
|
-
export const TRACE: "TRACE";
|
|
131
|
-
export const TRUE: "true";
|
|
132
|
-
export const USER_AGENT: "user-agent";
|
|
133
|
-
export const UTF8: "utf8";
|
|
134
|
-
export const UTF_8: "utf-8";
|
|
135
|
-
export const WILDCARD: "*";
|
|
136
|
-
export const X_FORWARDED_FOR: "x-forwarded-for";
|
|
137
|
-
export const X_POWERED_BY: "x-powered-by";
|
|
138
|
-
export const X_POWERED_BY_VALUE: string;
|
|
139
|
-
export const X_RESPONSE_TIME: "x-response-time";
|
|
1
|
+
export const ACCESS_CONTROL_ALLOW_CREDENTIALS: "access-control-allow-credentials";
|
|
2
|
+
export const ACCESS_CONTROL_ALLOW_HEADERS: "access-control-allow-headers";
|
|
3
|
+
export const ACCESS_CONTROL_ALLOW_METHODS: "access-control-allow-methods";
|
|
4
|
+
export const ACCESS_CONTROL_ALLOW_ORIGIN: "access-control-allow-origin";
|
|
5
|
+
export const ACCESS_CONTROL_EXPOSE_HEADERS: "access-control-expose-headers";
|
|
6
|
+
export const ACCESS_CONTROL_REQUEST_HEADERS: "access-control-request-headers";
|
|
7
|
+
export const ALLOW: "allow";
|
|
8
|
+
export const APPLICATION_JSON: "application/json";
|
|
9
|
+
export const APPLICATION_OCTET_STREAM: "application/octet-stream";
|
|
10
|
+
export const ARRAY: "array";
|
|
11
|
+
export const CACHE_CONTROL: "cache-control";
|
|
12
|
+
export const CHAR_SET: "charset=utf-8";
|
|
13
|
+
export const COLON: ":";
|
|
14
|
+
export const COMMA: ",";
|
|
15
|
+
export const COMMA_SPACE: ", ";
|
|
16
|
+
export const CONNECT: "CONNECT";
|
|
17
|
+
export const CONTENT_LENGTH: "content-length";
|
|
18
|
+
export const CONTENT_RANGE: "content-range";
|
|
19
|
+
export const CONTENT_TYPE: "content-type";
|
|
20
|
+
export const DEBUG: "debug";
|
|
21
|
+
export const DELETE: "DELETE";
|
|
22
|
+
export const DELIMITER: "|";
|
|
23
|
+
export const EQUAL: "=";
|
|
24
|
+
export const EMPTY: "";
|
|
25
|
+
export const EN_US: "en-US";
|
|
26
|
+
export const END: "end";
|
|
27
|
+
export const ETAG: "etag";
|
|
28
|
+
export const ERROR: "error";
|
|
29
|
+
export const EXTENSIONS: "extensions";
|
|
30
|
+
export const FILES: "files";
|
|
31
|
+
export const FINISH: "finish";
|
|
32
|
+
export const FUNCTION: "function";
|
|
33
|
+
export const GET: "GET";
|
|
34
|
+
export const HEAD: "HEAD";
|
|
35
|
+
export const HYPHEN: "-";
|
|
36
|
+
export const IF_NONE_MATCH: "if-none-match";
|
|
37
|
+
export const IF_MODIFIED_SINCE: "if-modified-since";
|
|
38
|
+
export const INDEX_HTM: "index.htm";
|
|
39
|
+
export const INDEX_HTML: "index.html";
|
|
40
|
+
export const INFO: "info";
|
|
41
|
+
export const INT_0: 0;
|
|
42
|
+
export const INT_2: 2;
|
|
43
|
+
export const INT_3: 3;
|
|
44
|
+
export const INT_4: 4;
|
|
45
|
+
export const INT_10: 10;
|
|
46
|
+
export const INT_60: 60;
|
|
47
|
+
export const INT_200: 200;
|
|
48
|
+
export const INT_204: 204;
|
|
49
|
+
export const INT_206: 206;
|
|
50
|
+
export const INT_304: 304;
|
|
51
|
+
export const INT_307: 307;
|
|
52
|
+
export const INT_308: 308;
|
|
53
|
+
export const INT_403: 403;
|
|
54
|
+
export const INT_404: 404;
|
|
55
|
+
export const INT_405: 405;
|
|
56
|
+
export const INT_416: 416;
|
|
57
|
+
export const INT_500: 500;
|
|
58
|
+
export const INT_8000: 8000;
|
|
59
|
+
export const INT_1e3: 1000;
|
|
60
|
+
export const INT_1e4: 10000;
|
|
61
|
+
export const INT_1e6: 1000000;
|
|
62
|
+
export const IP_TOKEN: "%IP";
|
|
63
|
+
export const KEY_BYTES: "bytes=";
|
|
64
|
+
export const LAST_MODIFIED: "last-modified";
|
|
65
|
+
export const LEFT_PAREN: "(";
|
|
66
|
+
export const LEVELS: Readonly<{
|
|
67
|
+
emerg: 0;
|
|
68
|
+
alert: 1;
|
|
69
|
+
crit: 2;
|
|
70
|
+
error: 3;
|
|
71
|
+
warn: 4;
|
|
72
|
+
notice: 5;
|
|
73
|
+
info: 6;
|
|
74
|
+
debug: 7;
|
|
75
|
+
}>;
|
|
76
|
+
export const LOCALHOST: "127.0.0.1";
|
|
77
|
+
export const LOCATION: "location";
|
|
78
|
+
export const LOG: "log";
|
|
79
|
+
export const LOG_B: "%b";
|
|
80
|
+
export const LOG_FORMAT: "%h %l %u %t \"%r\" %>s %b";
|
|
81
|
+
export const LOG_H: "%h";
|
|
82
|
+
export const LOG_L: "%l";
|
|
83
|
+
export const LOG_R: "%r";
|
|
84
|
+
export const LOG_REFERRER: "%{Referer}i";
|
|
85
|
+
export const LOG_S: "%>s";
|
|
86
|
+
export const LOG_T: "%t";
|
|
87
|
+
export const LOG_U: "%u";
|
|
88
|
+
export const LOG_USER_AGENT: "%{User-agent}i";
|
|
89
|
+
export const LOG_V: "%v";
|
|
90
|
+
export const SHORT: "short";
|
|
91
|
+
export const MONTHS: any;
|
|
92
|
+
export const MSG_DETERMINED_ALLOW: "Determined 'allow' header value";
|
|
93
|
+
export const MSG_ERROR_HEAD_ROUTE: "Cannot set HEAD route, use GET";
|
|
94
|
+
export const MSG_ERROR_INVALID_METHOD: "Invalid HTTP method";
|
|
95
|
+
export const MSG_SENDING_BODY: "Sending response body";
|
|
96
|
+
export const MSG_DECORATED_IP: "Decorated request from %IP";
|
|
97
|
+
export const MSG_ERROR_IP: "Handled error response for %IP";
|
|
98
|
+
export const MSG_IGNORED_FN: "Added function to ignored Set";
|
|
99
|
+
export const MSG_ROUTING: "Routing request";
|
|
100
|
+
export const MSG_ROUTING_FILE: "Routing request to file system";
|
|
101
|
+
export const MSG_RETRIEVED_MIDDLEWARE: "Retrieved middleware for request";
|
|
102
|
+
export const MSG_REGISTERING_MIDDLEWARE: "Registering middleware";
|
|
103
|
+
export const MSG_HEADERS_SENT: "Headers already sent";
|
|
104
|
+
export const NO_CACHE: "no-cache";
|
|
105
|
+
export const OBJECT: "object";
|
|
106
|
+
export const OPTIONS: "OPTIONS";
|
|
107
|
+
export const OPTIONS_BODY: "Make a GET request to retrieve the file";
|
|
108
|
+
export const ORIGIN: "origin";
|
|
109
|
+
export const PARAMS_GROUP: "/(?<$1>[^/]+)";
|
|
110
|
+
export const PATCH: "PATCH";
|
|
111
|
+
export const PERIOD: ".";
|
|
112
|
+
export const POST: "POST";
|
|
113
|
+
export const PUT: "PUT";
|
|
114
|
+
export const RANGE: "range";
|
|
115
|
+
export const READ_HEADERS: "GET, HEAD, OPTIONS";
|
|
116
|
+
export const SERVER: "server";
|
|
117
|
+
export const SERVER_VALUE: string;
|
|
118
|
+
export const SLASH: "/";
|
|
119
|
+
export const START: "start";
|
|
120
|
+
export const STRING: "string";
|
|
121
|
+
export const STRING_0: "0";
|
|
122
|
+
export const STRING_00: "00";
|
|
123
|
+
export const STRING_30: "30";
|
|
124
|
+
export const TEXT_PLAIN: "text/plain";
|
|
125
|
+
export const TIME_MS: "%N ms";
|
|
126
|
+
export const TIMING_ALLOW_ORIGIN: "timing-allow-origin";
|
|
127
|
+
export const TITLE: "title";
|
|
128
|
+
export const TO_STRING: "toString";
|
|
129
|
+
export const TOKEN_N: "%N";
|
|
130
|
+
export const TRACE: "TRACE";
|
|
131
|
+
export const TRUE: "true";
|
|
132
|
+
export const USER_AGENT: "user-agent";
|
|
133
|
+
export const UTF8: "utf8";
|
|
134
|
+
export const UTF_8: "utf-8";
|
|
135
|
+
export const WILDCARD: "*";
|
|
136
|
+
export const X_FORWARDED_FOR: "x-forwarded-for";
|
|
137
|
+
export const X_POWERED_BY: "x-powered-by";
|
|
138
|
+
export const X_POWERED_BY_VALUE: string;
|
|
139
|
+
export const X_RESPONSE_TIME: "x-response-time";
|
package/types/utility.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
export function autoindex(title?: string, files?: any[]): any;
|
|
2
|
-
export function getStatus(req: any, res: any): any;
|
|
3
|
-
export function ms(arg?: number, digits?: number): string;
|
|
4
|
-
export function next(req: any, res: any, middleware: any): (err: any) => any;
|
|
5
|
-
export function pad(arg?: number): any;
|
|
6
|
-
export function params(req: any, getParams: any): void;
|
|
7
|
-
export function parse(arg: any): any;
|
|
8
|
-
export function partialHeaders(req: any, res: any, size: any, status: any, headers?: {}, options?: {}): {}[];
|
|
9
|
-
export function pipeable(method: any, arg: any): boolean;
|
|
10
|
-
export function reduce(uri: any, map?: any, arg?: {}, end?: boolean, ignore?: any): void;
|
|
11
|
-
export function stream(req: any, res: any, file?: {
|
|
12
|
-
charset: string;
|
|
13
|
-
etag: string;
|
|
14
|
-
path: string;
|
|
15
|
-
stats: {
|
|
16
|
-
mtime: Date;
|
|
17
|
-
size: number;
|
|
18
|
-
};
|
|
19
|
-
}): any;
|
|
20
|
-
export function timeOffset(arg?: number): string;
|
|
21
|
-
export function writeHead(res: any, headers?: {}): void;
|
|
1
|
+
export function autoindex(title?: string, files?: any[]): any;
|
|
2
|
+
export function getStatus(req: any, res: any): any;
|
|
3
|
+
export function ms(arg?: number, digits?: number): string;
|
|
4
|
+
export function next(req: any, res: any, middleware: any): (err: any) => any;
|
|
5
|
+
export function pad(arg?: number): any;
|
|
6
|
+
export function params(req: any, getParams: any): void;
|
|
7
|
+
export function parse(arg: any): any;
|
|
8
|
+
export function partialHeaders(req: any, res: any, size: any, status: any, headers?: {}, options?: {}): {}[];
|
|
9
|
+
export function pipeable(method: any, arg: any): boolean;
|
|
10
|
+
export function reduce(uri: any, map?: any, arg?: {}, end?: boolean, ignore?: any): void;
|
|
11
|
+
export function stream(req: any, res: any, file?: {
|
|
12
|
+
charset: string;
|
|
13
|
+
etag: string;
|
|
14
|
+
path: string;
|
|
15
|
+
stats: {
|
|
16
|
+
mtime: Date;
|
|
17
|
+
size: number;
|
|
18
|
+
};
|
|
19
|
+
}): any;
|
|
20
|
+
export function timeOffset(arg?: number): string;
|
|
21
|
+
export function writeHead(res: any, headers?: {}): void;
|
package/types/woodland.d.ts
CHANGED
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
export function woodland(arg: any): Woodland;
|
|
2
|
-
export class Woodland {
|
|
3
|
-
constructor({ autoindex, cacheSize, cacheTTL, charset, defaultHeaders, digit, etags, indexes, logging, origins, silent, time }?: {
|
|
4
|
-
autoindex?: boolean;
|
|
5
|
-
cacheSize?: number;
|
|
6
|
-
cacheTTL?: number;
|
|
7
|
-
charset?: string;
|
|
8
|
-
defaultHeaders?: {};
|
|
9
|
-
digit?: number;
|
|
10
|
-
etags?: boolean;
|
|
11
|
-
indexes?: string[];
|
|
12
|
-
logging?: {};
|
|
13
|
-
origins?: string[];
|
|
14
|
-
silent?: boolean;
|
|
15
|
-
time?: boolean;
|
|
16
|
-
});
|
|
17
|
-
autoindex: boolean;
|
|
18
|
-
ignored: any;
|
|
19
|
-
cache: import("tiny-lru").LRU<any>;
|
|
20
|
-
charset: string;
|
|
21
|
-
corsExpose: string;
|
|
22
|
-
defaultHeaders: any;
|
|
23
|
-
digit: number;
|
|
24
|
-
etags: {
|
|
25
|
-
cache: import("tiny-lru").LRU<any>;
|
|
26
|
-
mimetype: any;
|
|
27
|
-
seed: any;
|
|
28
|
-
create(arg: any): string;
|
|
29
|
-
middleware(req: any, res: any, next: any): void;
|
|
30
|
-
hash(arg?: string, mimetype?: string): string;
|
|
31
|
-
register(key: any, arg: any): any;
|
|
32
|
-
unregister(key: any): void;
|
|
33
|
-
valid(headers: any): boolean;
|
|
34
|
-
};
|
|
35
|
-
indexes: string[];
|
|
36
|
-
permissions: import("tiny-lru").LRU<any>;
|
|
37
|
-
logging: {
|
|
38
|
-
enabled: boolean;
|
|
39
|
-
format: any;
|
|
40
|
-
level: any;
|
|
41
|
-
};
|
|
42
|
-
methods: any[];
|
|
43
|
-
middleware: any;
|
|
44
|
-
origins: string[];
|
|
45
|
-
time: boolean;
|
|
46
|
-
allowed(method: any, uri: any, override?: boolean): boolean;
|
|
47
|
-
allows(uri: any, override?: boolean): any;
|
|
48
|
-
always(...args: any[]): this;
|
|
49
|
-
connect(...args: any[]): this;
|
|
50
|
-
clf(req: any, res: any): any;
|
|
51
|
-
cors(req: any): any;
|
|
52
|
-
corsHost(req: any): boolean;
|
|
53
|
-
decorate(req: any, res: any): void;
|
|
54
|
-
del(...args: any[]): this;
|
|
55
|
-
delete(...args: any[]): this;
|
|
56
|
-
error(req: any, res: any): (status: number, body: any) => void;
|
|
57
|
-
etag(method: any, ...args: any[]): string;
|
|
58
|
-
get(...args: any[]): this;
|
|
59
|
-
ignore(fn: any): this;
|
|
60
|
-
ip(req: any): any;
|
|
61
|
-
json(res: any): (arg: any, status?: number, headers?: {
|
|
62
|
-
"content-type": string;
|
|
63
|
-
}) => void;
|
|
64
|
-
list(method?: string, type?: string): any;
|
|
65
|
-
log(msg: any, level?: string): this;
|
|
66
|
-
ondone(req: any, res: any, body: any, headers: any): void;
|
|
67
|
-
onready(req: any, res: any, body: any, status: any, headers: any): any[];
|
|
68
|
-
onsend(req: any, res: any, body: any, status: any, headers: any): any[];
|
|
69
|
-
options(...args: any[]): this;
|
|
70
|
-
patch(...args: any[]): this;
|
|
71
|
-
path(arg?: string): string;
|
|
72
|
-
post(...args: any[]): this;
|
|
73
|
-
put(...args: any[]): this;
|
|
74
|
-
redirect(res: any): (uri: any, perm?: boolean) => void;
|
|
75
|
-
route(req: any, res: any): void;
|
|
76
|
-
routes(uri: any, method: any, override?: boolean): any;
|
|
77
|
-
send(req: any, res: any): (body?: string, status?: any, headers?: {}) => void;
|
|
78
|
-
set(res: any): (arg?: {}) => any;
|
|
79
|
-
serve(req: any, res: any, arg?: string, folder?: any, index?: string[]): Promise<void>;
|
|
80
|
-
status(res: any): (arg?: number) => any;
|
|
81
|
-
staticFiles(root?: string): void;
|
|
82
|
-
trace(...args: any[]): this;
|
|
83
|
-
use(rpath: any, ...fn: any[]): this;
|
|
84
|
-
}
|
|
1
|
+
export function woodland(arg: any): Woodland;
|
|
2
|
+
export class Woodland {
|
|
3
|
+
constructor({ autoindex, cacheSize, cacheTTL, charset, defaultHeaders, digit, etags, indexes, logging, origins, silent, time }?: {
|
|
4
|
+
autoindex?: boolean;
|
|
5
|
+
cacheSize?: number;
|
|
6
|
+
cacheTTL?: number;
|
|
7
|
+
charset?: string;
|
|
8
|
+
defaultHeaders?: {};
|
|
9
|
+
digit?: number;
|
|
10
|
+
etags?: boolean;
|
|
11
|
+
indexes?: string[];
|
|
12
|
+
logging?: {};
|
|
13
|
+
origins?: string[];
|
|
14
|
+
silent?: boolean;
|
|
15
|
+
time?: boolean;
|
|
16
|
+
});
|
|
17
|
+
autoindex: boolean;
|
|
18
|
+
ignored: any;
|
|
19
|
+
cache: import("tiny-lru").LRU<any>;
|
|
20
|
+
charset: string;
|
|
21
|
+
corsExpose: string;
|
|
22
|
+
defaultHeaders: any;
|
|
23
|
+
digit: number;
|
|
24
|
+
etags: {
|
|
25
|
+
cache: import("tiny-lru").LRU<any>;
|
|
26
|
+
mimetype: any;
|
|
27
|
+
seed: any;
|
|
28
|
+
create(arg: any): string;
|
|
29
|
+
middleware(req: any, res: any, next: any): void;
|
|
30
|
+
hash(arg?: string, mimetype?: string): string;
|
|
31
|
+
register(key: any, arg: any): any;
|
|
32
|
+
unregister(key: any): void;
|
|
33
|
+
valid(headers: any): boolean;
|
|
34
|
+
};
|
|
35
|
+
indexes: string[];
|
|
36
|
+
permissions: import("tiny-lru").LRU<any>;
|
|
37
|
+
logging: {
|
|
38
|
+
enabled: boolean;
|
|
39
|
+
format: any;
|
|
40
|
+
level: any;
|
|
41
|
+
};
|
|
42
|
+
methods: any[];
|
|
43
|
+
middleware: any;
|
|
44
|
+
origins: string[];
|
|
45
|
+
time: boolean;
|
|
46
|
+
allowed(method: any, uri: any, override?: boolean): boolean;
|
|
47
|
+
allows(uri: any, override?: boolean): any;
|
|
48
|
+
always(...args: any[]): this;
|
|
49
|
+
connect(...args: any[]): this;
|
|
50
|
+
clf(req: any, res: any): any;
|
|
51
|
+
cors(req: any): any;
|
|
52
|
+
corsHost(req: any): boolean;
|
|
53
|
+
decorate(req: any, res: any): void;
|
|
54
|
+
del(...args: any[]): this;
|
|
55
|
+
delete(...args: any[]): this;
|
|
56
|
+
error(req: any, res: any): (status: number, body: any) => void;
|
|
57
|
+
etag(method: any, ...args: any[]): string;
|
|
58
|
+
get(...args: any[]): this;
|
|
59
|
+
ignore(fn: any): this;
|
|
60
|
+
ip(req: any): any;
|
|
61
|
+
json(res: any): (arg: any, status?: number, headers?: {
|
|
62
|
+
"content-type": string;
|
|
63
|
+
}) => void;
|
|
64
|
+
list(method?: string, type?: string): any;
|
|
65
|
+
log(msg: any, level?: string): this;
|
|
66
|
+
ondone(req: any, res: any, body: any, headers: any): void;
|
|
67
|
+
onready(req: any, res: any, body: any, status: any, headers: any): any[];
|
|
68
|
+
onsend(req: any, res: any, body: any, status: any, headers: any): any[];
|
|
69
|
+
options(...args: any[]): this;
|
|
70
|
+
patch(...args: any[]): this;
|
|
71
|
+
path(arg?: string): string;
|
|
72
|
+
post(...args: any[]): this;
|
|
73
|
+
put(...args: any[]): this;
|
|
74
|
+
redirect(res: any): (uri: any, perm?: boolean) => void;
|
|
75
|
+
route(req: any, res: any): void;
|
|
76
|
+
routes(uri: any, method: any, override?: boolean): any;
|
|
77
|
+
send(req: any, res: any): (body?: string, status?: any, headers?: {}) => void;
|
|
78
|
+
set(res: any): (arg?: {}) => any;
|
|
79
|
+
serve(req: any, res: any, arg?: string, folder?: any, index?: string[]): Promise<void>;
|
|
80
|
+
status(res: any): (arg?: number) => any;
|
|
81
|
+
staticFiles(root?: string): void;
|
|
82
|
+
trace(...args: any[]): this;
|
|
83
|
+
use(rpath: any, ...fn: any[]): this;
|
|
84
|
+
}
|