@celljs/express-adapter 3.7.8 → 3.9.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/esm/node/context.d.ts +3 -0
- package/esm/node/context.js +4 -0
- package/esm/node/context.js.map +1 -0
- package/esm/node/http-application-entry.d.ts +1 -0
- package/esm/node/http-application-entry.js +28 -0
- package/esm/node/http-application-entry.js.map +1 -0
- package/esm/node/index.d.ts +1 -0
- package/esm/node/index.js +2 -0
- package/esm/node/index.js.map +1 -0
- package/esm/node/module.d.ts +2 -0
- package/esm/node/module.js +3 -0
- package/esm/node/module.js.map +1 -0
- package/esm/package.json +3 -0
- package/lib/node/context.d.ts.map +1 -1
- package/lib/node/http-application-entry.js +5 -2
- package/lib/node/http-application-entry.js.map +1 -1
- package/lib/node/module.d.ts.map +1 -1
- package/lib/node/module.js.map +1 -1
- package/lib/package.spec.d.ts +1 -0
- package/lib/package.spec.js +5 -2
- package/lib/package.spec.js.map +1 -1
- package/package.json +32 -12
- package/src/node/http-application-entry.ts +1 -1
- package/src/package.spec.ts +1 -0
- package/LICENSE +0 -21
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/node/context.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG;IAClC,IAAI,EAAE,IAAI;CACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { container } from '@celljs/core/lib/common/container/dynamic-container';
|
|
2
|
+
import { Application } from '@celljs/core/lib/common/application/application-protocol';
|
|
3
|
+
import { ContainerProvider } from '@celljs/core/lib/common/container/container-provider';
|
|
4
|
+
import { Dispatcher } from '@celljs/web/lib/node/dispatcher/dispatcher-protocol';
|
|
5
|
+
import { Context } from '@celljs/web/lib/node/context';
|
|
6
|
+
import { ServerAware } from '@celljs/web/lib/node/http';
|
|
7
|
+
import { ConfigProvider } from '@celljs/core/lib/common/config/config-protocol';
|
|
8
|
+
import express from 'express';
|
|
9
|
+
import { DEFAULT_SERVER_OPTIONS } from './context.js';
|
|
10
|
+
container.then(async (c) => {
|
|
11
|
+
ContainerProvider.set(c);
|
|
12
|
+
await c.get(Application).start();
|
|
13
|
+
const configProvider = c.get(ConfigProvider);
|
|
14
|
+
const port = parseInt(process.env.SERVER__PORT || '') || configProvider.get('cell.server', DEFAULT_SERVER_OPTIONS).port;
|
|
15
|
+
const app = express();
|
|
16
|
+
app.all('*', async (req, res) => {
|
|
17
|
+
const dispatcher = c.get(Dispatcher);
|
|
18
|
+
const httpContext = new Context(req, res);
|
|
19
|
+
Context.run(() => dispatcher.dispatch(httpContext));
|
|
20
|
+
});
|
|
21
|
+
const server = app.listen(port, process.env.SERVER__HOST || '127.0.0.1');
|
|
22
|
+
const items = c.getAll(ServerAware);
|
|
23
|
+
for (const serverAware of items) {
|
|
24
|
+
await serverAware.setServer(server);
|
|
25
|
+
}
|
|
26
|
+
console.log(`serve ${port}`);
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=http-application-entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-application-entry.js","sourceRoot":"","sources":["../../src/node/http-application-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qDAAqD,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,0DAA0D,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sDAAsD,CAAC;AACzF,OAAO,EAAE,UAAU,EAAE,MAAM,qDAAqD,CAAC;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAEhF,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,sBAAs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@@
|
|
|
1
|
+
export * from './context.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/node/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,eAAe,QAAQ,EAAE,CAAC"}
|
package/esm/package.json
ADDED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/node/context.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/node/context.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB;IAC/B,IAAI;CACP,CAAC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
const dynamic_container_1 = require("@celljs/core/lib/common/container/dynamic-container");
|
|
4
7
|
const application_protocol_1 = require("@celljs/core/lib/common/application/application-protocol");
|
|
@@ -7,14 +10,14 @@ const dispatcher_protocol_1 = require("@celljs/web/lib/node/dispatcher/dispatche
|
|
|
7
10
|
const context_1 = require("@celljs/web/lib/node/context");
|
|
8
11
|
const http_1 = require("@celljs/web/lib/node/http");
|
|
9
12
|
const config_protocol_1 = require("@celljs/core/lib/common/config/config-protocol");
|
|
10
|
-
const
|
|
13
|
+
const express_1 = __importDefault(require("express"));
|
|
11
14
|
const context_2 = require("./context");
|
|
12
15
|
dynamic_container_1.container.then(async (c) => {
|
|
13
16
|
container_provider_1.ContainerProvider.set(c);
|
|
14
17
|
await c.get(application_protocol_1.Application).start();
|
|
15
18
|
const configProvider = c.get(config_protocol_1.ConfigProvider);
|
|
16
19
|
const port = parseInt(process.env.SERVER__PORT || '') || configProvider.get('cell.server', context_2.DEFAULT_SERVER_OPTIONS).port;
|
|
17
|
-
const app =
|
|
20
|
+
const app = (0, express_1.default)();
|
|
18
21
|
app.all('*', async (req, res) => {
|
|
19
22
|
const dispatcher = c.get(dispatcher_protocol_1.Dispatcher);
|
|
20
23
|
const httpContext = new context_1.Context(req, res);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-application-entry.js","sourceRoot":"","sources":["../../src/node/http-application-entry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http-application-entry.js","sourceRoot":"","sources":["../../src/node/http-application-entry.ts"],"names":[],"mappings":";;;;;AAAA,2FAAgF;AAChF,mGAAuF;AACvF,6FAAyF;AACzF,6FAAiF;AACjF,0DAAuD;AACvD,oDAAwD;AACxD,oFAAgF;AAEhF,sDAA8B;AAC9B,uCAAmD;AAEnD,6BAAS,CAAC,IAAI,CAAC,KAAK,EAAC,CAAC,EAAC,EAAE;IACrB,sCAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACzB,MAAM,CAAC,CAAC,GAAG,CAAc,kCAAW,CAAC,CAAC,KAAK,EAAE,CAAC;IAC9C,MAAM,cAAc,GAAG,CAAC,CAAC,GAAG,CAAiB,gCAAc,CAAC,CAAC;IAC7D,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,EAAE,CAAC,IAAI,cAAc,CAAC,GAAG,CAAM,aAAa,EAAE,gCAAsB,CAAC,CAAC,IAAI,CAAC;IAC7H,MAAM,GAAG,GAAG,IAAA,iBAAO,GAAE,CAAC;IACtB,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,GAAQ,EAAE,GAAQ,EAAE,EAAE;QACtC,MAAM,UAAU,GAAG,CAAC,CAAC,GAAG,CAAsB,gCAAU,CAAC,CAAC;QAC1D,MAAM,WAAW,GAAG,IAAI,iBAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAC1C,iBAAO,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,WAAW,CAAC,CAAC;IACzE,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAc,kBAAW,CAAC,CAAC;IACjD,KAAK,MAAM,WAAW,IAAI,KAAK,EAAE,CAAC;QAC9B,MAAM,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;AACjC,CAAC,CAAC,CAAC"}
|
package/lib/node/module.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/node/module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/node/module.ts"],"names":[],"mappings":""}
|
package/lib/node/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/node/module.ts"],"names":[],"mappings":";;AAAA,uCAAwC;
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/node/module.ts"],"names":[],"mappings":";;AAAA,uCAAwC;kBAEzB,IAAA,eAAQ,GAAE"}
|
package/lib/package.spec.d.ts
CHANGED
package/lib/package.spec.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const bun_test_1 = require("bun:test");
|
|
4
|
+
(0, bun_test_1.describe)('express adapter package', () => {
|
|
5
|
+
(0, bun_test_1.it)('support code coverage statistics', () => { });
|
|
3
6
|
});
|
|
4
7
|
//# sourceMappingURL=package.spec.js.map
|
package/lib/package.spec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.spec.js","sourceRoot":"","sources":["../src/package.spec.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"package.spec.js","sourceRoot":"","sources":["../src/package.spec.ts"],"names":[],"mappings":";;AAAA,uCAAwC;AACxC,IAAA,mBAAQ,EAAC,yBAAyB,EAAE,GAAG,EAAE;IAErC,IAAA,aAAE,EAAC,kCAAkC,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;AACrD,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/express-adapter",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cell-component"
|
|
@@ -18,27 +18,47 @@
|
|
|
18
18
|
"typings": "lib/node/index.d.ts",
|
|
19
19
|
"files": [
|
|
20
20
|
"lib",
|
|
21
|
+
"esm",
|
|
21
22
|
"src",
|
|
22
23
|
"cell.yml"
|
|
23
24
|
],
|
|
24
25
|
"scripts": {
|
|
25
|
-
"build": "
|
|
26
|
-
"clean": "
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"watch": "cell-component watch"
|
|
26
|
+
"build": "tsc -b && bun ../../scripts/build-esm.ts",
|
|
27
|
+
"clean": "rm -rf lib esm *.tsbuildinfo",
|
|
28
|
+
"test": "bun test --preload reflect-metadata ./lib",
|
|
29
|
+
"watch": "tsc -b -w --preserveWatchOutput"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@celljs/core": "3.
|
|
33
|
-
"@celljs/web": "3.
|
|
32
|
+
"@celljs/core": "3.9.0",
|
|
33
|
+
"@celljs/web": "3.9.0",
|
|
34
34
|
"express": "^4.17.1",
|
|
35
35
|
"tslib": "^2.8.0"
|
|
36
36
|
},
|
|
37
|
-
"devDependencies": {
|
|
38
|
-
"@celljs/component": "3.7.8"
|
|
39
|
-
},
|
|
40
37
|
"publishConfig": {
|
|
41
38
|
"access": "public"
|
|
42
39
|
},
|
|
43
|
-
"
|
|
40
|
+
"exports": {
|
|
41
|
+
".": {
|
|
42
|
+
"webpack": "./lib/node/index.js",
|
|
43
|
+
"import": "./esm/node/index.js",
|
|
44
|
+
"default": "./lib/node/index.js"
|
|
45
|
+
},
|
|
46
|
+
"./package.json": "./package.json",
|
|
47
|
+
"./lib/node": {
|
|
48
|
+
"webpack": "./lib/node/index.js",
|
|
49
|
+
"import": "./esm/node/index.js",
|
|
50
|
+
"default": "./lib/node/index.js"
|
|
51
|
+
},
|
|
52
|
+
"./lib/*.js": {
|
|
53
|
+
"webpack": "./lib/*.js",
|
|
54
|
+
"import": "./esm/*.js",
|
|
55
|
+
"default": "./lib/*.js"
|
|
56
|
+
},
|
|
57
|
+
"./lib/*": {
|
|
58
|
+
"webpack": "./lib/*.js",
|
|
59
|
+
"import": "./esm/*.js",
|
|
60
|
+
"default": "./lib/*.js"
|
|
61
|
+
},
|
|
62
|
+
"./*": "./*"
|
|
63
|
+
}
|
|
44
64
|
}
|
|
@@ -6,7 +6,7 @@ import { Context } from '@celljs/web/lib/node/context';
|
|
|
6
6
|
import { ServerAware } from '@celljs/web/lib/node/http';
|
|
7
7
|
import { ConfigProvider } from '@celljs/core/lib/common/config/config-protocol';
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import express from 'express';
|
|
10
10
|
import { DEFAULT_SERVER_OPTIONS } from './context';
|
|
11
11
|
|
|
12
12
|
container.then(async c => {
|
package/src/package.spec.ts
CHANGED
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2019 Cellbang
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|