servez 1.13.4 → 1.14.1

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.
Files changed (3) hide show
  1. package/README.md +7 -1
  2. package/bin/servez +24 -19
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -49,7 +49,7 @@ Using `npx` you can run servez without installing it first:
49
49
  * `--cors` Include CORS headers (defaults to `true`, `--no-cors` to disable)
50
50
 
51
51
  * `--local` make serve only accessible from this machine. The default
52
- is to serve publicly. (0.0.0.0 vs 127.0.0.1)
52
+ is to serve publicly. (0.0.0.0 vs 127.0.0.1)
53
53
 
54
54
  * `--index` Display index.html for folders if it exists (defaults to `true`, `--no-index` to disable)
55
55
 
@@ -57,6 +57,12 @@ is to serve publicly. (0.0.0.0 vs 127.0.0.1)
57
57
 
58
58
  * `--brotli` serve `somefile.br` in place of `somefile`
59
59
 
60
+ * `--unity-hack` ignore .gz and .br when computing content type. (defaults to `true`, `--no-unity-hack` to disable)
61
+
62
+ * `--shared-array-buffers` include headers 'Cross-Origin-Opener-Policy': 'same-origin' and 'Cross-Origin-Embedder-Policy': 'require-corp'.
63
+
64
+ * `--header=<name>:<value>` extra headers to include eg `--header=Content-Language:de-DE'`
65
+
60
66
  * `--robots` Provide a /robots.txt if one does not exist. (defaults to `true`. `--no-robots` to disable)
61
67
 
62
68
  * `--hidden` Show files that start with `.`
package/bin/servez CHANGED
@@ -37,26 +37,28 @@ function genQRCode(s) {
37
37
 
38
38
  const optionSpec = {
39
39
  options: [
40
- { option: 'help', alias: 'h', type: 'Boolean', description: 'displays help' },
41
- { option: 'port', alias: 'p', type: 'Int', description: 'port', default: '8080' },
42
- { option: 'version', type: 'Boolean', description: 'print version' },
43
- { option: 'scan', type: 'Boolean', description: 'scan for open port', default: 'true', },
44
- { option: 'dirs', type: 'Boolean', description: 'show directory listing', default: 'true', },
40
+ { option: 'help', alias: 'h', type: 'Boolean', description: 'displays help' },
41
+ { option: 'port', alias: 'p', type: 'Int', description: 'port', default: '8080' },
42
+ { option: 'version', type: 'Boolean', description: 'print version' },
43
+ { option: 'scan', type: 'Boolean', description: 'scan for open port', default: 'true', },
45
44
  { option: 'qr', type: 'Boolean', description: 'print QR Code for root url' },
46
- { option: 'cors', type: 'Boolean', description: 'send CORS headers', default: 'true', },
47
- { option: 'local', type: 'Boolean', description: 'local machine only', default: 'false', },
48
- { option: 'index', type: 'Boolean', description: 'serve index.html for directories', default: 'true', },
49
- { option: 'extensions', type: '[String]', description: 'extensions to try if path does not exist', default: '["html"]', },
50
- { option: 'unity-hack', type: 'Boolean', description: 'ignore .gz and .br when computing content type', default: 'true', },
51
- { option: 'gzip', type: 'Boolean', description: 'serve .gz files if they exist', default: 'false', },
52
- { option: 'brotli', type: 'Boolean', description: 'serve .br files if they exist', default: 'false', },
53
- { option: 'robots', type: 'Boolean', description: 'serve a robots.txt if one does not exist', default: 'true', },
54
- { option: 'hidden', type: 'Boolean', description: 'show hidden dotfiles', default: 'false', },
55
- { option: 'username', type: 'String', description: 'username for basic auth' },
56
- { option: 'password', type: 'String', description: 'password for basic auth' },
57
- { option: 'ssl', alias: 'S', type: 'Boolean', description: 'enable https (will use fake cert if not specified)', },
58
- { option: 'cert', alias: 'C', type: 'String', description: 'Path to ssl cert file', },
59
- { option: 'key', alias: 'K', type: 'String', description: 'Path to ssl key file', },
45
+ { option: 'dirs', type: 'Boolean', description: 'show directory listing', default: 'true', },
46
+ { option: 'cors', type: 'Boolean', description: 'send CORS headers', default: 'true', },
47
+ { option: 'local', type: 'Boolean', description: 'local machine only', default: 'false', },
48
+ { option: 'index', type: 'Boolean', description: 'serve index.html for directories', default: 'true', },
49
+ { option: 'extensions', type: '[String]', description: 'extensions to try if path does not exist', default: '["html"]', },
50
+ { option: 'unity-hack', type: 'Boolean', description: 'ignore .gz and .br when computing content type', default: 'true', },
51
+ { option: 'shared-array-buffers', type: 'Boolean', description: "include headers 'Cross-Origin-Opener-Policy': 'same-origin' and 'Cross-Origin-Embedder-Policy': 'require-corp'", default: 'false', },
52
+ { option: 'header', type: 'Object', description: 'extra headers to include eg --header=Content-Language:de-DE', mergeRepeatedObjects: true},
53
+ { option: 'gzip', type: 'Boolean', description: 'serve .gz files if they exist', default: 'false', },
54
+ { option: 'brotli', type: 'Boolean', description: 'serve .br files if they exist', default: 'false', },
55
+ { option: 'robots', type: 'Boolean', description: 'serve a robots.txt if one does not exist', default: 'true', },
56
+ { option: 'hidden', type: 'Boolean', description: 'show hidden dotfiles', default: 'false', },
57
+ { option: 'username', type: 'String', description: 'username for basic auth' },
58
+ { option: 'password', type: 'String', description: 'password for basic auth' },
59
+ { option: 'ssl', alias: 'S', type: 'Boolean', description: 'enable https (will use fake cert if not specified)', },
60
+ { option: 'cert', alias: 'C', type: 'String', description: 'Path to ssl cert file', },
61
+ { option: 'key', alias: 'K', type: 'String', description: 'Path to ssl key file', },
60
62
  ],
61
63
  prepend: `Usage: servez [options] [path-to-serve]`,
62
64
  helpStyle: {
@@ -91,6 +93,9 @@ if (args.version) {
91
93
  process.exit(0);
92
94
  }
93
95
 
96
+ args.headers = args.header;
97
+ delete args.header;
98
+
94
99
  const fs = require('fs');
95
100
  const path = require('path');
96
101
  const {QrCode, Ecc} = require('../lib/qrcodegen');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "servez",
3
- "version": "1.13.4",
3
+ "version": "1.14.1",
4
4
  "description": "A simple command line server to replace http-server",
5
5
  "scripts": {
6
6
  "start": "node ./bin/servez"
@@ -26,7 +26,7 @@
26
26
  "ansi-colors": "^4.1.1",
27
27
  "color-support": "^1.1.3",
28
28
  "optionator": "^0.8.2",
29
- "servez-lib": "^2.5.0"
29
+ "servez-lib": "^2.6.0"
30
30
  },
31
31
  "bin": {
32
32
  "servez": "./bin/servez"