@modern-js/plugin-bff 1.15.1-beta.0 → 1.15.1-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/dist/js/modern/cli.js +7 -53
- package/dist/js/node/cli.js +7 -52
- package/dist/js/treeshaking/cli.js +8 -54
- package/package.json +2 -2
package/dist/js/modern/cli.js
CHANGED
|
@@ -4,46 +4,6 @@ import { compile } from '@modern-js/server-utils';
|
|
|
4
4
|
import { registerModernRuntimePath } from "./helper";
|
|
5
5
|
const DEFAULT_API_PREFIX = '/api';
|
|
6
6
|
const TS_CONFIG_FILENAME = 'tsconfig.json';
|
|
7
|
-
const FILE_EXTENSIONS = ['.js', '.ts', '.mjs', '.ejs']; // const compile = async (
|
|
8
|
-
// appDirectory: string,
|
|
9
|
-
// modernConfig: NormalizedConfig,
|
|
10
|
-
// compileOptions: CompileOptions,
|
|
11
|
-
// ) => {
|
|
12
|
-
// const { patterns } = compileOptions;
|
|
13
|
-
// const results = await Promise.all(
|
|
14
|
-
// patterns.map(async pattern => {
|
|
15
|
-
// const { from, to, tsconfigPath } = pattern;
|
|
16
|
-
// const babelConfig = resolveBabelConfig(appDirectory, modernConfig, {
|
|
17
|
-
// tsconfigPath: tsconfigPath ? tsconfigPath : '',
|
|
18
|
-
// syntax: 'es6+',
|
|
19
|
-
// type: 'commonjs',
|
|
20
|
-
// });
|
|
21
|
-
// if (await fs.pathExists(from)) {
|
|
22
|
-
// const basename = path.basename(from);
|
|
23
|
-
// const targetDir = path.join(to, basename);
|
|
24
|
-
// await fs.copy(from, targetDir, {
|
|
25
|
-
// filter: src =>
|
|
26
|
-
// !['.ts', '.js'].includes(path.extname(src)) && src !== tsconfigPath,
|
|
27
|
-
// });
|
|
28
|
-
// }
|
|
29
|
-
// return compiler(
|
|
30
|
-
// {
|
|
31
|
-
// rootDir: appDirectory,
|
|
32
|
-
// distDir: to,
|
|
33
|
-
// sourceDir: from,
|
|
34
|
-
// extensions: FILE_EXTENSIONS,
|
|
35
|
-
// },
|
|
36
|
-
// babelConfig,
|
|
37
|
-
// );
|
|
38
|
-
// }),
|
|
39
|
-
// );
|
|
40
|
-
// results.forEach(result => {
|
|
41
|
-
// if (result.code === 1) {
|
|
42
|
-
// throw new Error(result.message);
|
|
43
|
-
// }
|
|
44
|
-
// });
|
|
45
|
-
// };
|
|
46
|
-
|
|
47
7
|
export default (() => ({
|
|
48
8
|
name: '@modern-js/plugin-bff',
|
|
49
9
|
setup: api => {
|
|
@@ -144,27 +104,21 @@ export default (() => ({
|
|
|
144
104
|
const apiDir = path.resolve(appDirectory, API_DIR);
|
|
145
105
|
const sharedDir = path.resolve(appDirectory, SHARED_DIR);
|
|
146
106
|
const tsconfigPath = path.resolve(appDirectory, TS_CONFIG_FILENAME);
|
|
147
|
-
const
|
|
107
|
+
const sourceDirs = [];
|
|
148
108
|
|
|
149
109
|
if (fs.existsSync(apiDir)) {
|
|
150
|
-
|
|
151
|
-
from: apiDir,
|
|
152
|
-
to: distDir,
|
|
153
|
-
tsconfigPath
|
|
154
|
-
});
|
|
110
|
+
sourceDirs.push(apiDir);
|
|
155
111
|
}
|
|
156
112
|
|
|
157
113
|
if (fs.existsSync(sharedDir)) {
|
|
158
|
-
|
|
159
|
-
from: sharedDir,
|
|
160
|
-
to: distDir,
|
|
161
|
-
tsconfigPath
|
|
162
|
-
});
|
|
114
|
+
sourceDirs.push(sharedDir);
|
|
163
115
|
}
|
|
164
116
|
|
|
165
|
-
if (
|
|
117
|
+
if (sourceDirs.length > 0) {
|
|
166
118
|
await compile(appDirectory, modernConfig, {
|
|
167
|
-
|
|
119
|
+
sourceDirs,
|
|
120
|
+
distDir,
|
|
121
|
+
tsconfigPath
|
|
168
122
|
});
|
|
169
123
|
}
|
|
170
124
|
}
|
package/dist/js/node/cli.js
CHANGED
|
@@ -17,45 +17,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
17
17
|
|
|
18
18
|
const DEFAULT_API_PREFIX = '/api';
|
|
19
19
|
const TS_CONFIG_FILENAME = 'tsconfig.json';
|
|
20
|
-
const FILE_EXTENSIONS = ['.js', '.ts', '.mjs', '.ejs']; // const compile = async (
|
|
21
|
-
// appDirectory: string,
|
|
22
|
-
// modernConfig: NormalizedConfig,
|
|
23
|
-
// compileOptions: CompileOptions,
|
|
24
|
-
// ) => {
|
|
25
|
-
// const { patterns } = compileOptions;
|
|
26
|
-
// const results = await Promise.all(
|
|
27
|
-
// patterns.map(async pattern => {
|
|
28
|
-
// const { from, to, tsconfigPath } = pattern;
|
|
29
|
-
// const babelConfig = resolveBabelConfig(appDirectory, modernConfig, {
|
|
30
|
-
// tsconfigPath: tsconfigPath ? tsconfigPath : '',
|
|
31
|
-
// syntax: 'es6+',
|
|
32
|
-
// type: 'commonjs',
|
|
33
|
-
// });
|
|
34
|
-
// if (await fs.pathExists(from)) {
|
|
35
|
-
// const basename = path.basename(from);
|
|
36
|
-
// const targetDir = path.join(to, basename);
|
|
37
|
-
// await fs.copy(from, targetDir, {
|
|
38
|
-
// filter: src =>
|
|
39
|
-
// !['.ts', '.js'].includes(path.extname(src)) && src !== tsconfigPath,
|
|
40
|
-
// });
|
|
41
|
-
// }
|
|
42
|
-
// return compiler(
|
|
43
|
-
// {
|
|
44
|
-
// rootDir: appDirectory,
|
|
45
|
-
// distDir: to,
|
|
46
|
-
// sourceDir: from,
|
|
47
|
-
// extensions: FILE_EXTENSIONS,
|
|
48
|
-
// },
|
|
49
|
-
// babelConfig,
|
|
50
|
-
// );
|
|
51
|
-
// }),
|
|
52
|
-
// );
|
|
53
|
-
// results.forEach(result => {
|
|
54
|
-
// if (result.code === 1) {
|
|
55
|
-
// throw new Error(result.message);
|
|
56
|
-
// }
|
|
57
|
-
// });
|
|
58
|
-
// };
|
|
59
20
|
|
|
60
21
|
var _default = () => ({
|
|
61
22
|
name: '@modern-js/plugin-bff',
|
|
@@ -164,27 +125,21 @@ var _default = () => ({
|
|
|
164
125
|
|
|
165
126
|
const tsconfigPath = _path.default.resolve(appDirectory, TS_CONFIG_FILENAME);
|
|
166
127
|
|
|
167
|
-
const
|
|
128
|
+
const sourceDirs = [];
|
|
168
129
|
|
|
169
130
|
if (_utils.fs.existsSync(apiDir)) {
|
|
170
|
-
|
|
171
|
-
from: apiDir,
|
|
172
|
-
to: distDir,
|
|
173
|
-
tsconfigPath
|
|
174
|
-
});
|
|
131
|
+
sourceDirs.push(apiDir);
|
|
175
132
|
}
|
|
176
133
|
|
|
177
134
|
if (_utils.fs.existsSync(sharedDir)) {
|
|
178
|
-
|
|
179
|
-
from: sharedDir,
|
|
180
|
-
to: distDir,
|
|
181
|
-
tsconfigPath
|
|
182
|
-
});
|
|
135
|
+
sourceDirs.push(sharedDir);
|
|
183
136
|
}
|
|
184
137
|
|
|
185
|
-
if (
|
|
138
|
+
if (sourceDirs.length > 0) {
|
|
186
139
|
await (0, _serverUtils.compile)(appDirectory, modernConfig, {
|
|
187
|
-
|
|
140
|
+
sourceDirs,
|
|
141
|
+
distDir,
|
|
142
|
+
tsconfigPath
|
|
188
143
|
});
|
|
189
144
|
}
|
|
190
145
|
}
|
|
@@ -7,46 +7,6 @@ import { compile } from '@modern-js/server-utils';
|
|
|
7
7
|
import { registerModernRuntimePath } from "./helper";
|
|
8
8
|
var DEFAULT_API_PREFIX = '/api';
|
|
9
9
|
var TS_CONFIG_FILENAME = 'tsconfig.json';
|
|
10
|
-
var FILE_EXTENSIONS = ['.js', '.ts', '.mjs', '.ejs']; // const compile = async (
|
|
11
|
-
// appDirectory: string,
|
|
12
|
-
// modernConfig: NormalizedConfig,
|
|
13
|
-
// compileOptions: CompileOptions,
|
|
14
|
-
// ) => {
|
|
15
|
-
// const { patterns } = compileOptions;
|
|
16
|
-
// const results = await Promise.all(
|
|
17
|
-
// patterns.map(async pattern => {
|
|
18
|
-
// const { from, to, tsconfigPath } = pattern;
|
|
19
|
-
// const babelConfig = resolveBabelConfig(appDirectory, modernConfig, {
|
|
20
|
-
// tsconfigPath: tsconfigPath ? tsconfigPath : '',
|
|
21
|
-
// syntax: 'es6+',
|
|
22
|
-
// type: 'commonjs',
|
|
23
|
-
// });
|
|
24
|
-
// if (await fs.pathExists(from)) {
|
|
25
|
-
// const basename = path.basename(from);
|
|
26
|
-
// const targetDir = path.join(to, basename);
|
|
27
|
-
// await fs.copy(from, targetDir, {
|
|
28
|
-
// filter: src =>
|
|
29
|
-
// !['.ts', '.js'].includes(path.extname(src)) && src !== tsconfigPath,
|
|
30
|
-
// });
|
|
31
|
-
// }
|
|
32
|
-
// return compiler(
|
|
33
|
-
// {
|
|
34
|
-
// rootDir: appDirectory,
|
|
35
|
-
// distDir: to,
|
|
36
|
-
// sourceDir: from,
|
|
37
|
-
// extensions: FILE_EXTENSIONS,
|
|
38
|
-
// },
|
|
39
|
-
// babelConfig,
|
|
40
|
-
// );
|
|
41
|
-
// }),
|
|
42
|
-
// );
|
|
43
|
-
// results.forEach(result => {
|
|
44
|
-
// if (result.code === 1) {
|
|
45
|
-
// throw new Error(result.message);
|
|
46
|
-
// }
|
|
47
|
-
// });
|
|
48
|
-
// };
|
|
49
|
-
|
|
50
10
|
export default (function () {
|
|
51
11
|
return {
|
|
52
12
|
name: '@modern-js/plugin-bff',
|
|
@@ -148,7 +108,7 @@ export default (function () {
|
|
|
148
108
|
},
|
|
149
109
|
afterBuild: function afterBuild() {
|
|
150
110
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
151
|
-
var _api$useAppContext3, appDirectory, distDirectory, modernConfig, distDir, apiDir, sharedDir, tsconfigPath,
|
|
111
|
+
var _api$useAppContext3, appDirectory, distDirectory, modernConfig, distDir, apiDir, sharedDir, tsconfigPath, sourceDirs;
|
|
152
112
|
|
|
153
113
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
154
114
|
while (1) {
|
|
@@ -164,32 +124,26 @@ export default (function () {
|
|
|
164
124
|
apiDir = path.resolve(appDirectory, API_DIR);
|
|
165
125
|
sharedDir = path.resolve(appDirectory, SHARED_DIR);
|
|
166
126
|
tsconfigPath = path.resolve(appDirectory, TS_CONFIG_FILENAME);
|
|
167
|
-
|
|
127
|
+
sourceDirs = [];
|
|
168
128
|
|
|
169
129
|
if (fs.existsSync(apiDir)) {
|
|
170
|
-
|
|
171
|
-
from: apiDir,
|
|
172
|
-
to: distDir,
|
|
173
|
-
tsconfigPath: tsconfigPath
|
|
174
|
-
});
|
|
130
|
+
sourceDirs.push(apiDir);
|
|
175
131
|
}
|
|
176
132
|
|
|
177
133
|
if (fs.existsSync(sharedDir)) {
|
|
178
|
-
|
|
179
|
-
from: sharedDir,
|
|
180
|
-
to: distDir,
|
|
181
|
-
tsconfigPath: tsconfigPath
|
|
182
|
-
});
|
|
134
|
+
sourceDirs.push(sharedDir);
|
|
183
135
|
}
|
|
184
136
|
|
|
185
|
-
if (!(
|
|
137
|
+
if (!(sourceDirs.length > 0)) {
|
|
186
138
|
_context2.next = 13;
|
|
187
139
|
break;
|
|
188
140
|
}
|
|
189
141
|
|
|
190
142
|
_context2.next = 13;
|
|
191
143
|
return compile(appDirectory, modernConfig, {
|
|
192
|
-
|
|
144
|
+
sourceDirs: sourceDirs,
|
|
145
|
+
distDir: distDir,
|
|
146
|
+
tsconfigPath: tsconfigPath
|
|
193
147
|
});
|
|
194
148
|
|
|
195
149
|
case 13:
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.15.1-beta.
|
|
14
|
+
"version": "1.15.1-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",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@modern-js/babel-compiler": "1.15.0",
|
|
59
59
|
"@modern-js/bff-core": "1.15.0",
|
|
60
60
|
"@modern-js/create-request": "1.15.0",
|
|
61
|
-
"@modern-js/server-utils": "1.15.1-beta.
|
|
61
|
+
"@modern-js/server-utils": "1.15.1-beta.1",
|
|
62
62
|
"@modern-js/utils": "1.15.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|