@modern-js/plugin-bff 2.40.0 → 2.40.1-alpha.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/cjs/cli.js +8 -1
- package/dist/esm/cli.js +18 -6
- package/dist/esm-node/cli.js +8 -1
- package/package.json +8 -8
package/dist/cjs/cli.js
CHANGED
|
@@ -39,6 +39,7 @@ var import_bff_core = require("@modern-js/bff-core");
|
|
|
39
39
|
var import_helper = require("./helper");
|
|
40
40
|
const DEFAULT_API_PREFIX = "/api";
|
|
41
41
|
const TS_CONFIG_FILENAME = "tsconfig.json";
|
|
42
|
+
const SERVER_TS_CONFIG = "tsconfig.server.json";
|
|
42
43
|
const bffPlugin = () => ({
|
|
43
44
|
name: "@modern-js/plugin-bff",
|
|
44
45
|
setup: (api) => {
|
|
@@ -144,7 +145,13 @@ const bffPlugin = () => ({
|
|
|
144
145
|
const distDir = import_path.default.resolve(distDirectory);
|
|
145
146
|
const apiDir = apiDirectory || import_path.default.resolve(appDirectory, import_utils.API_DIR);
|
|
146
147
|
const sharedDir = sharedDirectory || import_path.default.resolve(appDirectory, import_utils.SHARED_DIR);
|
|
147
|
-
|
|
148
|
+
let tsconfigPath = "";
|
|
149
|
+
const serverTsconfigPath = import_path.default.resolve(appDirectory, SERVER_TS_CONFIG);
|
|
150
|
+
if (await import_utils.fs.pathExists(serverTsconfigPath)) {
|
|
151
|
+
tsconfigPath = serverTsconfigPath;
|
|
152
|
+
} else {
|
|
153
|
+
tsconfigPath = import_path.default.resolve(appDirectory, TS_CONFIG_FILENAME);
|
|
154
|
+
}
|
|
148
155
|
const sourceDirs = [];
|
|
149
156
|
if (import_utils.fs.existsSync(apiDir)) {
|
|
150
157
|
sourceDirs.push(apiDir);
|
package/dist/esm/cli.js
CHANGED
|
@@ -10,6 +10,7 @@ import { ApiRouter } from "@modern-js/bff-core";
|
|
|
10
10
|
import { registerModernRuntimePath } from "./helper";
|
|
11
11
|
var DEFAULT_API_PREFIX = "/api";
|
|
12
12
|
var TS_CONFIG_FILENAME = "tsconfig.json";
|
|
13
|
+
var SERVER_TS_CONFIG = "tsconfig.server.json";
|
|
13
14
|
var bffPlugin = function() {
|
|
14
15
|
return {
|
|
15
16
|
name: "@modern-js/plugin-bff",
|
|
@@ -122,7 +123,7 @@ var bffPlugin = function() {
|
|
|
122
123
|
},
|
|
123
124
|
afterBuild: function afterBuild() {
|
|
124
125
|
return _async_to_generator(function() {
|
|
125
|
-
var _api_useAppContext, appDirectory, distDirectory, apiDirectory, sharedDirectory, modernConfig, distDir, apiDir, sharedDir, tsconfigPath, sourceDirs, server, alias, babel;
|
|
126
|
+
var _api_useAppContext, appDirectory, distDirectory, apiDirectory, sharedDirectory, modernConfig, distDir, apiDir, sharedDir, tsconfigPath, serverTsconfigPath, sourceDirs, server, alias, babel;
|
|
126
127
|
return _ts_generator(this, function(_state) {
|
|
127
128
|
switch (_state.label) {
|
|
128
129
|
case 0:
|
|
@@ -134,7 +135,18 @@ var bffPlugin = function() {
|
|
|
134
135
|
distDir = path.resolve(distDirectory);
|
|
135
136
|
apiDir = apiDirectory || path.resolve(appDirectory, API_DIR);
|
|
136
137
|
sharedDir = sharedDirectory || path.resolve(appDirectory, SHARED_DIR);
|
|
137
|
-
tsconfigPath =
|
|
138
|
+
tsconfigPath = "";
|
|
139
|
+
serverTsconfigPath = path.resolve(appDirectory, SERVER_TS_CONFIG);
|
|
140
|
+
return [
|
|
141
|
+
4,
|
|
142
|
+
fs.pathExists(serverTsconfigPath)
|
|
143
|
+
];
|
|
144
|
+
case 1:
|
|
145
|
+
if (_state.sent()) {
|
|
146
|
+
tsconfigPath = serverTsconfigPath;
|
|
147
|
+
} else {
|
|
148
|
+
tsconfigPath = path.resolve(appDirectory, TS_CONFIG_FILENAME);
|
|
149
|
+
}
|
|
138
150
|
sourceDirs = [];
|
|
139
151
|
if (fs.existsSync(apiDir)) {
|
|
140
152
|
sourceDirs.push(apiDir);
|
|
@@ -148,7 +160,7 @@ var bffPlugin = function() {
|
|
|
148
160
|
if (!(sourceDirs.length > 0))
|
|
149
161
|
return [
|
|
150
162
|
3,
|
|
151
|
-
|
|
163
|
+
3
|
|
152
164
|
];
|
|
153
165
|
return [
|
|
154
166
|
4,
|
|
@@ -162,10 +174,10 @@ var bffPlugin = function() {
|
|
|
162
174
|
tsconfigPath
|
|
163
175
|
})
|
|
164
176
|
];
|
|
165
|
-
case 1:
|
|
166
|
-
_state.sent();
|
|
167
|
-
_state.label = 2;
|
|
168
177
|
case 2:
|
|
178
|
+
_state.sent();
|
|
179
|
+
_state.label = 3;
|
|
180
|
+
case 3:
|
|
169
181
|
return [
|
|
170
182
|
2
|
|
171
183
|
];
|
package/dist/esm-node/cli.js
CHANGED
|
@@ -5,6 +5,7 @@ import { ApiRouter } from "@modern-js/bff-core";
|
|
|
5
5
|
import { registerModernRuntimePath } from "./helper";
|
|
6
6
|
const DEFAULT_API_PREFIX = "/api";
|
|
7
7
|
const TS_CONFIG_FILENAME = "tsconfig.json";
|
|
8
|
+
const SERVER_TS_CONFIG = "tsconfig.server.json";
|
|
8
9
|
const bffPlugin = () => ({
|
|
9
10
|
name: "@modern-js/plugin-bff",
|
|
10
11
|
setup: (api) => {
|
|
@@ -110,7 +111,13 @@ const bffPlugin = () => ({
|
|
|
110
111
|
const distDir = path.resolve(distDirectory);
|
|
111
112
|
const apiDir = apiDirectory || path.resolve(appDirectory, API_DIR);
|
|
112
113
|
const sharedDir = sharedDirectory || path.resolve(appDirectory, SHARED_DIR);
|
|
113
|
-
|
|
114
|
+
let tsconfigPath = "";
|
|
115
|
+
const serverTsconfigPath = path.resolve(appDirectory, SERVER_TS_CONFIG);
|
|
116
|
+
if (await fs.pathExists(serverTsconfigPath)) {
|
|
117
|
+
tsconfigPath = serverTsconfigPath;
|
|
118
|
+
} else {
|
|
119
|
+
tsconfigPath = path.resolve(appDirectory, TS_CONFIG_FILENAME);
|
|
120
|
+
}
|
|
114
121
|
const sourceDirs = [];
|
|
115
122
|
if (fs.existsSync(apiDir)) {
|
|
116
123
|
sourceDirs.push(apiDir);
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.40.0",
|
|
18
|
+
"version": "2.40.1-alpha.0",
|
|
19
19
|
"jsnext:source": "./src/cli.ts",
|
|
20
20
|
"types": "./dist/types/cli.d.ts",
|
|
21
21
|
"main": "./dist/cjs/cli.js",
|
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@babel/core": "^7.23.2",
|
|
59
59
|
"@swc/helpers": "0.5.1",
|
|
60
|
-
"@modern-js/bff-core": "2.40.0",
|
|
61
|
-
"@modern-js/
|
|
60
|
+
"@modern-js/bff-core": "2.40.1-alpha.0",
|
|
61
|
+
"@modern-js/utils": "2.40.0",
|
|
62
62
|
"@modern-js/server-utils": "2.40.0",
|
|
63
|
-
"@modern-js/
|
|
63
|
+
"@modern-js/create-request": "2.40.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@types/babel__core": "^7.20.0",
|
|
@@ -71,14 +71,14 @@
|
|
|
71
71
|
"ts-jest": "^29.1.0",
|
|
72
72
|
"typescript": "^5",
|
|
73
73
|
"webpack": "^5.88.1",
|
|
74
|
-
"@modern-js/runtime": "2.40.0",
|
|
75
74
|
"@modern-js/core": "2.40.0",
|
|
76
|
-
"@modern-js/bff-runtime": "2.40.0",
|
|
77
75
|
"@modern-js/server-core": "2.40.0",
|
|
78
|
-
"@modern-js/
|
|
76
|
+
"@modern-js/runtime": "2.40.0",
|
|
77
|
+
"@modern-js/bff-runtime": "2.40.0",
|
|
79
78
|
"@modern-js/app-tools": "2.40.0",
|
|
79
|
+
"@scripts/jest-config": "2.40.0",
|
|
80
80
|
"@scripts/build": "2.40.0",
|
|
81
|
-
"@
|
|
81
|
+
"@modern-js/types": "2.40.0"
|
|
82
82
|
},
|
|
83
83
|
"sideEffects": false,
|
|
84
84
|
"publishConfig": {
|