@lwrjs/server 0.11.0-alpha.2 → 0.11.0-alpha.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/build/cjs/express/express-server.cjs +0 -4
- package/build/cjs/fs/fs-server.cjs +0 -2
- package/build/cjs/koa/koa-server.cjs +0 -4
- package/build/es/express/express-server.d.ts +0 -1
- package/build/es/express/express-server.js +0 -4
- package/build/es/fs/fs-server.d.ts +0 -1
- package/build/es/fs/fs-server.js +0 -3
- package/build/es/koa/koa-server.d.ts +0 -1
- package/build/es/koa/koa-server.js +0 -4
- package/package.json +5 -13
- package/build/cjs/common/compression.cjs +0 -45
- package/build/es/common/compression.d.ts +0 -3
- package/build/es/common/compression.js +0 -25
|
@@ -28,7 +28,6 @@ __export(exports, {
|
|
|
28
28
|
});
|
|
29
29
|
var import_express = __toModule(require("express"));
|
|
30
30
|
var import_http = __toModule(require("http"));
|
|
31
|
-
var import_compression = __toModule(require("../common/compression.cjs"));
|
|
32
31
|
var import_abstract_internal_app_server = __toModule(require("../common/abstract-internal-app-server.cjs"));
|
|
33
32
|
var import_express_request = __toModule(require("./express-request.cjs"));
|
|
34
33
|
var import_express_response = __toModule(require("./express-response.cjs"));
|
|
@@ -85,9 +84,6 @@ var ExpressInternalServer = class extends import_abstract_internal_app_server.de
|
|
|
85
84
|
await middleware(lwrReq, lwrRes, next);
|
|
86
85
|
});
|
|
87
86
|
}
|
|
88
|
-
useCompression() {
|
|
89
|
-
this.expressApp.use((0, import_compression.default)());
|
|
90
|
-
}
|
|
91
87
|
getRegexWildcard() {
|
|
92
88
|
return "*";
|
|
93
89
|
}
|
|
@@ -97,8 +97,6 @@ var FsInternalServer = class extends import_abstract_internal_app_server.default
|
|
|
97
97
|
this.middlewares.push(this.koaRouter.routes());
|
|
98
98
|
this.lwrFsKoaApp.setMiddlewares(this.middlewares);
|
|
99
99
|
}
|
|
100
|
-
useCompression() {
|
|
101
|
-
}
|
|
102
100
|
getImpl() {
|
|
103
101
|
return this.lwrFsKoaApp;
|
|
104
102
|
}
|
|
@@ -29,7 +29,6 @@ __export(exports, {
|
|
|
29
29
|
var import_koa = __toModule(require("koa"));
|
|
30
30
|
var import_router = __toModule(require("@koa/router"));
|
|
31
31
|
var import_http = __toModule(require("http"));
|
|
32
|
-
var import_koa_compress = __toModule(require("koa-compress"));
|
|
33
32
|
var import_abstract_internal_app_server = __toModule(require("../common/abstract-internal-app-server.cjs"));
|
|
34
33
|
var import_koa_request = __toModule(require("./koa-request.cjs"));
|
|
35
34
|
var import_koa_response = __toModule(require("./koa-response.cjs"));
|
|
@@ -78,9 +77,6 @@ var KoaInternalServer = class extends import_abstract_internal_app_server.defaul
|
|
|
78
77
|
await middleware(lwrReq, lwrRes, next);
|
|
79
78
|
});
|
|
80
79
|
}
|
|
81
|
-
useCompression() {
|
|
82
|
-
this.koaApp.use((0, import_koa_compress.default)());
|
|
83
|
-
}
|
|
84
80
|
getRegexWildcard() {
|
|
85
81
|
return "(.*)";
|
|
86
82
|
}
|
|
@@ -17,7 +17,6 @@ export default class ExpressInternalServer extends AbstractInternalAppServer imp
|
|
|
17
17
|
all(path: string | Array<string>, middleware: MiddlewareFunction): void;
|
|
18
18
|
get(path: string | Array<string>, middleware: MiddlewareFunction): void;
|
|
19
19
|
post(path: string | Array<string>, middleware: MiddlewareFunction): void;
|
|
20
|
-
useCompression(): void;
|
|
21
20
|
getRegexWildcard(): string;
|
|
22
21
|
initRoutes(): void;
|
|
23
22
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
2
|
import http from 'http';
|
|
3
|
-
import compression from '../common/compression.js';
|
|
4
3
|
import AbstractInternalAppServer from '../common/abstract-internal-app-server.js';
|
|
5
4
|
import ExpressRequest from './express-request.js';
|
|
6
5
|
import ExpressResponse from './express-response.js';
|
|
@@ -61,9 +60,6 @@ export default class ExpressInternalServer extends AbstractInternalAppServer {
|
|
|
61
60
|
await middleware(lwrReq, lwrRes, next);
|
|
62
61
|
});
|
|
63
62
|
}
|
|
64
|
-
useCompression() {
|
|
65
|
-
this.expressApp.use(compression());
|
|
66
|
-
}
|
|
67
63
|
getRegexWildcard() {
|
|
68
64
|
return '*';
|
|
69
65
|
}
|
|
@@ -26,7 +26,6 @@ export declare class FsInternalServer extends AbstractInternalAppServer implemen
|
|
|
26
26
|
get(path: string | string[], middleware: MiddlewareFunction): void;
|
|
27
27
|
post(path: string | string[], middleware: MiddlewareFunction): void;
|
|
28
28
|
initRoutes(): void;
|
|
29
|
-
useCompression(): void;
|
|
30
29
|
getImpl(): LwrFsKoa;
|
|
31
30
|
getRegexWildcard(): string;
|
|
32
31
|
}
|
package/build/es/fs/fs-server.js
CHANGED
|
@@ -72,9 +72,6 @@ export class FsInternalServer extends AbstractInternalAppServer {
|
|
|
72
72
|
this.middlewares.push(this.koaRouter.routes());
|
|
73
73
|
this.lwrFsKoaApp.setMiddlewares(this.middlewares);
|
|
74
74
|
}
|
|
75
|
-
useCompression() {
|
|
76
|
-
/* noop */
|
|
77
|
-
}
|
|
78
75
|
getImpl() {
|
|
79
76
|
return this.lwrFsKoaApp;
|
|
80
77
|
}
|
|
@@ -17,7 +17,6 @@ export default class KoaInternalServer extends AbstractInternalAppServer impleme
|
|
|
17
17
|
all(path: string | string[], middleware: MiddlewareFunction): void;
|
|
18
18
|
get(path: string | string[], middleware: MiddlewareFunction): void;
|
|
19
19
|
post(path: string | string[], middleware: MiddlewareFunction): void;
|
|
20
|
-
useCompression(): void;
|
|
21
20
|
getRegexWildcard(): string;
|
|
22
21
|
initRoutes(): void;
|
|
23
22
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import Koa from 'koa';
|
|
2
2
|
import KoaRouter from '@koa/router';
|
|
3
3
|
import http from 'http';
|
|
4
|
-
import compress from 'koa-compress';
|
|
5
4
|
import AbstractInternalAppServer from '../common/abstract-internal-app-server.js';
|
|
6
5
|
import KoaRequest from './koa-request.js';
|
|
7
6
|
import KoaResponse from './koa-response.js';
|
|
@@ -53,9 +52,6 @@ export default class KoaInternalServer extends AbstractInternalAppServer {
|
|
|
53
52
|
await middleware(lwrReq, lwrRes, next);
|
|
54
53
|
});
|
|
55
54
|
}
|
|
56
|
-
useCompression() {
|
|
57
|
-
this.koaApp.use(compress());
|
|
58
|
-
}
|
|
59
55
|
getRegexWildcard() {
|
|
60
56
|
return '(.*)';
|
|
61
57
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.11.0-alpha.
|
|
7
|
+
"version": "0.11.0-alpha.4",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -34,30 +34,22 @@
|
|
|
34
34
|
"build/**/*.d.ts"
|
|
35
35
|
],
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@lwrjs/types": "0.11.0-alpha.
|
|
37
|
+
"@lwrjs/types": "0.11.0-alpha.4",
|
|
38
38
|
"@types/koa-compress": "^4.0.1",
|
|
39
39
|
"@types/koa__router": "^8.0.4",
|
|
40
40
|
"jest-express": "^1.12.0"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@koa/router": "^10.0.0",
|
|
44
|
-
"@lwrjs/shared-utils": "0.11.0-alpha.
|
|
45
|
-
"@types/compression": "^1.7.2",
|
|
44
|
+
"@lwrjs/shared-utils": "0.11.0-alpha.4",
|
|
46
45
|
"@types/express": "^4.17.17",
|
|
47
46
|
"@types/koa": "^2.11.7",
|
|
48
|
-
"compression": "^1.7.4",
|
|
49
47
|
"express": "^4.18.2",
|
|
50
48
|
"koa": "^2.13.1",
|
|
51
|
-
"koa-compose": "^4.1.0"
|
|
52
|
-
"koa-compress": "^5.0.1"
|
|
53
|
-
},
|
|
54
|
-
"optionalDependencies": {
|
|
55
|
-
"iltorb": "^2.4.5",
|
|
56
|
-
"node-zopfli-es": "^2.0.1",
|
|
57
|
-
"shrink-ray-current": "^4.1.3"
|
|
49
|
+
"koa-compose": "^4.1.0"
|
|
58
50
|
},
|
|
59
51
|
"engines": {
|
|
60
52
|
"node": ">=16.0.0"
|
|
61
53
|
},
|
|
62
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "89a7e9815e0e381d9fd67212f0471d9a11f73985"
|
|
63
55
|
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, {get: all[name], enumerable: true});
|
|
11
|
-
};
|
|
12
|
-
var __exportStar = (target, module2, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
16
|
-
__defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toModule = (module2) => {
|
|
21
|
-
return __exportStar(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? {get: () => module2.default, enumerable: true} : {value: module2, enumerable: true})), module2);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
// packages/@lwrjs/server/src/common/compression.ts
|
|
25
|
-
__markAsModule(exports);
|
|
26
|
-
__export(exports, {
|
|
27
|
-
default: () => compression_default
|
|
28
|
-
});
|
|
29
|
-
var import_compression = __toModule(require("compression"));
|
|
30
|
-
var compressionLibToUse;
|
|
31
|
-
var compression = async (req, res, next) => {
|
|
32
|
-
if (compressionLibToUse === void 0) {
|
|
33
|
-
try {
|
|
34
|
-
let shrinkRay = await Promise.resolve().then(() => __toModule(require("shrink-ray-current")));
|
|
35
|
-
shrinkRay = shrinkRay.default || shrinkRay;
|
|
36
|
-
compressionLibToUse = shrinkRay({useZopfliForGzip: false});
|
|
37
|
-
} catch (err) {
|
|
38
|
-
compressionLibToUse = (0, import_compression.default)();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
compressionLibToUse(req, res, next);
|
|
42
|
-
};
|
|
43
|
-
function compression_default() {
|
|
44
|
-
return compression;
|
|
45
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import expressCompression from 'compression';
|
|
2
|
-
let compressionLibToUse;
|
|
3
|
-
const compression = async (req, res, next) => {
|
|
4
|
-
if (compressionLibToUse === undefined) {
|
|
5
|
-
// TODO: Unfortunately the compression story for express is a mess.
|
|
6
|
-
// shrink-ray-current is a fork of compression with brotlli support, we will use it until the
|
|
7
|
-
// "official" one accepts a PR to support it: https://github.com/expressjs/compression/issues/71
|
|
8
|
-
// Since it has some native dependencies (node-zopfli-es, iltorb) that may fail to compile in
|
|
9
|
-
// certain environments, we make it an optional dependency and fall back to vanilla compression.
|
|
10
|
-
try {
|
|
11
|
-
let shrinkRay = await import('shrink-ray-current');
|
|
12
|
-
shrinkRay = shrinkRay.default || shrinkRay;
|
|
13
|
-
compressionLibToUse = shrinkRay({ useZopfliForGzip: false });
|
|
14
|
-
}
|
|
15
|
-
catch (err) {
|
|
16
|
-
compressionLibToUse = expressCompression();
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
20
|
-
compressionLibToUse(req, res, next);
|
|
21
|
-
};
|
|
22
|
-
export default function () {
|
|
23
|
-
return compression;
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=compression.js.map
|