@rpcbase/server 0.226.0 → 0.228.0
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/cli/check_args.js +8 -1
- package/package.json +1 -1
- package/src/client/client_router.js +10 -11
package/cli/check_args.js
CHANGED
|
@@ -5,7 +5,14 @@ const check_args = (args) => {
|
|
|
5
5
|
throw new Error("Did you mean --sessions?")
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const {npm_config_argv} = process.env
|
|
9
|
+
|
|
10
|
+
if (!npm_config_argv) {
|
|
11
|
+
console.warn("no npm_config_argv skipping arg check")
|
|
12
|
+
return
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const raw_args = JSON.parse().original
|
|
9
16
|
if (raw_args.indexOf("--no-session") > -1) {
|
|
10
17
|
throw new Error("Did you mean --no-sessions?")
|
|
11
18
|
}
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@ const COMPRESSED_EXTENSIONS_MAP = {
|
|
|
17
17
|
const {SENTRY_DSN, NODE_ENV} = process.env
|
|
18
18
|
const has_sentry = !!SENTRY_DSN
|
|
19
19
|
|
|
20
|
-
const is_development =
|
|
20
|
+
const is_development = NODE_ENV === "development"
|
|
21
21
|
// do not serve compression in dev, the assets are only compressed in the github action
|
|
22
22
|
const COMPRESSED_EXTENSIONS = is_development ? [] : Object.keys(COMPRESSED_EXTENSIONS_MAP)
|
|
23
23
|
|
|
@@ -46,18 +46,17 @@ const serve_file = (req, res, full_path) => {
|
|
|
46
46
|
|
|
47
47
|
if (has_compression) {
|
|
48
48
|
const accept_encoding = req.headers["accept-encoding"]
|
|
49
|
-
// TODO: WARNING! brotli is tmp disabled due to slow compression time
|
|
50
49
|
// brotli
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
if (accept_encoding.indexOf("br") > -1) {
|
|
51
|
+
res.sendFile(`${file_path}.br`, {
|
|
52
|
+
headers: {
|
|
53
|
+
"Content-Encoding": "br",
|
|
54
|
+
"Content-Type": COMPRESSED_EXTENSIONS_MAP[extname],
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
}
|
|
59
58
|
// gzip
|
|
60
|
-
|
|
59
|
+
else if (!is_development && accept_encoding.indexOf("gzip") > -1) {
|
|
61
60
|
res.sendFile(`${file_path}.gz`, {
|
|
62
61
|
headers: {
|
|
63
62
|
"Content-Encoding": "gzip",
|