@modern-js/plugin-express 2.15.0 → 2.17.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/CHANGELOG.md +27 -0
- package/dist/cjs/cli/index.js +62 -62
- package/dist/cjs/context.js +13 -26
- package/dist/cjs/index.js +28 -37
- package/dist/cjs/plugin.js +178 -155
- package/dist/cjs/registerRoutes.js +11 -27
- package/dist/cjs/runtime/hook.js +7 -25
- package/dist/cjs/runtime/index.js +30 -31
- package/dist/cjs/runtime/operators.js +15 -28
- package/dist/cjs/utils.js +36 -54
- package/dist/esm/cli/index.js +41 -55
- package/dist/esm/index.js +1 -2
- package/dist/esm/plugin.js +385 -376
- package/dist/esm/registerRoutes.js +12 -13
- package/dist/esm/runtime/hook.js +2 -3
- package/dist/esm/runtime/index.js +2 -3
- package/dist/esm/runtime/operators.js +196 -187
- package/dist/esm/utils.js +541 -515
- package/dist/esm-node/cli/index.js +9 -26
- package/dist/esm-node/context.js +1 -4
- package/dist/esm-node/index.js +1 -4
- package/dist/esm-node/plugin.js +108 -107
- package/dist/esm-node/registerRoutes.js +1 -4
- package/dist/esm-node/runtime/hook.js +1 -4
- package/dist/esm-node/runtime/index.js +2 -6
- package/dist/esm-node/runtime/operators.js +2 -6
- package/dist/esm-node/utils.js +4 -8
- package/dist/types/runtime/operators.d.ts +1 -1
- package/package.json +18 -11
|
@@ -1,30 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var registerRoutes_exports = {};
|
|
19
|
-
__export(registerRoutes_exports, {
|
|
20
|
-
default: () => registerRoutes_default
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: () => _default
|
|
21
8
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var import_utils = require("./utils");
|
|
9
|
+
require("reflect-metadata");
|
|
10
|
+
const _utils = require("./utils");
|
|
25
11
|
const registerRoutes = (app, handlerInfos) => {
|
|
26
12
|
handlerInfos.forEach(({ routePath, handler, httpMethod }) => {
|
|
27
|
-
const routeHandler = (0,
|
|
13
|
+
const routeHandler = (0, _utils.createRouteHandler)(handler);
|
|
28
14
|
const method = httpMethod.toLowerCase();
|
|
29
15
|
const routeMiddlwares = Reflect.getMetadata("middleware", handler) || [];
|
|
30
16
|
if (routeMiddlwares.length > 0) {
|
|
@@ -34,6 +20,4 @@ const registerRoutes = (app, handlerInfos) => {
|
|
|
34
20
|
}
|
|
35
21
|
});
|
|
36
22
|
};
|
|
37
|
-
|
|
38
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
-
0 && (module.exports = {});
|
|
23
|
+
const _default = registerRoutes;
|
package/dist/cjs/runtime/hook.js
CHANGED
|
@@ -1,27 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var hook_exports = {};
|
|
19
|
-
__export(hook_exports, {
|
|
20
|
-
hook: () => hook
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
21
4
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
0 && (module.exports = {
|
|
26
|
-
hook
|
|
5
|
+
Object.defineProperty(exports, "hook", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: () => hook
|
|
27
8
|
});
|
|
9
|
+
const hook = (attacher) => attacher;
|
|
@@ -1,33 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var runtime_exports = {};
|
|
20
|
-
__export(runtime_exports, {
|
|
21
|
-
hook: () => import_hook.hook,
|
|
22
|
-
useContext: () => import_context.useContext
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
23
4
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
useContext
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
useContext: () => _context.useContext,
|
|
14
|
+
hook: () => _hook.hook
|
|
33
15
|
});
|
|
16
|
+
_export_star(require("@modern-js/bff-core"), exports);
|
|
17
|
+
const _context = require("../context");
|
|
18
|
+
const _hook = require("./hook");
|
|
19
|
+
_export_star(require("./operators"), exports);
|
|
20
|
+
function _export_star(from, to) {
|
|
21
|
+
Object.keys(from).forEach(function(k) {
|
|
22
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
23
|
+
Object.defineProperty(to, k, {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function() {
|
|
26
|
+
return from[k];
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
return from;
|
|
32
|
+
}
|
|
@@ -1,34 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
6
|
for (var name in all)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var operators_exports = {};
|
|
19
|
-
__export(operators_exports, {
|
|
20
|
-
Middleware: () => Middleware,
|
|
21
|
-
Pipe: () => Pipe
|
|
7
|
+
Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
Pipe: () => Pipe,
|
|
14
|
+
Middleware: () => Middleware
|
|
22
15
|
});
|
|
23
|
-
|
|
24
|
-
var import_context = require("../context");
|
|
16
|
+
const _context = require("../context");
|
|
25
17
|
const Pipe = (func) => {
|
|
26
18
|
return {
|
|
27
19
|
name: "pipe",
|
|
28
20
|
// eslint-disable-next-line consistent-return
|
|
29
21
|
async execute(executeHelper, next) {
|
|
30
22
|
const { inputs } = executeHelper;
|
|
31
|
-
const ctx = (0,
|
|
23
|
+
const ctx = (0, _context.useContext)();
|
|
32
24
|
const { res } = ctx;
|
|
33
25
|
if (typeof func === "function") {
|
|
34
26
|
let isPiped = true;
|
|
@@ -64,8 +56,3 @@ const Middleware = (middleware) => {
|
|
|
64
56
|
}
|
|
65
57
|
};
|
|
66
58
|
};
|
|
67
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
68
|
-
0 && (module.exports = {
|
|
69
|
-
Middleware,
|
|
70
|
-
Pipe
|
|
71
|
-
});
|
package/dist/cjs/utils.js
CHANGED
|
@@ -1,57 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
8
6
|
for (var name in all)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var utils_exports = {};
|
|
29
|
-
__export(utils_exports, {
|
|
7
|
+
Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
30
13
|
createRouteHandler: () => createRouteHandler,
|
|
31
14
|
isNormalMethod: () => isNormalMethod
|
|
32
15
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
16
|
+
require("reflect-metadata");
|
|
17
|
+
const _bffcore = require("@modern-js/bff-core");
|
|
18
|
+
const _bffruntime = require("@modern-js/bff-runtime");
|
|
19
|
+
const _typeis = /* @__PURE__ */ _interop_require_default(require("type-is"));
|
|
20
|
+
const _formidable = /* @__PURE__ */ _interop_require_default(require("formidable"));
|
|
21
|
+
function _interop_require_default(obj) {
|
|
22
|
+
return obj && obj.__esModule ? obj : {
|
|
23
|
+
default: obj
|
|
24
|
+
};
|
|
25
|
+
}
|
|
39
26
|
const handleResponseMeta = (res, handler) => {
|
|
40
|
-
const responseMeta = Reflect.getMetadata(
|
|
27
|
+
const responseMeta = Reflect.getMetadata(_bffcore.HttpMetadata.Response, handler);
|
|
41
28
|
if (Array.isArray(responseMeta)) {
|
|
42
29
|
for (const meta of responseMeta) {
|
|
43
30
|
const metaType = meta.type;
|
|
44
31
|
const metaValue = meta.value;
|
|
45
32
|
switch (metaType) {
|
|
46
|
-
case
|
|
33
|
+
case _bffcore.ResponseMetaType.Headers:
|
|
47
34
|
for (const [key, value] of Object.entries(metaValue)) {
|
|
48
35
|
res.append(key, value);
|
|
49
36
|
}
|
|
50
37
|
break;
|
|
51
|
-
case
|
|
38
|
+
case _bffcore.ResponseMetaType.Redirect:
|
|
52
39
|
res.redirect(metaValue);
|
|
53
40
|
break;
|
|
54
|
-
case
|
|
41
|
+
case _bffcore.ResponseMetaType.StatusCode:
|
|
55
42
|
res.status(metaValue);
|
|
56
43
|
break;
|
|
57
44
|
default:
|
|
@@ -62,9 +49,8 @@ const handleResponseMeta = (res, handler) => {
|
|
|
62
49
|
};
|
|
63
50
|
const createRouteHandler = (handler) => {
|
|
64
51
|
const apiHandler = async (req, res, next) => {
|
|
65
|
-
var _a;
|
|
66
52
|
const input = await getInputFromRequest(req);
|
|
67
|
-
if ((0,
|
|
53
|
+
if ((0, _bffcore.isWithMetaHandler)(handler)) {
|
|
68
54
|
try {
|
|
69
55
|
handleResponseMeta(res, handler);
|
|
70
56
|
if (res.headersSent) {
|
|
@@ -75,7 +61,7 @@ const createRouteHandler = (handler) => {
|
|
|
75
61
|
return res.json(result);
|
|
76
62
|
}
|
|
77
63
|
} catch (error) {
|
|
78
|
-
if (error instanceof
|
|
64
|
+
if (error instanceof _bffcore.ValidationError) {
|
|
79
65
|
res.status(error.status);
|
|
80
66
|
return res.json({
|
|
81
67
|
message: error.message
|
|
@@ -83,7 +69,7 @@ const createRouteHandler = (handler) => {
|
|
|
83
69
|
}
|
|
84
70
|
throw error;
|
|
85
71
|
}
|
|
86
|
-
} else if ((0,
|
|
72
|
+
} else if ((0, _bffruntime.isSchemaHandler)(handler)) {
|
|
87
73
|
const result = await handler(input);
|
|
88
74
|
if (result.type !== "HandleSuccess") {
|
|
89
75
|
if (result.type === "InputValidationError") {
|
|
@@ -96,9 +82,10 @@ const createRouteHandler = (handler) => {
|
|
|
96
82
|
res.status(200);
|
|
97
83
|
return res.json(result.value);
|
|
98
84
|
}
|
|
99
|
-
} else if ((0,
|
|
85
|
+
} else if ((0, _bffcore.isInputParamsDeciderHandler)(handler)) {
|
|
100
86
|
try {
|
|
101
|
-
|
|
87
|
+
var _input_data;
|
|
88
|
+
const args = (input === null || input === void 0 ? void 0 : (_input_data = input.data) === null || _input_data === void 0 ? void 0 : _input_data.args) || [];
|
|
102
89
|
const body = await handler(...args);
|
|
103
90
|
if (typeof body !== "undefined") {
|
|
104
91
|
if (typeof body === "object") {
|
|
@@ -127,7 +114,7 @@ const createRouteHandler = (handler) => {
|
|
|
127
114
|
Object.defineProperties(apiHandler, Object.getOwnPropertyDescriptors(handler));
|
|
128
115
|
return apiHandler;
|
|
129
116
|
};
|
|
130
|
-
const isNormalMethod = (httpMethod) =>
|
|
117
|
+
const isNormalMethod = (httpMethod) => _bffcore.httpMethods.includes(httpMethod);
|
|
131
118
|
const getInputFromRequest = async (request) => {
|
|
132
119
|
const draft = {
|
|
133
120
|
params: request.params,
|
|
@@ -135,15 +122,15 @@ const getInputFromRequest = async (request) => {
|
|
|
135
122
|
headers: request.headers,
|
|
136
123
|
cookies: request.headers.cookie
|
|
137
124
|
};
|
|
138
|
-
if ((0,
|
|
125
|
+
if ((0, _typeis.default)(request, [
|
|
139
126
|
"application/json"
|
|
140
127
|
])) {
|
|
141
128
|
draft.data = request.body;
|
|
142
|
-
} else if ((0,
|
|
129
|
+
} else if ((0, _typeis.default)(request, [
|
|
143
130
|
"multipart/form-data"
|
|
144
131
|
])) {
|
|
145
132
|
draft.formData = await resolveFormData(request);
|
|
146
|
-
} else if ((0,
|
|
133
|
+
} else if ((0, _typeis.default)(request, [
|
|
147
134
|
"application/x-www-form-urlencoded"
|
|
148
135
|
])) {
|
|
149
136
|
draft.formUrlencoded = request.body;
|
|
@@ -153,7 +140,7 @@ const getInputFromRequest = async (request) => {
|
|
|
153
140
|
return draft;
|
|
154
141
|
};
|
|
155
142
|
const resolveFormData = (request) => {
|
|
156
|
-
const form = (0,
|
|
143
|
+
const form = (0, _formidable.default)({
|
|
157
144
|
multiples: true
|
|
158
145
|
});
|
|
159
146
|
return new Promise((resolve, reject) => {
|
|
@@ -168,8 +155,3 @@ const resolveFormData = (request) => {
|
|
|
168
155
|
});
|
|
169
156
|
});
|
|
170
157
|
};
|
|
171
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
172
|
-
0 && (module.exports = {
|
|
173
|
-
createRouteHandler,
|
|
174
|
-
isNormalMethod
|
|
175
|
-
});
|
package/dist/esm/cli/index.js
CHANGED
|
@@ -1,58 +1,44 @@
|
|
|
1
1
|
import * as path from "path";
|
|
2
2
|
import { createRuntimeExportsUtils } from "@modern-js/utils";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
var plugins = param.plugins;
|
|
40
|
-
plugins.push({
|
|
41
|
-
"@modern-js/plugin-express": "@modern-js/plugin-express/server"
|
|
42
|
-
});
|
|
43
|
-
return {
|
|
44
|
-
plugins: plugins
|
|
45
|
-
};
|
|
46
|
-
},
|
|
47
|
-
addRuntimeExports: function addRuntimeExports(input) {
|
|
48
|
-
var currentFile = bffExportsUtils.getPath();
|
|
49
|
-
var relativeRuntimeModulePath = path.relative(path.dirname(currentFile), runtimeModulePath);
|
|
50
|
-
var relativeFramePath = path.relative(path.dirname(currentFile), require.resolve("express"));
|
|
51
|
-
bffExportsUtils.addExport("const pluginRuntime = require('".concat(relativeRuntimeModulePath, "');\n const express = require('").concat(relativeFramePath, "')\n module.exports = {\n express: express,\n ...pluginRuntime\n }\n "));
|
|
52
|
-
return input;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
3
|
+
export default function() {
|
|
4
|
+
return {
|
|
5
|
+
name: "@modern-js/plugin-express",
|
|
6
|
+
setup: function(api) {
|
|
7
|
+
var bffExportsUtils;
|
|
8
|
+
var useAppContext = api.useAppContext;
|
|
9
|
+
var runtimeModulePath = path.resolve(__dirname, "../runtime");
|
|
10
|
+
return {
|
|
11
|
+
config: function config() {
|
|
12
|
+
var appContext = useAppContext();
|
|
13
|
+
bffExportsUtils = createRuntimeExportsUtils(appContext.internalDirectory, "server");
|
|
14
|
+
var runtimePath = process.env.NODE_ENV === "development" ? require.resolve("@modern-js/plugin-express/runtime") : "@modern-js/plugin-express/runtime";
|
|
15
|
+
return {
|
|
16
|
+
source: {
|
|
17
|
+
alias: {
|
|
18
|
+
"@modern-js/runtime/server": runtimePath,
|
|
19
|
+
"@modern-js/runtime/express": runtimePath
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
collectServerPlugins: function collectServerPlugins(param) {
|
|
25
|
+
var plugins = param.plugins;
|
|
26
|
+
plugins.push({
|
|
27
|
+
"@modern-js/plugin-express": "@modern-js/plugin-express/server"
|
|
28
|
+
});
|
|
29
|
+
return {
|
|
30
|
+
plugins
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
addRuntimeExports: function addRuntimeExports(input) {
|
|
34
|
+
var currentFile = bffExportsUtils.getPath();
|
|
35
|
+
var relativeRuntimeModulePath = path.relative(path.dirname(currentFile), runtimeModulePath);
|
|
36
|
+
var relativeFramePath = path.relative(path.dirname(currentFile), require.resolve("express"));
|
|
37
|
+
bffExportsUtils.addExport("const pluginRuntime = require('".concat(relativeRuntimeModulePath, "');\n const express = require('").concat(relativeFramePath, "')\n module.exports = {\n express: express,\n ...pluginRuntime\n }\n "));
|
|
38
|
+
return input;
|
|
55
39
|
}
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
;
|
package/dist/esm/index.js
CHANGED