@modern-js/app-tools 2.6.0 → 2.7.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 +52 -0
- package/dist/cjs/analyze/generateCode.js +1 -4
- package/dist/cjs/analyze/getClientRoutes/getRoutes.js +1 -1
- package/dist/cjs/analyze/getClientRoutes/getRoutesLegacy.js +1 -1
- package/dist/cjs/analyze/index.js +6 -1
- package/dist/cjs/analyze/nestedRoutes.js +1 -1
- package/dist/cjs/commands/dev.js +6 -0
- package/dist/cjs/commands/serve.js +17 -0
- package/dist/cjs/schema/index.js +4 -0
- package/dist/esm/analyze/generateCode.js +1 -4
- package/dist/esm/analyze/getClientRoutes/getRoutes.js +1 -1
- package/dist/esm/analyze/getClientRoutes/getRoutesLegacy.js +1 -1
- package/dist/esm/analyze/index.js +4 -1
- package/dist/esm/analyze/nestedRoutes.js +1 -1
- package/dist/esm/commands/dev.js +6 -0
- package/dist/esm/commands/serve.js +6 -1
- package/dist/esm/schema/index.js +7 -0
- package/dist/esm-node/analyze/generateCode.js +1 -6
- package/dist/esm-node/analyze/getClientRoutes/getRoutes.js +1 -1
- package/dist/esm-node/analyze/getClientRoutes/getRoutesLegacy.js +1 -1
- package/dist/esm-node/analyze/index.js +6 -1
- package/dist/esm-node/analyze/nestedRoutes.js +1 -1
- package/dist/esm-node/commands/dev.js +6 -0
- package/dist/esm-node/commands/serve.js +18 -1
- package/dist/esm-node/schema/index.js +4 -0
- package/dist/types/analyze/templates.d.ts +2 -2
- package/lib/types.d.ts +1 -1
- package/package.json +24 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,57 @@
|
|
|
1
1
|
# @modern-js/app-tools
|
|
2
2
|
|
|
3
|
+
## 2.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- dcad887024: feat: support deferred data for streaming ssr
|
|
8
|
+
feat: 流式渲染支持 deferred data
|
|
9
|
+
- 84bfb439b8: feat: support custom apiDir, lambdaDir and style of writing for bff
|
|
10
|
+
feat: 支持定制 api 目录,lambda 目录,bff 的写法
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 0644f90567: feat: support optional params in file-based route
|
|
15
|
+
feat: 约定式路由支持可选参数
|
|
16
|
+
- 6547de8dd4: fix: use api.useResolvedConfigContext instead useResolvedConfigContext from @modern-js/core
|
|
17
|
+
fix: 使用 api.useResolvedConfigContext 代替从 @modern-js/core 中导出的 useResolvedConfigContext
|
|
18
|
+
- 1eea234fdd: chore: make test files naming consistent
|
|
19
|
+
|
|
20
|
+
chore: 统一测试文件命名为小驼峰格式
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [206c806efa]
|
|
23
|
+
- Updated dependencies [a729b0d366]
|
|
24
|
+
- Updated dependencies [dfece9dc1c]
|
|
25
|
+
- Updated dependencies [6378e26bf9]
|
|
26
|
+
- Updated dependencies [0f15fc597c]
|
|
27
|
+
- Updated dependencies [3a942a2472]
|
|
28
|
+
- Updated dependencies [5f899af53a]
|
|
29
|
+
- Updated dependencies [dcad887024]
|
|
30
|
+
- Updated dependencies [a4672f7c16]
|
|
31
|
+
- Updated dependencies [1b913372b4]
|
|
32
|
+
- Updated dependencies [ebe0d2dd6e]
|
|
33
|
+
- Updated dependencies [7fff9020e1]
|
|
34
|
+
- Updated dependencies [1eea234fdd]
|
|
35
|
+
- Updated dependencies [84bfb439b8]
|
|
36
|
+
- @modern-js/builder-rspack-provider@2.7.0
|
|
37
|
+
- @modern-js/builder-shared@2.7.0
|
|
38
|
+
- @modern-js/builder-webpack-provider@2.7.0
|
|
39
|
+
- @modern-js/core@2.7.0
|
|
40
|
+
- @modern-js/builder@2.7.0
|
|
41
|
+
- @modern-js/server@2.7.0
|
|
42
|
+
- @modern-js/utils@2.7.0
|
|
43
|
+
- @modern-js/plugin-data-loader@2.7.0
|
|
44
|
+
- @modern-js/types@2.7.0
|
|
45
|
+
- @modern-js/plugin-i18n@2.7.0
|
|
46
|
+
- @modern-js/plugin-lint@2.7.0
|
|
47
|
+
- @modern-js/prod-server@2.7.0
|
|
48
|
+
- @modern-js/node-bundle-require@2.7.0
|
|
49
|
+
- @modern-js/builder-plugin-esbuild@2.7.0
|
|
50
|
+
- @modern-js/builder-plugin-node-polyfill@2.7.0
|
|
51
|
+
- @modern-js/new-action@2.7.0
|
|
52
|
+
- @modern-js/upgrade@2.7.0
|
|
53
|
+
- @modern-js/plugin@2.7.0
|
|
54
|
+
|
|
3
55
|
## 2.6.0
|
|
4
56
|
|
|
5
57
|
### Patch Changes
|
|
@@ -33,7 +33,6 @@ __export(generateCode_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(generateCode_exports);
|
|
34
34
|
var import_path = __toESM(require("path"));
|
|
35
35
|
var import_utils = require("@modern-js/utils");
|
|
36
|
-
var import_core = require("@modern-js/core");
|
|
37
36
|
var templates = __toESM(require("./templates"));
|
|
38
37
|
var import_getClientRoutes = require("./getClientRoutes");
|
|
39
38
|
var import_constants = require("./constants");
|
|
@@ -132,7 +131,7 @@ const generateCode = async (appContext, config, entrypoints, api) => {
|
|
|
132
131
|
entrypoint,
|
|
133
132
|
routes: initialRoutes
|
|
134
133
|
});
|
|
135
|
-
const config2 =
|
|
134
|
+
const config2 = api.useResolvedConfigContext();
|
|
136
135
|
const ssr = (0, import_utils.getEntryOptions)(
|
|
137
136
|
entryName,
|
|
138
137
|
config2.server.ssr,
|
|
@@ -142,8 +141,6 @@ const generateCode = async (appContext, config, entrypoints, api) => {
|
|
|
142
141
|
let mode;
|
|
143
142
|
if (ssr) {
|
|
144
143
|
mode = typeof ssr === "object" ? ssr.mode || "string" : "string";
|
|
145
|
-
} else {
|
|
146
|
-
mode = false;
|
|
147
144
|
}
|
|
148
145
|
if (mode === "stream") {
|
|
149
146
|
const hasPageRoute = routes.some(
|
|
@@ -97,7 +97,7 @@ const recursiveReadDir = ({
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
const route = {
|
|
100
|
-
path: `${basePath}${dynamicRouteMatched ? `:${dynamicRouteMatched[1]}${dynamicRouteMatched[2]}` : filename}`,
|
|
100
|
+
path: `${basePath}${dynamicRouteMatched ? `:${dynamicRouteMatched[1].replace(/\$$/, "?")}${dynamicRouteMatched[2]}` : filename}`,
|
|
101
101
|
_component: alias,
|
|
102
102
|
component: componentName,
|
|
103
103
|
parent,
|
|
@@ -97,7 +97,7 @@ const recursiveReadDirLegacy = ({
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
const route = {
|
|
100
|
-
path: `${basePath}${dynamicRouteMatched ? `:${dynamicRouteMatched[1]}${dynamicRouteMatched[2]}` : filename}`,
|
|
100
|
+
path: `${basePath}${dynamicRouteMatched ? `:${dynamicRouteMatched[1].replace(/\$$/, "?")}${dynamicRouteMatched[2]}` : filename}`,
|
|
101
101
|
_component: alias,
|
|
102
102
|
component: componentName,
|
|
103
103
|
exact: true,
|
|
@@ -33,6 +33,7 @@ module.exports = __toCommonJS(analyze_exports);
|
|
|
33
33
|
var path = __toESM(require("path"));
|
|
34
34
|
var import_utils = require("@modern-js/utils");
|
|
35
35
|
var import_lodash = require("@modern-js/utils/lodash");
|
|
36
|
+
var import_builder_shared = require("@modern-js/builder-shared");
|
|
36
37
|
var import_printInstructions = require("../utils/printInstructions");
|
|
37
38
|
var import_routes = require("../utils/routes");
|
|
38
39
|
var import_config = require("../utils/config");
|
|
@@ -205,11 +206,15 @@ var analyze_default = ({
|
|
|
205
206
|
packageName
|
|
206
207
|
);
|
|
207
208
|
if (entrypoint.nestedRoutesEntry && ssr && name === "server") {
|
|
209
|
+
const serverLoaderRuntime = require.resolve("@modern-js/plugin-data-loader/runtime");
|
|
208
210
|
const serverLoadersFile = (0, import_utils2.getServerLoadersFile)(
|
|
209
211
|
internalDirectory,
|
|
210
212
|
entryName
|
|
211
213
|
);
|
|
212
|
-
|
|
214
|
+
const combinedModule = (0, import_builder_shared.createVirtualModule)(
|
|
215
|
+
`export * from "${serverLoaderRuntime}"; export * from "${serverLoadersFile}"`
|
|
216
|
+
);
|
|
217
|
+
chain.entry(`${entryName}-server-loaders`).add(combinedModule);
|
|
213
218
|
}
|
|
214
219
|
});
|
|
215
220
|
}
|
package/dist/cjs/commands/dev.js
CHANGED
|
@@ -63,6 +63,12 @@ const dev = async (api, options) => {
|
|
|
63
63
|
host: normalizedConfig.dev.host,
|
|
64
64
|
...(_a = normalizedConfig.tools) == null ? void 0 : _a.devServer
|
|
65
65
|
},
|
|
66
|
+
appContext: {
|
|
67
|
+
appDirectory: appContext.appDirectory,
|
|
68
|
+
sharedDirectory: appContext.sharedDirectory,
|
|
69
|
+
apiDirectory: appContext.apiDirectory,
|
|
70
|
+
lambdaDirectory: appContext.lambdaDirectory
|
|
71
|
+
},
|
|
66
72
|
pwd: appDirectory,
|
|
67
73
|
config: normalizedConfig,
|
|
68
74
|
serverConfigFile,
|
|
@@ -50,6 +50,23 @@ const start = async (api) => {
|
|
|
50
50
|
const app = await (0, import_prod_server.default)({
|
|
51
51
|
pwd: appDirectory,
|
|
52
52
|
config: userConfig,
|
|
53
|
+
appContext: {
|
|
54
|
+
sharedDirectory: (0, import_utils.getTargetDir)(
|
|
55
|
+
appContext.sharedDirectory,
|
|
56
|
+
appContext.appDirectory,
|
|
57
|
+
appContext.distDirectory
|
|
58
|
+
),
|
|
59
|
+
apiDirectory: (0, import_utils.getTargetDir)(
|
|
60
|
+
appContext.apiDirectory,
|
|
61
|
+
appContext.appDirectory,
|
|
62
|
+
appContext.distDirectory
|
|
63
|
+
),
|
|
64
|
+
lambdaDirectory: (0, import_utils.getTargetDir)(
|
|
65
|
+
appContext.lambdaDirectory,
|
|
66
|
+
appContext.appDirectory,
|
|
67
|
+
appContext.distDirectory
|
|
68
|
+
)
|
|
69
|
+
},
|
|
53
70
|
serverConfigFile,
|
|
54
71
|
internalPlugins: (0, import_createServer.injectDataLoaderPlugin)(serverInternalPlugins),
|
|
55
72
|
apiOnly
|
package/dist/cjs/schema/index.js
CHANGED
|
@@ -149,7 +149,6 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
149
149
|
};
|
|
150
150
|
import path from "path";
|
|
151
151
|
import { fs, getEntryOptions, isRouterV5, logger } from "@modern-js/utils";
|
|
152
|
-
import { useResolvedConfigContext } from "@modern-js/core";
|
|
153
152
|
import * as templates from "./templates";
|
|
154
153
|
import { getClientRoutes, getClientRoutesLegacy } from "./getClientRoutes";
|
|
155
154
|
import { FILE_SYSTEM_ROUTES_FILE_NAME, ENTRY_POINT_FILE_NAME, ENTRY_BOOTSTRAP_FILE_NAME } from "./constants";
|
|
@@ -297,12 +296,10 @@ var generateCode = function() {
|
|
|
297
296
|
];
|
|
298
297
|
case 3:
|
|
299
298
|
routes = _state.sent().routes;
|
|
300
|
-
config2 = useResolvedConfigContext();
|
|
299
|
+
config2 = api.useResolvedConfigContext();
|
|
301
300
|
ssr = getEntryOptions(entryName, config2.server.ssr, config2.server.ssrByEntries, packageName);
|
|
302
301
|
if (ssr) {
|
|
303
302
|
mode = typeof ssr === "object" ? ssr.mode || "string" : "string";
|
|
304
|
-
} else {
|
|
305
|
-
mode = false;
|
|
306
303
|
}
|
|
307
304
|
if (mode === "stream") {
|
|
308
305
|
hasPageRoute = routes.some(function(route) {
|
|
@@ -111,7 +111,7 @@ var recursiveReadDir = function(param) {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
var route1 = {
|
|
114
|
-
path: "".concat(basePath).concat(dynamicRouteMatched ? ":".concat(dynamicRouteMatched[1]).concat(dynamicRouteMatched[2]) : filename),
|
|
114
|
+
path: "".concat(basePath).concat(dynamicRouteMatched ? ":".concat(dynamicRouteMatched[1].replace(/\$$/, "?")).concat(dynamicRouteMatched[2]) : filename),
|
|
115
115
|
_component: alias1,
|
|
116
116
|
component: componentName1,
|
|
117
117
|
parent: parent,
|
|
@@ -111,7 +111,7 @@ var recursiveReadDirLegacy = function(param) {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
var route1 = {
|
|
114
|
-
path: "".concat(basePath).concat(dynamicRouteMatched ? ":".concat(dynamicRouteMatched[1]).concat(dynamicRouteMatched[2]) : filename),
|
|
114
|
+
path: "".concat(basePath).concat(dynamicRouteMatched ? ":".concat(dynamicRouteMatched[1].replace(/\$$/, "?")).concat(dynamicRouteMatched[2]) : filename),
|
|
115
115
|
_component: alias1,
|
|
116
116
|
component: componentName1,
|
|
117
117
|
exact: true,
|
|
@@ -223,6 +223,7 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
223
223
|
import * as path from "path";
|
|
224
224
|
import { createDebugger, findExists, fs, getEntryOptions, isApiOnly, minimist, getCommand, isDevCommand } from "@modern-js/utils";
|
|
225
225
|
import { cloneDeep } from "@modern-js/utils/lodash";
|
|
226
|
+
import { createVirtualModule } from "@modern-js/builder-shared";
|
|
226
227
|
import { printInstructions } from "../utils/printInstructions";
|
|
227
228
|
import { generateRoutes } from "../utils/routes";
|
|
228
229
|
import { emitResolvedConfig } from "../utils/config";
|
|
@@ -554,8 +555,10 @@ var analyze_default = function(param) {
|
|
|
554
555
|
var entryName = entrypoint.entryName;
|
|
555
556
|
var ssr = getEntryOptions(entryName, resolvedConfig.server.ssr, resolvedConfig.server.ssrByEntries, packageName);
|
|
556
557
|
if (entrypoint.nestedRoutesEntry && ssr && name === "server") {
|
|
558
|
+
var serverLoaderRuntime = require.resolve("@modern-js/plugin-data-loader/runtime");
|
|
557
559
|
var serverLoadersFile = getServerLoadersFile(internalDirectory, entryName);
|
|
558
|
-
|
|
560
|
+
var combinedModule = createVirtualModule('export * from "'.concat(serverLoaderRuntime, '"; export * from "').concat(serverLoadersFile, '"'));
|
|
561
|
+
chain.entry("".concat(entryName, "-server-loaders")).add(combinedModule);
|
|
559
562
|
}
|
|
560
563
|
});
|
|
561
564
|
}
|
package/dist/esm/commands/dev.js
CHANGED
|
@@ -240,6 +240,12 @@ var dev = function() {
|
|
|
240
240
|
https: normalizedConfig.dev.https,
|
|
241
241
|
host: normalizedConfig.dev.host
|
|
242
242
|
}, (_normalizedConfig_tools = normalizedConfig.tools) === null || _normalizedConfig_tools === void 0 ? void 0 : _normalizedConfig_tools.devServer),
|
|
243
|
+
appContext: {
|
|
244
|
+
appDirectory: appContext.appDirectory,
|
|
245
|
+
sharedDirectory: appContext.sharedDirectory,
|
|
246
|
+
apiDirectory: appContext.apiDirectory,
|
|
247
|
+
lambdaDirectory: appContext.lambdaDirectory
|
|
248
|
+
},
|
|
243
249
|
pwd: appDirectory,
|
|
244
250
|
config: normalizedConfig,
|
|
245
251
|
serverConfigFile: serverConfigFile,
|
|
@@ -122,7 +122,7 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
124
|
};
|
|
125
|
-
import { logger, chalk, isApiOnly } from "@modern-js/utils";
|
|
125
|
+
import { logger, chalk, isApiOnly, getTargetDir } from "@modern-js/utils";
|
|
126
126
|
import server from "@modern-js/prod-server";
|
|
127
127
|
import { printInstructions } from "../utils/printInstructions";
|
|
128
128
|
import { injectDataLoaderPlugin } from "../utils/createServer";
|
|
@@ -155,6 +155,11 @@ var start = function() {
|
|
|
155
155
|
server({
|
|
156
156
|
pwd: appDirectory,
|
|
157
157
|
config: userConfig,
|
|
158
|
+
appContext: {
|
|
159
|
+
sharedDirectory: getTargetDir(appContext.sharedDirectory, appContext.appDirectory, appContext.distDirectory),
|
|
160
|
+
apiDirectory: getTargetDir(appContext.apiDirectory, appContext.appDirectory, appContext.distDirectory),
|
|
161
|
+
lambdaDirectory: getTargetDir(appContext.lambdaDirectory, appContext.appDirectory, appContext.distDirectory)
|
|
162
|
+
},
|
|
158
163
|
serverConfigFile: serverConfigFile,
|
|
159
164
|
internalPlugins: injectDataLoaderPlugin(serverInternalPlugins),
|
|
160
165
|
apiOnly: apiOnly
|
package/dist/esm/schema/index.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { fs, getEntryOptions, isRouterV5, logger } from "@modern-js/utils";
|
|
3
|
-
import {
|
|
4
|
-
useResolvedConfigContext
|
|
5
|
-
} from "@modern-js/core";
|
|
6
3
|
import * as templates from "./templates";
|
|
7
4
|
import { getClientRoutes, getClientRoutesLegacy } from "./getClientRoutes";
|
|
8
5
|
import {
|
|
@@ -105,7 +102,7 @@ const generateCode = async (appContext, config, entrypoints, api) => {
|
|
|
105
102
|
entrypoint,
|
|
106
103
|
routes: initialRoutes
|
|
107
104
|
});
|
|
108
|
-
const config2 = useResolvedConfigContext();
|
|
105
|
+
const config2 = api.useResolvedConfigContext();
|
|
109
106
|
const ssr = getEntryOptions(
|
|
110
107
|
entryName,
|
|
111
108
|
config2.server.ssr,
|
|
@@ -115,8 +112,6 @@ const generateCode = async (appContext, config, entrypoints, api) => {
|
|
|
115
112
|
let mode;
|
|
116
113
|
if (ssr) {
|
|
117
114
|
mode = typeof ssr === "object" ? ssr.mode || "string" : "string";
|
|
118
|
-
} else {
|
|
119
|
-
mode = false;
|
|
120
115
|
}
|
|
121
116
|
if (mode === "stream") {
|
|
122
117
|
const hasPageRoute = routes.some(
|
|
@@ -70,7 +70,7 @@ const recursiveReadDir = ({
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
const route = {
|
|
73
|
-
path: `${basePath}${dynamicRouteMatched ? `:${dynamicRouteMatched[1]}${dynamicRouteMatched[2]}` : filename}`,
|
|
73
|
+
path: `${basePath}${dynamicRouteMatched ? `:${dynamicRouteMatched[1].replace(/\$$/, "?")}${dynamicRouteMatched[2]}` : filename}`,
|
|
74
74
|
_component: alias,
|
|
75
75
|
component: componentName,
|
|
76
76
|
parent,
|
|
@@ -70,7 +70,7 @@ const recursiveReadDirLegacy = ({
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
const route = {
|
|
73
|
-
path: `${basePath}${dynamicRouteMatched ? `:${dynamicRouteMatched[1]}${dynamicRouteMatched[2]}` : filename}`,
|
|
73
|
+
path: `${basePath}${dynamicRouteMatched ? `:${dynamicRouteMatched[1].replace(/\$$/, "?")}${dynamicRouteMatched[2]}` : filename}`,
|
|
74
74
|
_component: alias,
|
|
75
75
|
component: componentName,
|
|
76
76
|
exact: true,
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
isDevCommand
|
|
11
11
|
} from "@modern-js/utils";
|
|
12
12
|
import { cloneDeep } from "@modern-js/utils/lodash";
|
|
13
|
+
import { createVirtualModule } from "@modern-js/builder-shared";
|
|
13
14
|
import { printInstructions } from "../utils/printInstructions";
|
|
14
15
|
import { generateRoutes } from "../utils/routes";
|
|
15
16
|
import { emitResolvedConfig } from "../utils/config";
|
|
@@ -191,11 +192,15 @@ var analyze_default = ({
|
|
|
191
192
|
packageName
|
|
192
193
|
);
|
|
193
194
|
if (entrypoint.nestedRoutesEntry && ssr && name === "server") {
|
|
195
|
+
const serverLoaderRuntime = require.resolve("@modern-js/plugin-data-loader/runtime");
|
|
194
196
|
const serverLoadersFile = getServerLoadersFile(
|
|
195
197
|
internalDirectory,
|
|
196
198
|
entryName
|
|
197
199
|
);
|
|
198
|
-
|
|
200
|
+
const combinedModule = createVirtualModule(
|
|
201
|
+
`export * from "${serverLoaderRuntime}"; export * from "${serverLoadersFile}"`
|
|
202
|
+
);
|
|
203
|
+
chain.entry(`${entryName}-server-loaders`).add(combinedModule);
|
|
199
204
|
}
|
|
200
205
|
});
|
|
201
206
|
}
|
|
@@ -45,6 +45,12 @@ const dev = async (api, options) => {
|
|
|
45
45
|
host: normalizedConfig.dev.host,
|
|
46
46
|
...(_a = normalizedConfig.tools) == null ? void 0 : _a.devServer
|
|
47
47
|
},
|
|
48
|
+
appContext: {
|
|
49
|
+
appDirectory: appContext.appDirectory,
|
|
50
|
+
sharedDirectory: appContext.sharedDirectory,
|
|
51
|
+
apiDirectory: appContext.apiDirectory,
|
|
52
|
+
lambdaDirectory: appContext.lambdaDirectory
|
|
53
|
+
},
|
|
48
54
|
pwd: appDirectory,
|
|
49
55
|
config: normalizedConfig,
|
|
50
56
|
serverConfigFile,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { logger, chalk, isApiOnly } from "@modern-js/utils";
|
|
1
|
+
import { logger, chalk, isApiOnly, getTargetDir } from "@modern-js/utils";
|
|
2
2
|
import server from "@modern-js/prod-server";
|
|
3
3
|
import { printInstructions } from "../utils/printInstructions";
|
|
4
4
|
import { injectDataLoaderPlugin } from "../utils/createServer";
|
|
@@ -18,6 +18,23 @@ const start = async (api) => {
|
|
|
18
18
|
const app = await server({
|
|
19
19
|
pwd: appDirectory,
|
|
20
20
|
config: userConfig,
|
|
21
|
+
appContext: {
|
|
22
|
+
sharedDirectory: getTargetDir(
|
|
23
|
+
appContext.sharedDirectory,
|
|
24
|
+
appContext.appDirectory,
|
|
25
|
+
appContext.distDirectory
|
|
26
|
+
),
|
|
27
|
+
apiDirectory: getTargetDir(
|
|
28
|
+
appContext.apiDirectory,
|
|
29
|
+
appContext.appDirectory,
|
|
30
|
+
appContext.distDirectory
|
|
31
|
+
),
|
|
32
|
+
lambdaDirectory: getTargetDir(
|
|
33
|
+
appContext.lambdaDirectory,
|
|
34
|
+
appContext.appDirectory,
|
|
35
|
+
appContext.distDirectory
|
|
36
|
+
)
|
|
37
|
+
},
|
|
21
38
|
serverConfigFile,
|
|
22
39
|
internalPlugins: injectDataLoaderPlugin(serverInternalPlugins),
|
|
23
40
|
apiOnly
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Entrypoint, NestedRoute, PageRoute, RouteLegacy } from '@modern-js/types';
|
|
1
|
+
import type { Entrypoint, NestedRoute, PageRoute, RouteLegacy, SSRMode } from '@modern-js/types';
|
|
2
2
|
import type { RuntimePlugin } from '../types';
|
|
3
3
|
export declare const index: ({
|
|
4
4
|
mountId,
|
|
@@ -38,7 +38,7 @@ export declare const fileSystemRoutes: ({
|
|
|
38
38
|
internalDirectory
|
|
39
39
|
}: {
|
|
40
40
|
routes: RouteLegacy[] | (NestedRoute | PageRoute)[];
|
|
41
|
-
ssrMode
|
|
41
|
+
ssrMode?: SSRMode | undefined;
|
|
42
42
|
nestedRoutesEntry?: string | undefined;
|
|
43
43
|
entryName: string;
|
|
44
44
|
internalDirectory: string;
|
package/lib/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "2.
|
|
14
|
+
"version": "2.7.0",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/cjs/index.js",
|
|
@@ -64,23 +64,23 @@
|
|
|
64
64
|
"@babel/types": "^7.18.0",
|
|
65
65
|
"es-module-lexer": "^1.1.0",
|
|
66
66
|
"esbuild": "0.15.7",
|
|
67
|
-
"@modern-js/builder": "2.
|
|
68
|
-
"@modern-js/builder-plugin-esbuild": "2.
|
|
69
|
-
"@modern-js/builder-plugin-node-polyfill": "2.
|
|
70
|
-
"@modern-js/builder-shared": "2.
|
|
71
|
-
"@modern-js/builder-webpack-provider": "2.
|
|
72
|
-
"@modern-js/core": "2.
|
|
73
|
-
"@modern-js/new-action": "2.
|
|
74
|
-
"@modern-js/node-bundle-require": "2.
|
|
75
|
-
"@modern-js/plugin": "2.
|
|
76
|
-
"@modern-js/plugin-data-loader": "2.
|
|
77
|
-
"@modern-js/plugin-i18n": "2.
|
|
78
|
-
"@modern-js/plugin-lint": "2.
|
|
79
|
-
"@modern-js/prod-server": "2.
|
|
80
|
-
"@modern-js/server": "2.
|
|
81
|
-
"@modern-js/types": "2.
|
|
82
|
-
"@modern-js/upgrade": "2.
|
|
83
|
-
"@modern-js/utils": "2.
|
|
67
|
+
"@modern-js/builder": "2.7.0",
|
|
68
|
+
"@modern-js/builder-plugin-esbuild": "2.7.0",
|
|
69
|
+
"@modern-js/builder-plugin-node-polyfill": "2.7.0",
|
|
70
|
+
"@modern-js/builder-shared": "2.7.0",
|
|
71
|
+
"@modern-js/builder-webpack-provider": "2.7.0",
|
|
72
|
+
"@modern-js/core": "2.7.0",
|
|
73
|
+
"@modern-js/new-action": "2.7.0",
|
|
74
|
+
"@modern-js/node-bundle-require": "2.7.0",
|
|
75
|
+
"@modern-js/plugin": "2.7.0",
|
|
76
|
+
"@modern-js/plugin-data-loader": "2.7.0",
|
|
77
|
+
"@modern-js/plugin-i18n": "2.7.0",
|
|
78
|
+
"@modern-js/plugin-lint": "2.7.0",
|
|
79
|
+
"@modern-js/prod-server": "2.7.0",
|
|
80
|
+
"@modern-js/server": "2.7.0",
|
|
81
|
+
"@modern-js/types": "2.7.0",
|
|
82
|
+
"@modern-js/upgrade": "2.7.0",
|
|
83
|
+
"@modern-js/utils": "2.7.0"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@types/babel__traverse": "^7.14.2",
|
|
@@ -89,14 +89,14 @@
|
|
|
89
89
|
"jest": "^27",
|
|
90
90
|
"typescript": "^4",
|
|
91
91
|
"webpack": "^5.75.0",
|
|
92
|
-
"@modern-js/builder-plugin-swc": "2.
|
|
93
|
-
"@modern-js/builder-rspack-provider": "2.
|
|
94
|
-
"@modern-js/server-core": "2.
|
|
95
|
-
"@scripts/jest-config": "2.
|
|
96
|
-
"@scripts/build": "2.
|
|
92
|
+
"@modern-js/builder-plugin-swc": "2.7.0",
|
|
93
|
+
"@modern-js/builder-rspack-provider": "2.7.0",
|
|
94
|
+
"@modern-js/server-core": "2.7.0",
|
|
95
|
+
"@scripts/jest-config": "2.7.0",
|
|
96
|
+
"@scripts/build": "2.7.0"
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
|
99
|
-
"@modern-js/builder-rspack-provider": "^2.
|
|
99
|
+
"@modern-js/builder-rspack-provider": "^2.7.0"
|
|
100
100
|
},
|
|
101
101
|
"peerDependenciesMeta": {
|
|
102
102
|
"@modern-js/builder-rspack-provider": {
|