@modern-js/plugin-express 1.7.2 → 1.7.3-beta.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/dist/js/modern/plugin.js +12 -3
- package/dist/js/node/plugin.js +12 -3
- package/package.json +3 -2
package/dist/js/modern/plugin.js
CHANGED
|
@@ -15,11 +15,11 @@ const findAppModule = async apiDir => {
|
|
|
15
15
|
if (await fs.pathExists(filename)) {
|
|
16
16
|
// 每次获取 app.ts 的时候,避免使用缓存的 app.ts
|
|
17
17
|
delete require.cache[filename];
|
|
18
|
-
return compatRequire(filename);
|
|
18
|
+
return [compatRequire(filename), require(filename)];
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
return
|
|
22
|
+
return [];
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
const initMiddlewares = (middleware, app) => {
|
|
@@ -63,7 +63,9 @@ export default (() => ({
|
|
|
63
63
|
const apiHandlerInfos = appContext.apiHandlerInfos;
|
|
64
64
|
|
|
65
65
|
if (mode === 'framework') {
|
|
66
|
-
|
|
66
|
+
const appModule = await findAppModule(apiDir);
|
|
67
|
+
app = appModule[0];
|
|
68
|
+
const hooks = appModule[1];
|
|
67
69
|
|
|
68
70
|
if (!app || !app.use) {
|
|
69
71
|
// console.warn('There is not api/app.ts.');
|
|
@@ -81,6 +83,13 @@ export default (() => ({
|
|
|
81
83
|
|
|
82
84
|
useRun(app);
|
|
83
85
|
registerRoutes(app, apiHandlerInfos);
|
|
86
|
+
const {
|
|
87
|
+
afterLambdaRegisted
|
|
88
|
+
} = hooks;
|
|
89
|
+
|
|
90
|
+
if (afterLambdaRegisted) {
|
|
91
|
+
afterLambdaRegisted(app);
|
|
92
|
+
}
|
|
84
93
|
} else if (mode === 'function') {
|
|
85
94
|
app = express();
|
|
86
95
|
initApp(app);
|
package/dist/js/node/plugin.js
CHANGED
|
@@ -35,11 +35,11 @@ const findAppModule = async apiDir => {
|
|
|
35
35
|
if (await _utils.fs.pathExists(filename)) {
|
|
36
36
|
// 每次获取 app.ts 的时候,避免使用缓存的 app.ts
|
|
37
37
|
delete require.cache[filename];
|
|
38
|
-
return (0, _utils.compatRequire)(filename);
|
|
38
|
+
return [(0, _utils.compatRequire)(filename), require(filename)];
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
return
|
|
42
|
+
return [];
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
const initMiddlewares = (middleware, app) => {
|
|
@@ -83,7 +83,9 @@ var _default = () => ({
|
|
|
83
83
|
const apiHandlerInfos = appContext.apiHandlerInfos;
|
|
84
84
|
|
|
85
85
|
if (mode === 'framework') {
|
|
86
|
-
|
|
86
|
+
const appModule = await findAppModule(apiDir);
|
|
87
|
+
app = appModule[0];
|
|
88
|
+
const hooks = appModule[1];
|
|
87
89
|
|
|
88
90
|
if (!app || !app.use) {
|
|
89
91
|
// console.warn('There is not api/app.ts.');
|
|
@@ -101,6 +103,13 @@ var _default = () => ({
|
|
|
101
103
|
|
|
102
104
|
useRun(app);
|
|
103
105
|
(0, _registerRoutes.default)(app, apiHandlerInfos);
|
|
106
|
+
const {
|
|
107
|
+
afterLambdaRegisted
|
|
108
|
+
} = hooks;
|
|
109
|
+
|
|
110
|
+
if (afterLambdaRegisted) {
|
|
111
|
+
afterLambdaRegisted(app);
|
|
112
|
+
}
|
|
104
113
|
} else if (mode === 'function') {
|
|
105
114
|
app = (0, _express.default)();
|
|
106
115
|
initApp(app);
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.7.
|
|
14
|
+
"version": "1.7.3-beta.0",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -74,7 +74,8 @@
|
|
|
74
74
|
},
|
|
75
75
|
"publishConfig": {
|
|
76
76
|
"registry": "https://registry.npmjs.org/",
|
|
77
|
-
"access": "public"
|
|
77
|
+
"access": "public",
|
|
78
|
+
"types": "./dist/types/index.d.ts"
|
|
78
79
|
},
|
|
79
80
|
"wireit": {
|
|
80
81
|
"build": {
|