@camstack/server 1.0.3 → 1.0.4
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/main.js +10 -0
- package/package.json +3 -2
package/dist/main.js
CHANGED
|
@@ -40,6 +40,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
40
40
|
const fastify_1 = require("@trpc/server/adapters/fastify");
|
|
41
41
|
const ws_1 = require("@trpc/server/adapters/ws");
|
|
42
42
|
const static_1 = __importDefault(require("@fastify/static"));
|
|
43
|
+
const compress_1 = __importDefault(require("@fastify/compress"));
|
|
43
44
|
const cookie_1 = __importDefault(require("@fastify/cookie"));
|
|
44
45
|
const ws_2 = require("ws");
|
|
45
46
|
const fs = __importStar(require("node:fs"));
|
|
@@ -192,6 +193,11 @@ async function bootstrap() {
|
|
|
192
193
|
app.enableCors();
|
|
193
194
|
const fastify = app.getHttpAdapter().getInstance();
|
|
194
195
|
await fastify.register(cookie_1.default);
|
|
196
|
+
// Gzip/Brotli compression for all responses (including static JS/CSS).
|
|
197
|
+
// Registered before @fastify/static so the compress plugin wraps the
|
|
198
|
+
// static send path — hashed admin-ui chunks go from ~2MB to ~600KB on
|
|
199
|
+
// the wire. threshold:1024 skips compression for tiny payloads.
|
|
200
|
+
await fastify.register(compress_1.default, { global: true, threshold: 1024 });
|
|
195
201
|
// Data-plane POST bodies: the addon reverse-proxy (`proxyToUpstream`) pipes
|
|
196
202
|
// `request.raw` upstream, but Fastify's default application/json parser would
|
|
197
203
|
// drain it first, so a POST body would reach the addon empty. Register a
|
|
@@ -931,6 +937,10 @@ async function bootstrap() {
|
|
|
931
937
|
root: staticDir,
|
|
932
938
|
serve: false,
|
|
933
939
|
decorateReply: true,
|
|
940
|
+
// Disable @fastify/static's automatic Cache-Control injection so
|
|
941
|
+
// the per-file headers set by the route handler (immutable for
|
|
942
|
+
// hashed assets, no-cache for index.html / SW) survive sendFile().
|
|
943
|
+
cacheControl: false,
|
|
934
944
|
});
|
|
935
945
|
// Dev diagnostic: serve webrtc-test.html from dataPath if it exists.
|
|
936
946
|
const webrtcTestPath = path.join(dataPath, 'webrtc-test.html');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -27,11 +27,12 @@
|
|
|
27
27
|
"@camstack/addon-pipeline": "*",
|
|
28
28
|
"@camstack/addon-pipeline-orchestrator": "*",
|
|
29
29
|
"@camstack/addon-post-analysis": "*",
|
|
30
|
-
"@camstack/system": "*",
|
|
31
30
|
"@camstack/sdk": "*",
|
|
32
31
|
"@camstack/shm-ring": "*",
|
|
32
|
+
"@camstack/system": "*",
|
|
33
33
|
"@camstack/types": "*",
|
|
34
34
|
"@camstack/ui-library": "*",
|
|
35
|
+
"@fastify/compress": "^9.0.0",
|
|
35
36
|
"@fastify/cookie": "^11.0.2",
|
|
36
37
|
"@fastify/multipart": "^10.0.0",
|
|
37
38
|
"@fastify/static": "^9.1.3",
|