@modern-js/plugin-bff 1.16.0 → 1.17.1-beta.2
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 +18 -0
- package/dist/js/modern/cli.js +8 -55
- package/dist/js/modern/server.js +3 -1
- package/dist/js/node/cli.js +8 -57
- package/dist/js/node/server.js +3 -1
- package/dist/js/treeshaking/cli.js +33 -124
- package/dist/js/treeshaking/server.js +3 -1
- package/package.json +15 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @modern-js/plugin-bff
|
|
2
2
|
|
|
3
|
+
## 1.17.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [1b9176f]
|
|
8
|
+
- Updated dependencies [77d3a38]
|
|
9
|
+
- Updated dependencies [151329d]
|
|
10
|
+
- Updated dependencies [5af9472]
|
|
11
|
+
- Updated dependencies [6b6a534]
|
|
12
|
+
- Updated dependencies [6b43a2b]
|
|
13
|
+
- Updated dependencies [a7be124]
|
|
14
|
+
- Updated dependencies [31547b4]
|
|
15
|
+
- @modern-js/utils@1.17.0
|
|
16
|
+
- @modern-js/bff-core@1.17.0
|
|
17
|
+
- @modern-js/create-request@1.17.0
|
|
18
|
+
- @modern-js/server-utils@1.17.0
|
|
19
|
+
- @modern-js/babel-compiler@1.17.0
|
|
20
|
+
|
|
3
21
|
## 1.16.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/dist/js/modern/cli.js
CHANGED
|
@@ -1,51 +1,10 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
|
-
import { compiler } from '@modern-js/babel-compiler';
|
|
3
2
|
import { fs, API_DIR, PLUGIN_SCHEMAS, normalizeOutputPath, SHARED_DIR, isProd } from '@modern-js/utils';
|
|
4
|
-
import {
|
|
3
|
+
import { compile } from '@modern-js/server-utils';
|
|
5
4
|
import { ApiRouter } from '@modern-js/bff-core';
|
|
6
5
|
import { registerModernRuntimePath } from "./helper";
|
|
7
6
|
const DEFAULT_API_PREFIX = '/api';
|
|
8
7
|
const TS_CONFIG_FILENAME = 'tsconfig.json';
|
|
9
|
-
const FILE_EXTENSIONS = ['.js', '.ts', '.mjs', '.ejs']; // TODO: 封装服务端编译函数
|
|
10
|
-
|
|
11
|
-
const compile = async (appDirectory, modernConfig, compileOptions) => {
|
|
12
|
-
const {
|
|
13
|
-
patterns
|
|
14
|
-
} = compileOptions;
|
|
15
|
-
const results = await Promise.all(patterns.map(async pattern => {
|
|
16
|
-
const {
|
|
17
|
-
from,
|
|
18
|
-
to,
|
|
19
|
-
tsconfigPath
|
|
20
|
-
} = pattern;
|
|
21
|
-
const babelConfig = resolveBabelConfig(appDirectory, modernConfig, {
|
|
22
|
-
tsconfigPath: tsconfigPath ? tsconfigPath : '',
|
|
23
|
-
syntax: 'es6+',
|
|
24
|
-
type: 'commonjs'
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
if (await fs.pathExists(from)) {
|
|
28
|
-
const basename = path.basename(from);
|
|
29
|
-
const targetDir = path.join(to, basename);
|
|
30
|
-
await fs.copy(from, targetDir, {
|
|
31
|
-
filter: src => !['.ts', '.js'].includes(path.extname(src)) && src !== tsconfigPath
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return compiler({
|
|
36
|
-
rootDir: appDirectory,
|
|
37
|
-
distDir: to,
|
|
38
|
-
sourceDir: from,
|
|
39
|
-
extensions: FILE_EXTENSIONS
|
|
40
|
-
}, babelConfig);
|
|
41
|
-
}));
|
|
42
|
-
results.forEach(result => {
|
|
43
|
-
if (result.code === 1) {
|
|
44
|
-
throw new Error(result.message);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
|
|
49
8
|
export default (() => ({
|
|
50
9
|
name: '@modern-js/plugin-bff',
|
|
51
10
|
setup: api => {
|
|
@@ -154,27 +113,21 @@ export default (() => ({
|
|
|
154
113
|
const apiDir = path.resolve(appDirectory, API_DIR);
|
|
155
114
|
const sharedDir = path.resolve(appDirectory, SHARED_DIR);
|
|
156
115
|
const tsconfigPath = path.resolve(appDirectory, TS_CONFIG_FILENAME);
|
|
157
|
-
const
|
|
116
|
+
const sourceDirs = [];
|
|
158
117
|
|
|
159
118
|
if (fs.existsSync(apiDir)) {
|
|
160
|
-
|
|
161
|
-
from: apiDir,
|
|
162
|
-
to: distDir,
|
|
163
|
-
tsconfigPath
|
|
164
|
-
});
|
|
119
|
+
sourceDirs.push(apiDir);
|
|
165
120
|
}
|
|
166
121
|
|
|
167
122
|
if (fs.existsSync(sharedDir)) {
|
|
168
|
-
|
|
169
|
-
from: sharedDir,
|
|
170
|
-
to: distDir,
|
|
171
|
-
tsconfigPath
|
|
172
|
-
});
|
|
123
|
+
sourceDirs.push(sharedDir);
|
|
173
124
|
}
|
|
174
125
|
|
|
175
|
-
if (
|
|
126
|
+
if (sourceDirs.length > 0) {
|
|
176
127
|
await compile(appDirectory, modernConfig, {
|
|
177
|
-
|
|
128
|
+
sourceDirs,
|
|
129
|
+
distDir,
|
|
130
|
+
tsconfigPath
|
|
178
131
|
});
|
|
179
132
|
}
|
|
180
133
|
}
|
package/dist/js/modern/server.js
CHANGED
|
@@ -77,10 +77,12 @@ export default (() => ({
|
|
|
77
77
|
apiDir,
|
|
78
78
|
prefix
|
|
79
79
|
});
|
|
80
|
+
const apiMode = apiRouter.getApiMode();
|
|
80
81
|
const apiHandlerInfos = apiRouter.getApiHandlers();
|
|
81
82
|
api.setAppContext(_objectSpread(_objectSpread({}, appContext), {}, {
|
|
82
83
|
apiRouter,
|
|
83
|
-
apiHandlerInfos
|
|
84
|
+
apiHandlerInfos,
|
|
85
|
+
apiMode
|
|
84
86
|
}));
|
|
85
87
|
return next(props);
|
|
86
88
|
}
|
package/dist/js/node/cli.js
CHANGED
|
@@ -7,8 +7,6 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _path = _interopRequireDefault(require("path"));
|
|
9
9
|
|
|
10
|
-
var _babelCompiler = require("@modern-js/babel-compiler");
|
|
11
|
-
|
|
12
10
|
var _utils = require("@modern-js/utils");
|
|
13
11
|
|
|
14
12
|
var _serverUtils = require("@modern-js/server-utils");
|
|
@@ -21,47 +19,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
21
19
|
|
|
22
20
|
const DEFAULT_API_PREFIX = '/api';
|
|
23
21
|
const TS_CONFIG_FILENAME = 'tsconfig.json';
|
|
24
|
-
const FILE_EXTENSIONS = ['.js', '.ts', '.mjs', '.ejs']; // TODO: 封装服务端编译函数
|
|
25
|
-
|
|
26
|
-
const compile = async (appDirectory, modernConfig, compileOptions) => {
|
|
27
|
-
const {
|
|
28
|
-
patterns
|
|
29
|
-
} = compileOptions;
|
|
30
|
-
const results = await Promise.all(patterns.map(async pattern => {
|
|
31
|
-
const {
|
|
32
|
-
from,
|
|
33
|
-
to,
|
|
34
|
-
tsconfigPath
|
|
35
|
-
} = pattern;
|
|
36
|
-
const babelConfig = (0, _serverUtils.resolveBabelConfig)(appDirectory, modernConfig, {
|
|
37
|
-
tsconfigPath: tsconfigPath ? tsconfigPath : '',
|
|
38
|
-
syntax: 'es6+',
|
|
39
|
-
type: 'commonjs'
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
if (await _utils.fs.pathExists(from)) {
|
|
43
|
-
const basename = _path.default.basename(from);
|
|
44
|
-
|
|
45
|
-
const targetDir = _path.default.join(to, basename);
|
|
46
|
-
|
|
47
|
-
await _utils.fs.copy(from, targetDir, {
|
|
48
|
-
filter: src => !['.ts', '.js'].includes(_path.default.extname(src)) && src !== tsconfigPath
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return (0, _babelCompiler.compiler)({
|
|
53
|
-
rootDir: appDirectory,
|
|
54
|
-
distDir: to,
|
|
55
|
-
sourceDir: from,
|
|
56
|
-
extensions: FILE_EXTENSIONS
|
|
57
|
-
}, babelConfig);
|
|
58
|
-
}));
|
|
59
|
-
results.forEach(result => {
|
|
60
|
-
if (result.code === 1) {
|
|
61
|
-
throw new Error(result.message);
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
22
|
|
|
66
23
|
var _default = () => ({
|
|
67
24
|
name: '@modern-js/plugin-bff',
|
|
@@ -178,27 +135,21 @@ var _default = () => ({
|
|
|
178
135
|
|
|
179
136
|
const tsconfigPath = _path.default.resolve(appDirectory, TS_CONFIG_FILENAME);
|
|
180
137
|
|
|
181
|
-
const
|
|
138
|
+
const sourceDirs = [];
|
|
182
139
|
|
|
183
140
|
if (_utils.fs.existsSync(apiDir)) {
|
|
184
|
-
|
|
185
|
-
from: apiDir,
|
|
186
|
-
to: distDir,
|
|
187
|
-
tsconfigPath
|
|
188
|
-
});
|
|
141
|
+
sourceDirs.push(apiDir);
|
|
189
142
|
}
|
|
190
143
|
|
|
191
144
|
if (_utils.fs.existsSync(sharedDir)) {
|
|
192
|
-
|
|
193
|
-
from: sharedDir,
|
|
194
|
-
to: distDir,
|
|
195
|
-
tsconfigPath
|
|
196
|
-
});
|
|
145
|
+
sourceDirs.push(sharedDir);
|
|
197
146
|
}
|
|
198
147
|
|
|
199
|
-
if (
|
|
200
|
-
await compile(appDirectory, modernConfig, {
|
|
201
|
-
|
|
148
|
+
if (sourceDirs.length > 0) {
|
|
149
|
+
await (0, _serverUtils.compile)(appDirectory, modernConfig, {
|
|
150
|
+
sourceDirs,
|
|
151
|
+
distDir,
|
|
152
|
+
tsconfigPath
|
|
202
153
|
});
|
|
203
154
|
}
|
|
204
155
|
}
|
package/dist/js/node/server.js
CHANGED
|
@@ -93,10 +93,12 @@ var _default = () => ({
|
|
|
93
93
|
apiDir,
|
|
94
94
|
prefix
|
|
95
95
|
});
|
|
96
|
+
const apiMode = apiRouter.getApiMode();
|
|
96
97
|
const apiHandlerInfos = apiRouter.getApiHandlers();
|
|
97
98
|
api.setAppContext(_objectSpread(_objectSpread({}, appContext), {}, {
|
|
98
99
|
apiRouter,
|
|
99
|
-
apiHandlerInfos
|
|
100
|
+
apiHandlerInfos,
|
|
101
|
+
apiMode
|
|
100
102
|
}));
|
|
101
103
|
return next(props);
|
|
102
104
|
}
|
|
@@ -1,98 +1,13 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
1
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
3
2
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
4
4
|
import path from 'path';
|
|
5
|
-
import { compiler } from '@modern-js/babel-compiler';
|
|
6
5
|
import { fs, API_DIR, PLUGIN_SCHEMAS, normalizeOutputPath, SHARED_DIR, isProd } from '@modern-js/utils';
|
|
7
|
-
import {
|
|
6
|
+
import { compile } from '@modern-js/server-utils';
|
|
8
7
|
import { ApiRouter } from '@modern-js/bff-core';
|
|
9
8
|
import { registerModernRuntimePath } from "./helper";
|
|
10
9
|
var DEFAULT_API_PREFIX = '/api';
|
|
11
10
|
var TS_CONFIG_FILENAME = 'tsconfig.json';
|
|
12
|
-
var FILE_EXTENSIONS = ['.js', '.ts', '.mjs', '.ejs']; // TODO: 封装服务端编译函数
|
|
13
|
-
|
|
14
|
-
var compile = /*#__PURE__*/function () {
|
|
15
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(appDirectory, modernConfig, compileOptions) {
|
|
16
|
-
var patterns, results;
|
|
17
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
18
|
-
while (1) {
|
|
19
|
-
switch (_context2.prev = _context2.next) {
|
|
20
|
-
case 0:
|
|
21
|
-
patterns = compileOptions.patterns;
|
|
22
|
-
_context2.next = 3;
|
|
23
|
-
return Promise.all(patterns.map( /*#__PURE__*/function () {
|
|
24
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(pattern) {
|
|
25
|
-
var from, to, tsconfigPath, babelConfig, basename, targetDir;
|
|
26
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
27
|
-
while (1) {
|
|
28
|
-
switch (_context.prev = _context.next) {
|
|
29
|
-
case 0:
|
|
30
|
-
from = pattern.from, to = pattern.to, tsconfigPath = pattern.tsconfigPath;
|
|
31
|
-
babelConfig = resolveBabelConfig(appDirectory, modernConfig, {
|
|
32
|
-
tsconfigPath: tsconfigPath ? tsconfigPath : '',
|
|
33
|
-
syntax: 'es6+',
|
|
34
|
-
type: 'commonjs'
|
|
35
|
-
});
|
|
36
|
-
_context.next = 4;
|
|
37
|
-
return fs.pathExists(from);
|
|
38
|
-
|
|
39
|
-
case 4:
|
|
40
|
-
if (!_context.sent) {
|
|
41
|
-
_context.next = 9;
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
basename = path.basename(from);
|
|
46
|
-
targetDir = path.join(to, basename);
|
|
47
|
-
_context.next = 9;
|
|
48
|
-
return fs.copy(from, targetDir, {
|
|
49
|
-
filter: function filter(src) {
|
|
50
|
-
return !['.ts', '.js'].includes(path.extname(src)) && src !== tsconfigPath;
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
case 9:
|
|
55
|
-
return _context.abrupt("return", compiler({
|
|
56
|
-
rootDir: appDirectory,
|
|
57
|
-
distDir: to,
|
|
58
|
-
sourceDir: from,
|
|
59
|
-
extensions: FILE_EXTENSIONS
|
|
60
|
-
}, babelConfig));
|
|
61
|
-
|
|
62
|
-
case 10:
|
|
63
|
-
case "end":
|
|
64
|
-
return _context.stop();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}, _callee);
|
|
68
|
-
}));
|
|
69
|
-
|
|
70
|
-
return function (_x4) {
|
|
71
|
-
return _ref2.apply(this, arguments);
|
|
72
|
-
};
|
|
73
|
-
}()));
|
|
74
|
-
|
|
75
|
-
case 3:
|
|
76
|
-
results = _context2.sent;
|
|
77
|
-
results.forEach(function (result) {
|
|
78
|
-
if (result.code === 1) {
|
|
79
|
-
throw new Error(result.message);
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
case 5:
|
|
84
|
-
case "end":
|
|
85
|
-
return _context2.stop();
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}, _callee2);
|
|
89
|
-
}));
|
|
90
|
-
|
|
91
|
-
return function compile(_x, _x2, _x3) {
|
|
92
|
-
return _ref.apply(this, arguments);
|
|
93
|
-
};
|
|
94
|
-
}();
|
|
95
|
-
|
|
96
11
|
export default (function () {
|
|
97
12
|
return {
|
|
98
13
|
name: '@modern-js/plugin-bff',
|
|
@@ -105,9 +20,9 @@ export default (function () {
|
|
|
105
20
|
config: function config() {
|
|
106
21
|
return {
|
|
107
22
|
tools: {
|
|
108
|
-
webpackChain: function webpackChain(chain,
|
|
109
|
-
var name =
|
|
110
|
-
CHAIN_ID =
|
|
23
|
+
webpackChain: function webpackChain(chain, _ref) {
|
|
24
|
+
var name = _ref.name,
|
|
25
|
+
CHAIN_ID = _ref.CHAIN_ID;
|
|
111
26
|
|
|
112
27
|
var _api$useAppContext = api.useAppContext(),
|
|
113
28
|
appDirectory = _api$useAppContext.appDirectory,
|
|
@@ -115,11 +30,11 @@ export default (function () {
|
|
|
115
30
|
|
|
116
31
|
var modernConfig = api.useResolvedConfigContext();
|
|
117
32
|
|
|
118
|
-
var
|
|
119
|
-
bff =
|
|
33
|
+
var _ref2 = modernConfig || {},
|
|
34
|
+
bff = _ref2.bff;
|
|
120
35
|
|
|
121
|
-
var
|
|
122
|
-
fetcher =
|
|
36
|
+
var _ref3 = bff || {},
|
|
37
|
+
fetcher = _ref3.fetcher;
|
|
123
38
|
|
|
124
39
|
var prefix = (bff === null || bff === void 0 ? void 0 : bff.prefix) || DEFAULT_API_PREFIX;
|
|
125
40
|
var rootDir = path.resolve(appDirectory, API_DIR);
|
|
@@ -148,12 +63,12 @@ export default (function () {
|
|
|
148
63
|
}
|
|
149
64
|
};
|
|
150
65
|
},
|
|
151
|
-
modifyServerRoutes: function modifyServerRoutes(
|
|
152
|
-
var routes =
|
|
66
|
+
modifyServerRoutes: function modifyServerRoutes(_ref4) {
|
|
67
|
+
var routes = _ref4.routes;
|
|
153
68
|
var modernConfig = api.useResolvedConfigContext();
|
|
154
69
|
|
|
155
|
-
var
|
|
156
|
-
bff =
|
|
70
|
+
var _ref5 = modernConfig || {},
|
|
71
|
+
bff = _ref5.bff;
|
|
157
72
|
|
|
158
73
|
var prefix = (bff === null || bff === void 0 ? void 0 : bff.prefix) || '/api';
|
|
159
74
|
var prefixList = [];
|
|
@@ -179,12 +94,12 @@ export default (function () {
|
|
|
179
94
|
};
|
|
180
95
|
},
|
|
181
96
|
beforeBuild: function beforeBuild() {
|
|
182
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
97
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
183
98
|
var _api$useAppContext2, internalDirectory;
|
|
184
99
|
|
|
185
|
-
return _regeneratorRuntime().wrap(function
|
|
100
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
186
101
|
while (1) {
|
|
187
|
-
switch (
|
|
102
|
+
switch (_context.prev = _context.next) {
|
|
188
103
|
case 0:
|
|
189
104
|
// help esbuild-register resolve @modern-js/server/runtime
|
|
190
105
|
if (isProd()) {
|
|
@@ -194,19 +109,19 @@ export default (function () {
|
|
|
194
109
|
|
|
195
110
|
case 1:
|
|
196
111
|
case "end":
|
|
197
|
-
return
|
|
112
|
+
return _context.stop();
|
|
198
113
|
}
|
|
199
114
|
}
|
|
200
|
-
},
|
|
115
|
+
}, _callee);
|
|
201
116
|
}))();
|
|
202
117
|
},
|
|
203
118
|
afterBuild: function afterBuild() {
|
|
204
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
205
|
-
var _api$useAppContext3, appDirectory, distDirectory, modernConfig, distDir, apiDir, sharedDir, tsconfigPath,
|
|
119
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
120
|
+
var _api$useAppContext3, appDirectory, distDirectory, modernConfig, distDir, apiDir, sharedDir, tsconfigPath, sourceDirs;
|
|
206
121
|
|
|
207
|
-
return _regeneratorRuntime().wrap(function
|
|
122
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
208
123
|
while (1) {
|
|
209
|
-
switch (
|
|
124
|
+
switch (_context2.prev = _context2.next) {
|
|
210
125
|
case 0:
|
|
211
126
|
if (unRegisterResolveRuntimePath) {
|
|
212
127
|
unRegisterResolveRuntimePath();
|
|
@@ -218,40 +133,34 @@ export default (function () {
|
|
|
218
133
|
apiDir = path.resolve(appDirectory, API_DIR);
|
|
219
134
|
sharedDir = path.resolve(appDirectory, SHARED_DIR);
|
|
220
135
|
tsconfigPath = path.resolve(appDirectory, TS_CONFIG_FILENAME);
|
|
221
|
-
|
|
136
|
+
sourceDirs = [];
|
|
222
137
|
|
|
223
138
|
if (fs.existsSync(apiDir)) {
|
|
224
|
-
|
|
225
|
-
from: apiDir,
|
|
226
|
-
to: distDir,
|
|
227
|
-
tsconfigPath: tsconfigPath
|
|
228
|
-
});
|
|
139
|
+
sourceDirs.push(apiDir);
|
|
229
140
|
}
|
|
230
141
|
|
|
231
142
|
if (fs.existsSync(sharedDir)) {
|
|
232
|
-
|
|
233
|
-
from: sharedDir,
|
|
234
|
-
to: distDir,
|
|
235
|
-
tsconfigPath: tsconfigPath
|
|
236
|
-
});
|
|
143
|
+
sourceDirs.push(sharedDir);
|
|
237
144
|
}
|
|
238
145
|
|
|
239
|
-
if (!(
|
|
240
|
-
|
|
146
|
+
if (!(sourceDirs.length > 0)) {
|
|
147
|
+
_context2.next = 13;
|
|
241
148
|
break;
|
|
242
149
|
}
|
|
243
150
|
|
|
244
|
-
|
|
151
|
+
_context2.next = 13;
|
|
245
152
|
return compile(appDirectory, modernConfig, {
|
|
246
|
-
|
|
153
|
+
sourceDirs: sourceDirs,
|
|
154
|
+
distDir: distDir,
|
|
155
|
+
tsconfigPath: tsconfigPath
|
|
247
156
|
});
|
|
248
157
|
|
|
249
158
|
case 13:
|
|
250
159
|
case "end":
|
|
251
|
-
return
|
|
160
|
+
return _context2.stop();
|
|
252
161
|
}
|
|
253
162
|
}
|
|
254
|
-
},
|
|
163
|
+
}, _callee2);
|
|
255
164
|
}))();
|
|
256
165
|
}
|
|
257
166
|
};
|
|
@@ -77,10 +77,12 @@ export default (function () {
|
|
|
77
77
|
apiDir: apiDir,
|
|
78
78
|
prefix: prefix
|
|
79
79
|
});
|
|
80
|
+
var apiMode = apiRouter.getApiMode();
|
|
80
81
|
var apiHandlerInfos = apiRouter.getApiHandlers();
|
|
81
82
|
api.setAppContext(_objectSpread(_objectSpread({}, appContext), {}, {
|
|
82
83
|
apiRouter: apiRouter,
|
|
83
|
-
apiHandlerInfos: apiHandlerInfos
|
|
84
|
+
apiHandlerInfos: apiHandlerInfos,
|
|
85
|
+
apiMode: apiMode
|
|
84
86
|
}));
|
|
85
87
|
return next(props);
|
|
86
88
|
}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.17.1-beta.2",
|
|
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,20 @@
|
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@babel/core": "^7.18.0",
|
|
57
57
|
"@babel/runtime": "^7.18.0",
|
|
58
|
-
"@modern-js/babel-compiler": "1.
|
|
59
|
-
"@modern-js/bff-core": "1.
|
|
60
|
-
"@modern-js/create-request": "1.
|
|
61
|
-
"@modern-js/server-utils": "1.
|
|
62
|
-
"@modern-js/utils": "1.
|
|
58
|
+
"@modern-js/babel-compiler": "1.17.0",
|
|
59
|
+
"@modern-js/bff-core": "1.17.1-beta.1",
|
|
60
|
+
"@modern-js/create-request": "1.17.0",
|
|
61
|
+
"@modern-js/server-utils": "1.17.0",
|
|
62
|
+
"@modern-js/utils": "1.17.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@modern-js/core": "1.
|
|
66
|
-
"@modern-js/bff-runtime": "1.
|
|
67
|
-
"@modern-js/runtime": "1.
|
|
68
|
-
"@modern-js/server-core": "1.
|
|
69
|
-
"@modern-js/types": "1.
|
|
70
|
-
"@scripts/build": "1.
|
|
71
|
-
"@scripts/jest-config": "1.
|
|
65
|
+
"@modern-js/core": "1.17.1",
|
|
66
|
+
"@modern-js/bff-runtime": "1.17.0",
|
|
67
|
+
"@modern-js/runtime": "1.17.0",
|
|
68
|
+
"@modern-js/server-core": "1.17.0",
|
|
69
|
+
"@modern-js/types": "1.17.0",
|
|
70
|
+
"@scripts/build": "1.17.0",
|
|
71
|
+
"@scripts/jest-config": "1.17.0",
|
|
72
72
|
"@types/babel__core": "^7.1.15",
|
|
73
73
|
"@types/jest": "^27",
|
|
74
74
|
"@types/node": "^14",
|
|
@@ -82,7 +82,8 @@
|
|
|
82
82
|
"sideEffects": false,
|
|
83
83
|
"publishConfig": {
|
|
84
84
|
"registry": "https://registry.npmjs.org/",
|
|
85
|
-
"access": "public"
|
|
85
|
+
"access": "public",
|
|
86
|
+
"types": "./dist/types/index.d.ts"
|
|
86
87
|
},
|
|
87
88
|
"wireit": {
|
|
88
89
|
"build": {
|