@modern-js/plugin-bff 2.0.0-beta.0 → 2.0.0-beta.1
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 +32 -0
- package/dist/js/modern/cli.js +3 -14
- package/dist/js/modern/helper.js +0 -2
- package/dist/js/modern/loader.js +6 -14
- package/dist/js/modern/server.js +0 -15
- package/dist/js/node/cli.js +3 -30
- package/dist/js/node/helper.js +0 -7
- package/dist/js/node/index.js +0 -2
- package/dist/js/node/loader.js +6 -18
- package/dist/js/node/server.js +0 -25
- package/dist/js/treeshaking/cli.js +9 -27
- package/dist/js/treeshaking/helper.js +0 -3
- package/dist/js/treeshaking/loader.js +2 -18
- package/dist/js/treeshaking/server.js +3 -12
- package/dist/types/cli.d.ts +0 -2
- package/dist/types/server.d.ts +0 -2
- package/package.json +14 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @modern-js/plugin-bff
|
|
2
2
|
|
|
3
|
+
## 2.0.0-beta.1
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- dda38c9: chore: v2
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 8ff2cf4c71: fix: bff api loader should run before babel loader
|
|
12
|
+
fix: bff 一体化调用的 loader 应该在 babel loader 前执行
|
|
13
|
+
- Updated dependencies [9b915e0c10]
|
|
14
|
+
- Updated dependencies [2344eb2]
|
|
15
|
+
- Updated dependencies [a2509bfbdb]
|
|
16
|
+
- Updated dependencies [92f0ead]
|
|
17
|
+
- Updated dependencies [edd1cfb1af]
|
|
18
|
+
- Updated dependencies [cc971eabfc]
|
|
19
|
+
- Updated dependencies [5b9049f]
|
|
20
|
+
- Updated dependencies [a8642da]
|
|
21
|
+
- Updated dependencies [92004d1]
|
|
22
|
+
- Updated dependencies [b8bbe036c7]
|
|
23
|
+
- Updated dependencies [d5a31df781]
|
|
24
|
+
- Updated dependencies [dda38c9]
|
|
25
|
+
- Updated dependencies [3bbea92b2a]
|
|
26
|
+
- Updated dependencies [abf3421]
|
|
27
|
+
- Updated dependencies [543be9558e]
|
|
28
|
+
- Updated dependencies [14b712d]
|
|
29
|
+
- @modern-js/server-utils@2.0.0-beta.1
|
|
30
|
+
- @modern-js/bff-core@2.0.0-beta.1
|
|
31
|
+
- @modern-js/utils@2.0.0-beta.1
|
|
32
|
+
- @modern-js/create-request@2.0.0-beta.1
|
|
33
|
+
- @modern-js/babel-compiler@2.0.0-beta.1
|
|
34
|
+
|
|
3
35
|
## 2.0.0-beta.0
|
|
4
36
|
|
|
5
37
|
### Major Changes
|
package/dist/js/modern/cli.js
CHANGED
|
@@ -13,7 +13,6 @@ export default (() => ({
|
|
|
13
13
|
validateSchema() {
|
|
14
14
|
return PLUGIN_SCHEMAS['@modern-js/plugin-bff'];
|
|
15
15
|
},
|
|
16
|
-
|
|
17
16
|
config() {
|
|
18
17
|
return {
|
|
19
18
|
tools: {
|
|
@@ -60,7 +59,6 @@ export default (() => ({
|
|
|
60
59
|
}
|
|
61
60
|
};
|
|
62
61
|
},
|
|
63
|
-
|
|
64
62
|
modifyServerRoutes({
|
|
65
63
|
routes
|
|
66
64
|
}) {
|
|
@@ -70,26 +68,24 @@ export default (() => ({
|
|
|
70
68
|
} = modernConfig || {};
|
|
71
69
|
const prefix = (bff === null || bff === void 0 ? void 0 : bff.prefix) || '/api';
|
|
72
70
|
const prefixList = [];
|
|
73
|
-
|
|
74
71
|
if (Array.isArray(prefix)) {
|
|
75
72
|
prefixList.push(...prefix);
|
|
76
73
|
} else {
|
|
77
74
|
prefixList.push(prefix);
|
|
78
75
|
}
|
|
79
|
-
|
|
80
76
|
const apiServerRoutes = prefixList.map(pre => ({
|
|
81
77
|
urlPath: pre,
|
|
82
78
|
isApi: true,
|
|
83
79
|
entryPath: '',
|
|
84
80
|
isSPA: false,
|
|
85
|
-
isSSR: false
|
|
86
|
-
|
|
81
|
+
isSSR: false
|
|
82
|
+
// FIXME: })) as IAppContext[`serverRoutes`];
|
|
87
83
|
}));
|
|
84
|
+
|
|
88
85
|
return {
|
|
89
86
|
routes: routes.concat(apiServerRoutes)
|
|
90
87
|
};
|
|
91
88
|
},
|
|
92
|
-
|
|
93
89
|
async beforeBuild() {
|
|
94
90
|
// help esbuild-register resolve @modern-js/server/runtime
|
|
95
91
|
if (isProd()) {
|
|
@@ -99,12 +95,10 @@ export default (() => ({
|
|
|
99
95
|
unRegisterResolveRuntimePath = registerModernRuntimePath(internalDirectory);
|
|
100
96
|
}
|
|
101
97
|
},
|
|
102
|
-
|
|
103
98
|
async afterBuild() {
|
|
104
99
|
if (unRegisterResolveRuntimePath) {
|
|
105
100
|
unRegisterResolveRuntimePath();
|
|
106
101
|
}
|
|
107
|
-
|
|
108
102
|
const {
|
|
109
103
|
appDirectory,
|
|
110
104
|
distDirectory
|
|
@@ -115,15 +109,12 @@ export default (() => ({
|
|
|
115
109
|
const sharedDir = path.resolve(appDirectory, SHARED_DIR);
|
|
116
110
|
const tsconfigPath = path.resolve(appDirectory, TS_CONFIG_FILENAME);
|
|
117
111
|
const sourceDirs = [];
|
|
118
|
-
|
|
119
112
|
if (fs.existsSync(apiDir)) {
|
|
120
113
|
sourceDirs.push(apiDir);
|
|
121
114
|
}
|
|
122
|
-
|
|
123
115
|
if (fs.existsSync(sharedDir)) {
|
|
124
116
|
sourceDirs.push(sharedDir);
|
|
125
117
|
}
|
|
126
|
-
|
|
127
118
|
const {
|
|
128
119
|
server
|
|
129
120
|
} = modernConfig;
|
|
@@ -135,7 +126,6 @@ export default (() => ({
|
|
|
135
126
|
const {
|
|
136
127
|
babel
|
|
137
128
|
} = modernConfig.tools;
|
|
138
|
-
|
|
139
129
|
if (sourceDirs.length > 0) {
|
|
140
130
|
await compile(appDirectory, {
|
|
141
131
|
server,
|
|
@@ -150,7 +140,6 @@ export default (() => ({
|
|
|
150
140
|
});
|
|
151
141
|
}
|
|
152
142
|
}
|
|
153
|
-
|
|
154
143
|
};
|
|
155
144
|
}
|
|
156
145
|
}));
|
package/dist/js/modern/helper.js
CHANGED
|
@@ -2,7 +2,6 @@ import * as path from 'path';
|
|
|
2
2
|
import { registerPaths } from '@modern-js/bff-core';
|
|
3
3
|
const serverRuntimeAlias = '@modern-js/runtime/server';
|
|
4
4
|
const serverRuntimePath = '.runtime-exports/server';
|
|
5
|
-
|
|
6
5
|
const registerModernRuntimePath = internalDirectory => {
|
|
7
6
|
const paths = {
|
|
8
7
|
[serverRuntimeAlias]: path.join(internalDirectory, serverRuntimePath)
|
|
@@ -10,5 +9,4 @@ const registerModernRuntimePath = internalDirectory => {
|
|
|
10
9
|
const unRegister = registerPaths(paths);
|
|
11
10
|
return unRegister;
|
|
12
11
|
};
|
|
13
|
-
|
|
14
12
|
export { registerModernRuntimePath };
|
package/dist/js/modern/loader.js
CHANGED
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
import { generateClient } from '@modern-js/bff-core';
|
|
2
2
|
import { logger } from '@modern-js/utils';
|
|
3
|
-
|
|
4
3
|
async function loader(source) {
|
|
5
4
|
// eslint-disable-next-line @babel/no-invalid-this
|
|
6
|
-
this.cacheable();
|
|
7
|
-
|
|
8
|
-
const callback = this.async();
|
|
9
|
-
|
|
10
|
-
const draftOptions = this.getOptions();
|
|
5
|
+
this.cacheable();
|
|
6
|
+
// eslint-disable-next-line @babel/no-invalid-this
|
|
7
|
+
const callback = this.async();
|
|
8
|
+
// eslint-disable-next-line @babel/no-invalid-this
|
|
9
|
+
const draftOptions = this.getOptions();
|
|
11
10
|
|
|
11
|
+
// eslint-disable-next-line @babel/no-invalid-this
|
|
12
12
|
const {
|
|
13
13
|
resourcePath
|
|
14
14
|
} = this;
|
|
15
15
|
const warning = `The file ${resourcePath} is not allowd to be imported in src directory, only API definition files are allowed.`;
|
|
16
|
-
|
|
17
16
|
if (!draftOptions.existLambda) {
|
|
18
17
|
logger.warn(warning);
|
|
19
18
|
callback(null, `throw new Error('${warning}')`);
|
|
20
19
|
return;
|
|
21
20
|
}
|
|
22
|
-
|
|
23
21
|
const options = {
|
|
24
22
|
prefix: Array.isArray(draftOptions.prefix) ? draftOptions.prefix[0] : draftOptions.prefix,
|
|
25
23
|
apiDir: draftOptions.apiDir,
|
|
@@ -31,29 +29,23 @@ async function loader(source) {
|
|
|
31
29
|
const {
|
|
32
30
|
lambdaDir
|
|
33
31
|
} = draftOptions;
|
|
34
|
-
|
|
35
32
|
if (!resourcePath.startsWith(lambdaDir)) {
|
|
36
33
|
logger.warn(warning);
|
|
37
34
|
callback(null, `throw new Error('${warning}')`);
|
|
38
35
|
return;
|
|
39
36
|
}
|
|
40
|
-
|
|
41
37
|
if (draftOptions.fetcher) {
|
|
42
38
|
options.fetcher = draftOptions.fetcher;
|
|
43
39
|
}
|
|
44
|
-
|
|
45
40
|
if (draftOptions.requestCreator) {
|
|
46
41
|
options.requestCreator = draftOptions.requestCreator;
|
|
47
42
|
}
|
|
48
|
-
|
|
49
43
|
options.requireResolve = require.resolve;
|
|
50
44
|
const result = await generateClient(options);
|
|
51
|
-
|
|
52
45
|
if (result.isOk) {
|
|
53
46
|
callback(undefined, result.value);
|
|
54
47
|
} else {
|
|
55
48
|
callback(undefined, `throw new Error('${result.value}')`);
|
|
56
49
|
}
|
|
57
50
|
}
|
|
58
|
-
|
|
59
51
|
export default loader;
|
package/dist/js/modern/server.js
CHANGED
|
@@ -1,32 +1,23 @@
|
|
|
1
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
-
|
|
3
2
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
|
|
5
3
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
|
|
7
4
|
import path from 'path';
|
|
8
5
|
import { ApiRouter } from '@modern-js/bff-core';
|
|
9
6
|
import { API_DIR, isProd, requireExistModule } from '@modern-js/utils';
|
|
10
7
|
import { API_APP_NAME } from "./constants";
|
|
11
|
-
|
|
12
8
|
class Storage {
|
|
13
9
|
constructor() {
|
|
14
10
|
_defineProperty(this, "middlewares", []);
|
|
15
11
|
}
|
|
16
|
-
|
|
17
12
|
reset() {
|
|
18
13
|
this.middlewares = [];
|
|
19
14
|
}
|
|
20
|
-
|
|
21
15
|
}
|
|
22
|
-
|
|
23
16
|
const createTransformAPI = storage => ({
|
|
24
17
|
addMiddleware(fn) {
|
|
25
18
|
storage.middlewares.push(fn);
|
|
26
19
|
}
|
|
27
|
-
|
|
28
20
|
});
|
|
29
|
-
|
|
30
21
|
export default (() => ({
|
|
31
22
|
name: '@modern-js/plugin-bff',
|
|
32
23
|
setup: api => {
|
|
@@ -43,21 +34,17 @@ export default (() => ({
|
|
|
43
34
|
const apiPath = path.resolve(root || process.cwd(), API_DIR);
|
|
44
35
|
apiAppPath = path.resolve(apiPath, API_APP_NAME);
|
|
45
36
|
const apiMod = requireExistModule(apiAppPath);
|
|
46
|
-
|
|
47
37
|
if (apiMod && typeof apiMod === 'function') {
|
|
48
38
|
apiMod(transformAPI);
|
|
49
39
|
}
|
|
50
40
|
},
|
|
51
|
-
|
|
52
41
|
reset() {
|
|
53
42
|
storage.reset();
|
|
54
43
|
const newApiModule = requireExistModule(apiAppPath);
|
|
55
|
-
|
|
56
44
|
if (newApiModule && typeof newApiModule === 'function') {
|
|
57
45
|
newApiModule(transformAPI);
|
|
58
46
|
}
|
|
59
47
|
},
|
|
60
|
-
|
|
61
48
|
gather({
|
|
62
49
|
addAPIMiddleware
|
|
63
50
|
}) {
|
|
@@ -65,7 +52,6 @@ export default (() => ({
|
|
|
65
52
|
addAPIMiddleware(mid);
|
|
66
53
|
});
|
|
67
54
|
},
|
|
68
|
-
|
|
69
55
|
prepareApiServer(props, next) {
|
|
70
56
|
const {
|
|
71
57
|
pwd,
|
|
@@ -86,7 +72,6 @@ export default (() => ({
|
|
|
86
72
|
}));
|
|
87
73
|
return next(props);
|
|
88
74
|
}
|
|
89
|
-
|
|
90
75
|
};
|
|
91
76
|
}
|
|
92
77
|
}));
|
package/dist/js/node/cli.js
CHANGED
|
@@ -4,22 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _path = _interopRequireDefault(require("path"));
|
|
9
|
-
|
|
10
8
|
var _utils = require("@modern-js/utils");
|
|
11
|
-
|
|
12
9
|
var _serverUtils = require("@modern-js/server-utils");
|
|
13
|
-
|
|
14
10
|
var _bffCore = require("@modern-js/bff-core");
|
|
15
|
-
|
|
16
11
|
var _helper = require("./helper");
|
|
17
|
-
|
|
18
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
13
|
const DEFAULT_API_PREFIX = '/api';
|
|
21
14
|
const TS_CONFIG_FILENAME = 'tsconfig.json';
|
|
22
|
-
|
|
23
15
|
var _default = () => ({
|
|
24
16
|
name: '@modern-js/plugin-bff',
|
|
25
17
|
setup: api => {
|
|
@@ -28,7 +20,6 @@ var _default = () => ({
|
|
|
28
20
|
validateSchema() {
|
|
29
21
|
return _utils.PLUGIN_SCHEMAS['@modern-js/plugin-bff'];
|
|
30
22
|
},
|
|
31
|
-
|
|
32
23
|
config() {
|
|
33
24
|
return {
|
|
34
25
|
tools: {
|
|
@@ -48,9 +39,7 @@ var _default = () => ({
|
|
|
48
39
|
fetcher
|
|
49
40
|
} = bff || {};
|
|
50
41
|
const prefix = (bff === null || bff === void 0 ? void 0 : bff.prefix) || DEFAULT_API_PREFIX;
|
|
51
|
-
|
|
52
42
|
const rootDir = _path.default.resolve(appDirectory, _utils.API_DIR);
|
|
53
|
-
|
|
54
43
|
chain.resolve.alias.set('@api', rootDir);
|
|
55
44
|
const apiRouter = new _bffCore.ApiRouter({
|
|
56
45
|
apiDir: rootDir,
|
|
@@ -77,7 +66,6 @@ var _default = () => ({
|
|
|
77
66
|
}
|
|
78
67
|
};
|
|
79
68
|
},
|
|
80
|
-
|
|
81
69
|
modifyServerRoutes({
|
|
82
70
|
routes
|
|
83
71
|
}) {
|
|
@@ -87,26 +75,24 @@ var _default = () => ({
|
|
|
87
75
|
} = modernConfig || {};
|
|
88
76
|
const prefix = (bff === null || bff === void 0 ? void 0 : bff.prefix) || '/api';
|
|
89
77
|
const prefixList = [];
|
|
90
|
-
|
|
91
78
|
if (Array.isArray(prefix)) {
|
|
92
79
|
prefixList.push(...prefix);
|
|
93
80
|
} else {
|
|
94
81
|
prefixList.push(prefix);
|
|
95
82
|
}
|
|
96
|
-
|
|
97
83
|
const apiServerRoutes = prefixList.map(pre => ({
|
|
98
84
|
urlPath: pre,
|
|
99
85
|
isApi: true,
|
|
100
86
|
entryPath: '',
|
|
101
87
|
isSPA: false,
|
|
102
|
-
isSSR: false
|
|
103
|
-
|
|
88
|
+
isSSR: false
|
|
89
|
+
// FIXME: })) as IAppContext[`serverRoutes`];
|
|
104
90
|
}));
|
|
91
|
+
|
|
105
92
|
return {
|
|
106
93
|
routes: routes.concat(apiServerRoutes)
|
|
107
94
|
};
|
|
108
95
|
},
|
|
109
|
-
|
|
110
96
|
async beforeBuild() {
|
|
111
97
|
// help esbuild-register resolve @modern-js/server/runtime
|
|
112
98
|
if ((0, _utils.isProd)()) {
|
|
@@ -116,36 +102,26 @@ var _default = () => ({
|
|
|
116
102
|
unRegisterResolveRuntimePath = (0, _helper.registerModernRuntimePath)(internalDirectory);
|
|
117
103
|
}
|
|
118
104
|
},
|
|
119
|
-
|
|
120
105
|
async afterBuild() {
|
|
121
106
|
if (unRegisterResolveRuntimePath) {
|
|
122
107
|
unRegisterResolveRuntimePath();
|
|
123
108
|
}
|
|
124
|
-
|
|
125
109
|
const {
|
|
126
110
|
appDirectory,
|
|
127
111
|
distDirectory
|
|
128
112
|
} = api.useAppContext();
|
|
129
113
|
const modernConfig = api.useResolvedConfigContext();
|
|
130
|
-
|
|
131
114
|
const distDir = _path.default.resolve(distDirectory);
|
|
132
|
-
|
|
133
115
|
const apiDir = _path.default.resolve(appDirectory, _utils.API_DIR);
|
|
134
|
-
|
|
135
116
|
const sharedDir = _path.default.resolve(appDirectory, _utils.SHARED_DIR);
|
|
136
|
-
|
|
137
117
|
const tsconfigPath = _path.default.resolve(appDirectory, TS_CONFIG_FILENAME);
|
|
138
|
-
|
|
139
118
|
const sourceDirs = [];
|
|
140
|
-
|
|
141
119
|
if (_utils.fs.existsSync(apiDir)) {
|
|
142
120
|
sourceDirs.push(apiDir);
|
|
143
121
|
}
|
|
144
|
-
|
|
145
122
|
if (_utils.fs.existsSync(sharedDir)) {
|
|
146
123
|
sourceDirs.push(sharedDir);
|
|
147
124
|
}
|
|
148
|
-
|
|
149
125
|
const {
|
|
150
126
|
server
|
|
151
127
|
} = modernConfig;
|
|
@@ -157,7 +133,6 @@ var _default = () => ({
|
|
|
157
133
|
const {
|
|
158
134
|
babel
|
|
159
135
|
} = modernConfig.tools;
|
|
160
|
-
|
|
161
136
|
if (sourceDirs.length > 0) {
|
|
162
137
|
await (0, _serverUtils.compile)(appDirectory, {
|
|
163
138
|
server,
|
|
@@ -172,9 +147,7 @@ var _default = () => ({
|
|
|
172
147
|
});
|
|
173
148
|
}
|
|
174
149
|
}
|
|
175
|
-
|
|
176
150
|
};
|
|
177
151
|
}
|
|
178
152
|
});
|
|
179
|
-
|
|
180
153
|
exports.default = _default;
|
package/dist/js/node/helper.js
CHANGED
|
@@ -4,18 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.registerModernRuntimePath = void 0;
|
|
7
|
-
|
|
8
7
|
var path = _interopRequireWildcard(require("path"));
|
|
9
|
-
|
|
10
8
|
var _bffCore = require("@modern-js/bff-core");
|
|
11
|
-
|
|
12
9
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
|
|
14
10
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
-
|
|
16
11
|
const serverRuntimeAlias = '@modern-js/runtime/server';
|
|
17
12
|
const serverRuntimePath = '.runtime-exports/server';
|
|
18
|
-
|
|
19
13
|
const registerModernRuntimePath = internalDirectory => {
|
|
20
14
|
const paths = {
|
|
21
15
|
[serverRuntimeAlias]: path.join(internalDirectory, serverRuntimePath)
|
|
@@ -23,5 +17,4 @@ const registerModernRuntimePath = internalDirectory => {
|
|
|
23
17
|
const unRegister = (0, _bffCore.registerPaths)(paths);
|
|
24
18
|
return unRegister;
|
|
25
19
|
};
|
|
26
|
-
|
|
27
20
|
exports.registerModernRuntimePath = registerModernRuntimePath;
|
package/dist/js/node/index.js
CHANGED
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
6
|
var _constants = require("./constants");
|
|
8
|
-
|
|
9
7
|
Object.keys(_constants).forEach(function (key) {
|
|
10
8
|
if (key === "default" || key === "__esModule") return;
|
|
11
9
|
if (key in exports && exports[key] === _constants[key]) return;
|
package/dist/js/node/loader.js
CHANGED
|
@@ -4,31 +4,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _bffCore = require("@modern-js/bff-core");
|
|
9
|
-
|
|
10
8
|
var _utils = require("@modern-js/utils");
|
|
11
|
-
|
|
12
9
|
async function loader(source) {
|
|
13
10
|
// eslint-disable-next-line @babel/no-invalid-this
|
|
14
|
-
this.cacheable();
|
|
15
|
-
|
|
16
|
-
const callback = this.async();
|
|
17
|
-
|
|
18
|
-
const draftOptions = this.getOptions();
|
|
11
|
+
this.cacheable();
|
|
12
|
+
// eslint-disable-next-line @babel/no-invalid-this
|
|
13
|
+
const callback = this.async();
|
|
14
|
+
// eslint-disable-next-line @babel/no-invalid-this
|
|
15
|
+
const draftOptions = this.getOptions();
|
|
19
16
|
|
|
17
|
+
// eslint-disable-next-line @babel/no-invalid-this
|
|
20
18
|
const {
|
|
21
19
|
resourcePath
|
|
22
20
|
} = this;
|
|
23
21
|
const warning = `The file ${resourcePath} is not allowd to be imported in src directory, only API definition files are allowed.`;
|
|
24
|
-
|
|
25
22
|
if (!draftOptions.existLambda) {
|
|
26
23
|
_utils.logger.warn(warning);
|
|
27
|
-
|
|
28
24
|
callback(null, `throw new Error('${warning}')`);
|
|
29
25
|
return;
|
|
30
26
|
}
|
|
31
|
-
|
|
32
27
|
const options = {
|
|
33
28
|
prefix: Array.isArray(draftOptions.prefix) ? draftOptions.prefix[0] : draftOptions.prefix,
|
|
34
29
|
apiDir: draftOptions.apiDir,
|
|
@@ -40,31 +35,24 @@ async function loader(source) {
|
|
|
40
35
|
const {
|
|
41
36
|
lambdaDir
|
|
42
37
|
} = draftOptions;
|
|
43
|
-
|
|
44
38
|
if (!resourcePath.startsWith(lambdaDir)) {
|
|
45
39
|
_utils.logger.warn(warning);
|
|
46
|
-
|
|
47
40
|
callback(null, `throw new Error('${warning}')`);
|
|
48
41
|
return;
|
|
49
42
|
}
|
|
50
|
-
|
|
51
43
|
if (draftOptions.fetcher) {
|
|
52
44
|
options.fetcher = draftOptions.fetcher;
|
|
53
45
|
}
|
|
54
|
-
|
|
55
46
|
if (draftOptions.requestCreator) {
|
|
56
47
|
options.requestCreator = draftOptions.requestCreator;
|
|
57
48
|
}
|
|
58
|
-
|
|
59
49
|
options.requireResolve = require.resolve;
|
|
60
50
|
const result = await (0, _bffCore.generateClient)(options);
|
|
61
|
-
|
|
62
51
|
if (result.isOk) {
|
|
63
52
|
callback(undefined, result.value);
|
|
64
53
|
} else {
|
|
65
54
|
callback(undefined, `throw new Error('${result.value}')`);
|
|
66
55
|
}
|
|
67
56
|
}
|
|
68
|
-
|
|
69
57
|
var _default = loader;
|
|
70
58
|
exports.default = _default;
|
package/dist/js/node/server.js
CHANGED
|
@@ -4,41 +4,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _path = _interopRequireDefault(require("path"));
|
|
9
|
-
|
|
10
8
|
var _bffCore = require("@modern-js/bff-core");
|
|
11
|
-
|
|
12
9
|
var _utils = require("@modern-js/utils");
|
|
13
|
-
|
|
14
10
|
var _constants = require("./constants");
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
12
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
-
|
|
20
13
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
-
|
|
22
14
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
-
|
|
24
15
|
class Storage {
|
|
25
16
|
constructor() {
|
|
26
17
|
_defineProperty(this, "middlewares", []);
|
|
27
18
|
}
|
|
28
|
-
|
|
29
19
|
reset() {
|
|
30
20
|
this.middlewares = [];
|
|
31
21
|
}
|
|
32
|
-
|
|
33
22
|
}
|
|
34
|
-
|
|
35
23
|
const createTransformAPI = storage => ({
|
|
36
24
|
addMiddleware(fn) {
|
|
37
25
|
storage.middlewares.push(fn);
|
|
38
26
|
}
|
|
39
|
-
|
|
40
27
|
});
|
|
41
|
-
|
|
42
28
|
var _default = () => ({
|
|
43
29
|
name: '@modern-js/plugin-bff',
|
|
44
30
|
setup: api => {
|
|
@@ -52,26 +38,20 @@ var _default = () => ({
|
|
|
52
38
|
distDirectory
|
|
53
39
|
} = api.useAppContext();
|
|
54
40
|
const root = (0, _utils.isProd)() ? distDirectory : appDirectory;
|
|
55
|
-
|
|
56
41
|
const apiPath = _path.default.resolve(root || process.cwd(), _utils.API_DIR);
|
|
57
|
-
|
|
58
42
|
apiAppPath = _path.default.resolve(apiPath, _constants.API_APP_NAME);
|
|
59
43
|
const apiMod = (0, _utils.requireExistModule)(apiAppPath);
|
|
60
|
-
|
|
61
44
|
if (apiMod && typeof apiMod === 'function') {
|
|
62
45
|
apiMod(transformAPI);
|
|
63
46
|
}
|
|
64
47
|
},
|
|
65
|
-
|
|
66
48
|
reset() {
|
|
67
49
|
storage.reset();
|
|
68
50
|
const newApiModule = (0, _utils.requireExistModule)(apiAppPath);
|
|
69
|
-
|
|
70
51
|
if (newApiModule && typeof newApiModule === 'function') {
|
|
71
52
|
newApiModule(transformAPI);
|
|
72
53
|
}
|
|
73
54
|
},
|
|
74
|
-
|
|
75
55
|
gather({
|
|
76
56
|
addAPIMiddleware
|
|
77
57
|
}) {
|
|
@@ -79,15 +59,12 @@ var _default = () => ({
|
|
|
79
59
|
addAPIMiddleware(mid);
|
|
80
60
|
});
|
|
81
61
|
},
|
|
82
|
-
|
|
83
62
|
prepareApiServer(props, next) {
|
|
84
63
|
const {
|
|
85
64
|
pwd,
|
|
86
65
|
prefix
|
|
87
66
|
} = props;
|
|
88
|
-
|
|
89
67
|
const apiDir = _path.default.resolve(pwd, _utils.API_DIR);
|
|
90
|
-
|
|
91
68
|
const appContext = api.useAppContext();
|
|
92
69
|
const apiRouter = new _bffCore.ApiRouter({
|
|
93
70
|
apiDir,
|
|
@@ -102,9 +79,7 @@ var _default = () => ({
|
|
|
102
79
|
}));
|
|
103
80
|
return next(props);
|
|
104
81
|
}
|
|
105
|
-
|
|
106
82
|
};
|
|
107
83
|
}
|
|
108
84
|
});
|
|
109
|
-
|
|
110
85
|
exports.default = _default;
|
|
@@ -22,20 +22,15 @@ export default (function () {
|
|
|
22
22
|
tools: {
|
|
23
23
|
webpackChain: function webpackChain(chain, _ref) {
|
|
24
24
|
var name = _ref.name,
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
CHAIN_ID = _ref.CHAIN_ID;
|
|
27
26
|
var _api$useAppContext = api.useAppContext(),
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
appDirectory = _api$useAppContext.appDirectory,
|
|
28
|
+
port = _api$useAppContext.port;
|
|
31
29
|
var modernConfig = api.useResolvedConfigContext();
|
|
32
|
-
|
|
33
30
|
var _ref2 = modernConfig || {},
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
bff = _ref2.bff;
|
|
36
32
|
var _ref3 = bff || {},
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
fetcher = _ref3.fetcher;
|
|
39
34
|
var prefix = (bff === null || bff === void 0 ? void 0 : bff.prefix) || DEFAULT_API_PREFIX;
|
|
40
35
|
var rootDir = path.resolve(appDirectory, API_DIR);
|
|
41
36
|
chain.resolve.alias.set('@api', rootDir);
|
|
@@ -67,29 +62,26 @@ export default (function () {
|
|
|
67
62
|
modifyServerRoutes: function modifyServerRoutes(_ref4) {
|
|
68
63
|
var routes = _ref4.routes;
|
|
69
64
|
var modernConfig = api.useResolvedConfigContext();
|
|
70
|
-
|
|
71
65
|
var _ref5 = modernConfig || {},
|
|
72
|
-
|
|
73
|
-
|
|
66
|
+
bff = _ref5.bff;
|
|
74
67
|
var prefix = (bff === null || bff === void 0 ? void 0 : bff.prefix) || '/api';
|
|
75
68
|
var prefixList = [];
|
|
76
|
-
|
|
77
69
|
if (Array.isArray(prefix)) {
|
|
78
70
|
prefixList.push.apply(prefixList, _toConsumableArray(prefix));
|
|
79
71
|
} else {
|
|
80
72
|
prefixList.push(prefix);
|
|
81
73
|
}
|
|
82
|
-
|
|
83
74
|
var apiServerRoutes = prefixList.map(function (pre) {
|
|
84
75
|
return {
|
|
85
76
|
urlPath: pre,
|
|
86
77
|
isApi: true,
|
|
87
78
|
entryPath: '',
|
|
88
79
|
isSPA: false,
|
|
89
|
-
isSSR: false
|
|
90
|
-
|
|
80
|
+
isSSR: false
|
|
81
|
+
// FIXME: })) as IAppContext[`serverRoutes`];
|
|
91
82
|
};
|
|
92
83
|
});
|
|
84
|
+
|
|
93
85
|
return {
|
|
94
86
|
routes: routes.concat(apiServerRoutes)
|
|
95
87
|
};
|
|
@@ -97,7 +89,6 @@ export default (function () {
|
|
|
97
89
|
beforeBuild: function beforeBuild() {
|
|
98
90
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
99
91
|
var _api$useAppContext2, internalDirectory;
|
|
100
|
-
|
|
101
92
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
102
93
|
while (1) {
|
|
103
94
|
switch (_context.prev = _context.next) {
|
|
@@ -107,7 +98,6 @@ export default (function () {
|
|
|
107
98
|
_api$useAppContext2 = api.useAppContext(), internalDirectory = _api$useAppContext2.internalDirectory;
|
|
108
99
|
unRegisterResolveRuntimePath = registerModernRuntimePath(internalDirectory);
|
|
109
100
|
}
|
|
110
|
-
|
|
111
101
|
case 1:
|
|
112
102
|
case "end":
|
|
113
103
|
return _context.stop();
|
|
@@ -119,7 +109,6 @@ export default (function () {
|
|
|
119
109
|
afterBuild: function afterBuild() {
|
|
120
110
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
121
111
|
var _api$useAppContext3, appDirectory, distDirectory, modernConfig, distDir, apiDir, sharedDir, tsconfigPath, sourceDirs, server, _modernConfig$source, alias, envVars, globalVars, babel;
|
|
122
|
-
|
|
123
112
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
124
113
|
while (1) {
|
|
125
114
|
switch (_context2.prev = _context2.next) {
|
|
@@ -127,7 +116,6 @@ export default (function () {
|
|
|
127
116
|
if (unRegisterResolveRuntimePath) {
|
|
128
117
|
unRegisterResolveRuntimePath();
|
|
129
118
|
}
|
|
130
|
-
|
|
131
119
|
_api$useAppContext3 = api.useAppContext(), appDirectory = _api$useAppContext3.appDirectory, distDirectory = _api$useAppContext3.distDirectory;
|
|
132
120
|
modernConfig = api.useResolvedConfigContext();
|
|
133
121
|
distDir = path.resolve(distDirectory);
|
|
@@ -135,24 +123,19 @@ export default (function () {
|
|
|
135
123
|
sharedDir = path.resolve(appDirectory, SHARED_DIR);
|
|
136
124
|
tsconfigPath = path.resolve(appDirectory, TS_CONFIG_FILENAME);
|
|
137
125
|
sourceDirs = [];
|
|
138
|
-
|
|
139
126
|
if (fs.existsSync(apiDir)) {
|
|
140
127
|
sourceDirs.push(apiDir);
|
|
141
128
|
}
|
|
142
|
-
|
|
143
129
|
if (fs.existsSync(sharedDir)) {
|
|
144
130
|
sourceDirs.push(sharedDir);
|
|
145
131
|
}
|
|
146
|
-
|
|
147
132
|
server = modernConfig.server;
|
|
148
133
|
_modernConfig$source = modernConfig.source, alias = _modernConfig$source.alias, envVars = _modernConfig$source.envVars, globalVars = _modernConfig$source.globalVars;
|
|
149
134
|
babel = modernConfig.tools.babel;
|
|
150
|
-
|
|
151
135
|
if (!(sourceDirs.length > 0)) {
|
|
152
136
|
_context2.next = 16;
|
|
153
137
|
break;
|
|
154
138
|
}
|
|
155
|
-
|
|
156
139
|
_context2.next = 16;
|
|
157
140
|
return compile(appDirectory, {
|
|
158
141
|
server: server,
|
|
@@ -165,7 +148,6 @@ export default (function () {
|
|
|
165
148
|
distDir: distDir,
|
|
166
149
|
tsconfigPath: tsconfigPath
|
|
167
150
|
});
|
|
168
|
-
|
|
169
151
|
case 16:
|
|
170
152
|
case "end":
|
|
171
153
|
return _context2.stop();
|
|
@@ -3,12 +3,9 @@ import * as path from 'path';
|
|
|
3
3
|
import { registerPaths } from '@modern-js/bff-core';
|
|
4
4
|
var serverRuntimeAlias = '@modern-js/runtime/server';
|
|
5
5
|
var serverRuntimePath = '.runtime-exports/server';
|
|
6
|
-
|
|
7
6
|
var registerModernRuntimePath = function registerModernRuntimePath(internalDirectory) {
|
|
8
7
|
var paths = _defineProperty({}, serverRuntimeAlias, path.join(internalDirectory, serverRuntimePath));
|
|
9
|
-
|
|
10
8
|
var unRegister = registerPaths(paths);
|
|
11
9
|
return unRegister;
|
|
12
10
|
};
|
|
13
|
-
|
|
14
11
|
export { registerModernRuntimePath };
|
|
@@ -2,11 +2,9 @@ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
3
|
import { generateClient } from '@modern-js/bff-core';
|
|
4
4
|
import { logger } from '@modern-js/utils';
|
|
5
|
-
|
|
6
5
|
function loader(_x) {
|
|
7
6
|
return _loader.apply(this, arguments);
|
|
8
7
|
}
|
|
9
|
-
|
|
10
8
|
function _loader() {
|
|
11
9
|
_loader = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(source) {
|
|
12
10
|
var callback, draftOptions, resourcePath, warning, options, lambdaDir, result;
|
|
@@ -15,24 +13,19 @@ function _loader() {
|
|
|
15
13
|
switch (_context.prev = _context.next) {
|
|
16
14
|
case 0:
|
|
17
15
|
// eslint-disable-next-line @babel/no-invalid-this
|
|
18
|
-
this.cacheable();
|
|
19
|
-
|
|
16
|
+
this.cacheable();
|
|
17
|
+
// eslint-disable-next-line @babel/no-invalid-this
|
|
20
18
|
callback = this.async(); // eslint-disable-next-line @babel/no-invalid-this
|
|
21
|
-
|
|
22
19
|
draftOptions = this.getOptions(); // eslint-disable-next-line @babel/no-invalid-this
|
|
23
|
-
|
|
24
20
|
resourcePath = this.resourcePath;
|
|
25
21
|
warning = "The file ".concat(resourcePath, " is not allowd to be imported in src directory, only API definition files are allowed.");
|
|
26
|
-
|
|
27
22
|
if (draftOptions.existLambda) {
|
|
28
23
|
_context.next = 9;
|
|
29
24
|
break;
|
|
30
25
|
}
|
|
31
|
-
|
|
32
26
|
logger.warn(warning);
|
|
33
27
|
callback(null, "throw new Error('".concat(warning, "')"));
|
|
34
28
|
return _context.abrupt("return");
|
|
35
|
-
|
|
36
29
|
case 9:
|
|
37
30
|
options = {
|
|
38
31
|
prefix: Array.isArray(draftOptions.prefix) ? draftOptions.prefix[0] : draftOptions.prefix,
|
|
@@ -43,38 +36,30 @@ function _loader() {
|
|
|
43
36
|
resourcePath: resourcePath
|
|
44
37
|
};
|
|
45
38
|
lambdaDir = draftOptions.lambdaDir;
|
|
46
|
-
|
|
47
39
|
if (resourcePath.startsWith(lambdaDir)) {
|
|
48
40
|
_context.next = 15;
|
|
49
41
|
break;
|
|
50
42
|
}
|
|
51
|
-
|
|
52
43
|
logger.warn(warning);
|
|
53
44
|
callback(null, "throw new Error('".concat(warning, "')"));
|
|
54
45
|
return _context.abrupt("return");
|
|
55
|
-
|
|
56
46
|
case 15:
|
|
57
47
|
if (draftOptions.fetcher) {
|
|
58
48
|
options.fetcher = draftOptions.fetcher;
|
|
59
49
|
}
|
|
60
|
-
|
|
61
50
|
if (draftOptions.requestCreator) {
|
|
62
51
|
options.requestCreator = draftOptions.requestCreator;
|
|
63
52
|
}
|
|
64
|
-
|
|
65
53
|
options.requireResolve = require.resolve;
|
|
66
54
|
_context.next = 20;
|
|
67
55
|
return generateClient(options);
|
|
68
|
-
|
|
69
56
|
case 20:
|
|
70
57
|
result = _context.sent;
|
|
71
|
-
|
|
72
58
|
if (result.isOk) {
|
|
73
59
|
callback(undefined, result.value);
|
|
74
60
|
} else {
|
|
75
61
|
callback(undefined, "throw new Error('".concat(result.value, "')"));
|
|
76
62
|
}
|
|
77
|
-
|
|
78
63
|
case 22:
|
|
79
64
|
case "end":
|
|
80
65
|
return _context.stop();
|
|
@@ -84,5 +69,4 @@ function _loader() {
|
|
|
84
69
|
}));
|
|
85
70
|
return _loader.apply(this, arguments);
|
|
86
71
|
}
|
|
87
|
-
|
|
88
72
|
export default loader;
|
|
@@ -6,24 +6,19 @@ import path from 'path';
|
|
|
6
6
|
import { ApiRouter } from '@modern-js/bff-core';
|
|
7
7
|
import { API_DIR, isProd, requireExistModule } from '@modern-js/utils';
|
|
8
8
|
import { API_APP_NAME } from "./constants";
|
|
9
|
-
|
|
10
9
|
var Storage = /*#__PURE__*/function () {
|
|
11
10
|
function Storage() {
|
|
12
11
|
_classCallCheck(this, Storage);
|
|
13
|
-
|
|
14
12
|
_defineProperty(this, "middlewares", []);
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
_createClass(Storage, [{
|
|
18
15
|
key: "reset",
|
|
19
16
|
value: function reset() {
|
|
20
17
|
this.middlewares = [];
|
|
21
18
|
}
|
|
22
19
|
}]);
|
|
23
|
-
|
|
24
20
|
return Storage;
|
|
25
21
|
}();
|
|
26
|
-
|
|
27
22
|
var createTransformAPI = function createTransformAPI(storage) {
|
|
28
23
|
return {
|
|
29
24
|
addMiddleware: function addMiddleware(fn) {
|
|
@@ -31,7 +26,6 @@ var createTransformAPI = function createTransformAPI(storage) {
|
|
|
31
26
|
}
|
|
32
27
|
};
|
|
33
28
|
};
|
|
34
|
-
|
|
35
29
|
export default (function () {
|
|
36
30
|
return {
|
|
37
31
|
name: '@modern-js/plugin-bff',
|
|
@@ -42,14 +36,12 @@ export default (function () {
|
|
|
42
36
|
return {
|
|
43
37
|
prepare: function prepare() {
|
|
44
38
|
var _api$useAppContext = api.useAppContext(),
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
appDirectory = _api$useAppContext.appDirectory,
|
|
40
|
+
distDirectory = _api$useAppContext.distDirectory;
|
|
48
41
|
var root = isProd() ? distDirectory : appDirectory;
|
|
49
42
|
var apiPath = path.resolve(root || process.cwd(), API_DIR);
|
|
50
43
|
apiAppPath = path.resolve(apiPath, API_APP_NAME);
|
|
51
44
|
var apiMod = requireExistModule(apiAppPath);
|
|
52
|
-
|
|
53
45
|
if (apiMod && typeof apiMod === 'function') {
|
|
54
46
|
apiMod(transformAPI);
|
|
55
47
|
}
|
|
@@ -57,7 +49,6 @@ export default (function () {
|
|
|
57
49
|
reset: function reset() {
|
|
58
50
|
storage.reset();
|
|
59
51
|
var newApiModule = requireExistModule(apiAppPath);
|
|
60
|
-
|
|
61
52
|
if (newApiModule && typeof newApiModule === 'function') {
|
|
62
53
|
newApiModule(transformAPI);
|
|
63
54
|
}
|
|
@@ -70,7 +61,7 @@ export default (function () {
|
|
|
70
61
|
},
|
|
71
62
|
prepareApiServer: function prepareApiServer(props, next) {
|
|
72
63
|
var pwd = props.pwd,
|
|
73
|
-
|
|
64
|
+
prefix = props.prefix;
|
|
74
65
|
var apiDir = path.resolve(pwd, API_DIR);
|
|
75
66
|
var appContext = api.useAppContext();
|
|
76
67
|
var apiRouter = new ApiRouter({
|
package/dist/types/cli.d.ts
CHANGED
package/dist/types/server.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "2.0.0-beta.
|
|
14
|
+
"version": "2.0.0-beta.1",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -55,20 +55,13 @@
|
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@babel/core": "^7.18.0",
|
|
57
57
|
"@babel/runtime": "^7.18.0",
|
|
58
|
-
"@modern-js/babel-compiler": "2.0.0-beta.
|
|
59
|
-
"@modern-js/bff-core": "2.0.0-beta.
|
|
60
|
-
"@modern-js/create-request": "2.0.0-beta.
|
|
61
|
-
"@modern-js/server-utils": "2.0.0-beta.
|
|
62
|
-
"@modern-js/utils": "2.0.0-beta.
|
|
58
|
+
"@modern-js/babel-compiler": "2.0.0-beta.1",
|
|
59
|
+
"@modern-js/bff-core": "2.0.0-beta.1",
|
|
60
|
+
"@modern-js/create-request": "2.0.0-beta.1",
|
|
61
|
+
"@modern-js/server-utils": "2.0.0-beta.1",
|
|
62
|
+
"@modern-js/utils": "2.0.0-beta.1"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@modern-js/core": "2.0.0-beta.0",
|
|
66
|
-
"@modern-js/bff-runtime": "2.0.0-beta.0",
|
|
67
|
-
"@modern-js/runtime": "2.0.0-beta.0",
|
|
68
|
-
"@modern-js/server-core": "2.0.0-beta.0",
|
|
69
|
-
"@modern-js/types": "2.0.0-beta.0",
|
|
70
|
-
"@scripts/build": "2.0.0-beta.0",
|
|
71
|
-
"@scripts/jest-config": "2.0.0-beta.0",
|
|
72
65
|
"@types/babel__core": "^7.1.15",
|
|
73
66
|
"@types/jest": "^27",
|
|
74
67
|
"@types/node": "^14",
|
|
@@ -77,7 +70,14 @@
|
|
|
77
70
|
"ts-jest": "^27.0.5",
|
|
78
71
|
"typescript": "^4",
|
|
79
72
|
"webpack": "^5.74.0",
|
|
80
|
-
"webpack-chain": "^6.5.1"
|
|
73
|
+
"webpack-chain": "^6.5.1",
|
|
74
|
+
"@modern-js/core": "2.0.0-beta.1",
|
|
75
|
+
"@modern-js/bff-runtime": "2.0.0-beta.1",
|
|
76
|
+
"@modern-js/runtime": "2.0.0-beta.1",
|
|
77
|
+
"@modern-js/server-core": "2.0.0-beta.1",
|
|
78
|
+
"@modern-js/types": "2.0.0-beta.1",
|
|
79
|
+
"@scripts/build": "2.0.0-beta.1",
|
|
80
|
+
"@scripts/jest-config": "2.0.0-beta.1"
|
|
81
81
|
},
|
|
82
82
|
"sideEffects": false,
|
|
83
83
|
"publishConfig": {
|