@modern-js/app-tools 2.42.2-alpha.0 → 2.43.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/analyze/generateCode.js +3 -3
- package/dist/cjs/analyze/nestedRoutes.js +20 -19
- package/dist/cjs/analyze/utils.js +2 -2
- package/dist/cjs/builder/shared/builderPlugins/adapterHtml.js +1 -1
- package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +1 -1
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/plugins/serverBuild.js +74 -0
- package/dist/esm/analyze/generateCode.js +4 -4
- package/dist/esm/analyze/nestedRoutes.js +21 -20
- package/dist/esm/analyze/utils.js +2 -2
- package/dist/esm/builder/shared/builderPlugins/adapterHtml.js +1 -1
- package/dist/esm/builder/shared/builderPlugins/adapterSSR.js +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/plugins/serverBuild.js +70 -0
- package/dist/esm-node/analyze/generateCode.js +3 -3
- package/dist/esm-node/analyze/nestedRoutes.js +20 -19
- package/dist/esm-node/analyze/utils.js +2 -2
- package/dist/esm-node/builder/shared/builderPlugins/adapterHtml.js +1 -1
- package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.js +1 -1
- package/dist/esm-node/index.js +2 -0
- package/dist/esm-node/plugins/serverBuild.js +44 -0
- package/dist/types/analyze/utils.d.ts +2 -2
- package/dist/types/plugins/serverBuild.d.ts +3 -0
- package/package.json +27 -26
@@ -85,7 +85,7 @@ ${initialize || ""}`);
|
|
85
85
|
${initialize || ""}`).join("\n");
|
86
86
|
};
|
87
87
|
const generateCode = async (appContext, config, entrypoints, api) => {
|
88
|
-
const { internalDirectory, srcDirectory, internalDirAlias, internalSrcAlias, packageName } = appContext;
|
88
|
+
const { internalDirectory, srcDirectory, appDirectory, internalDirAlias, internalSrcAlias, packageName } = appContext;
|
89
89
|
const hookRunners = api.useHookRunners();
|
90
90
|
const isV5 = (0, import_utils.isRouterV5)(config);
|
91
91
|
const getRoutes = isV5 ? import_getClientRoutes.getClientRoutesLegacy : import_getClientRoutes.getClientRoutes;
|
@@ -176,9 +176,9 @@ const generateCode = async (appContext, config, entrypoints, api) => {
|
|
176
176
|
imports: (0, import_utils2.getDefaultImports)({
|
177
177
|
entrypoint,
|
178
178
|
srcDirectory,
|
179
|
+
appDirectory,
|
179
180
|
internalSrcAlias,
|
180
|
-
internalDirAlias
|
181
|
-
internalDirectory
|
181
|
+
internalDirAlias
|
182
182
|
})
|
183
183
|
});
|
184
184
|
importsStatemets.set(entryName, imports);
|
@@ -143,6 +143,7 @@ const walk = async (dirname, rootDir, alias, entryName, isMainEntry, oldVersion)
|
|
143
143
|
const items = await import_utils.fs.readdir(dirname);
|
144
144
|
for (const item of items) {
|
145
145
|
const itemPath = path.join(dirname, item);
|
146
|
+
const itemPathWithAlias = (0, import_utils2.replaceWithAlias)(alias.basename, itemPath, alias.name);
|
146
147
|
const extname = path.extname(item);
|
147
148
|
const itemWithoutExt = item.slice(0, -extname.length);
|
148
149
|
const isDirectory2 = (await import_utils.fs.stat(itemPath)).isDirectory();
|
@@ -158,45 +159,45 @@ const walk = async (dirname, rootDir, alias, entryName, isMainEntry, oldVersion)
|
|
158
159
|
}
|
159
160
|
if (itemWithoutExt === import_constants.NESTED_ROUTE.LAYOUT_LOADER_FILE) {
|
160
161
|
if (!route.loader) {
|
161
|
-
route.loader =
|
162
|
+
route.loader = itemPathWithAlias;
|
162
163
|
}
|
163
164
|
}
|
164
165
|
if (itemWithoutExt === import_constants.NESTED_ROUTE.LAYOUT_CLIENT_LOADER) {
|
165
|
-
route.clientData =
|
166
|
+
route.clientData = itemPathWithAlias;
|
166
167
|
}
|
167
168
|
if (itemWithoutExt === import_constants.NESTED_ROUTE.LAYOUT_DATA_FILE) {
|
168
|
-
route.data =
|
169
|
+
route.data = itemPathWithAlias;
|
169
170
|
if (await (0, import_utils2.hasAction)(itemPath)) {
|
170
|
-
route.action =
|
171
|
+
route.action = itemPathWithAlias;
|
171
172
|
}
|
172
173
|
}
|
173
174
|
if (itemWithoutExt === import_constants.NESTED_ROUTE.LAYOUT_CONFIG_FILE) {
|
174
175
|
if (!route.config) {
|
175
|
-
route.config =
|
176
|
+
route.config = itemPathWithAlias;
|
176
177
|
}
|
177
178
|
}
|
178
179
|
if (itemWithoutExt === import_constants.NESTED_ROUTE.LAYOUT_FILE) {
|
179
|
-
route._component =
|
180
|
+
route._component = itemPathWithAlias;
|
180
181
|
}
|
181
182
|
if (itemWithoutExt === import_constants.NESTED_ROUTE.PAGE_LOADER_FILE) {
|
182
|
-
pageLoaderFile =
|
183
|
+
pageLoaderFile = itemPathWithAlias;
|
183
184
|
}
|
184
185
|
if (itemWithoutExt === import_constants.NESTED_ROUTE.PAGE_CLIENT_LOADER) {
|
185
|
-
pageClientData =
|
186
|
+
pageClientData = itemPathWithAlias;
|
186
187
|
}
|
187
188
|
if (itemWithoutExt === import_constants.NESTED_ROUTE.PAGE_DATA_FILE) {
|
188
|
-
pageData =
|
189
|
+
pageData = itemPathWithAlias;
|
189
190
|
if (await (0, import_utils2.hasAction)(itemPath)) {
|
190
|
-
pageAction =
|
191
|
+
pageAction = itemPathWithAlias;
|
191
192
|
}
|
192
193
|
}
|
193
194
|
if (itemWithoutExt === import_constants.NESTED_ROUTE.PAGE_CONFIG_FILE) {
|
194
|
-
pageConfigFile =
|
195
|
+
pageConfigFile = itemPathWithAlias;
|
195
196
|
}
|
196
197
|
if (itemWithoutExt === import_constants.NESTED_ROUTE.PAGE_FILE) {
|
197
198
|
var _route_children1;
|
198
199
|
pageRoute = createIndexRoute({
|
199
|
-
_component:
|
200
|
+
_component: itemPathWithAlias
|
200
201
|
}, rootDir, itemPath, entryName, isMainEntry);
|
201
202
|
if (pageLoaderFile) {
|
202
203
|
pageRoute.loader = pageLoaderFile;
|
@@ -216,10 +217,10 @@ const walk = async (dirname, rootDir, alias, entryName, isMainEntry, oldVersion)
|
|
216
217
|
(_route_children1 = route.children) === null || _route_children1 === void 0 ? void 0 : _route_children1.push(pageRoute);
|
217
218
|
}
|
218
219
|
if (itemWithoutExt === import_constants.NESTED_ROUTE.SPLATE_LOADER_FILE) {
|
219
|
-
splatLoaderFile =
|
220
|
+
splatLoaderFile = itemPathWithAlias;
|
220
221
|
}
|
221
222
|
if (itemWithoutExt === import_constants.NESTED_ROUTE.SPLATE_CLIENT_DATA) {
|
222
|
-
splatClientData =
|
223
|
+
splatClientData = itemPathWithAlias;
|
223
224
|
}
|
224
225
|
if (itemWithoutExt === import_constants.NESTED_ROUTE.SPLATE_CONFIG_FILE) {
|
225
226
|
if (!route.config) {
|
@@ -227,15 +228,15 @@ const walk = async (dirname, rootDir, alias, entryName, isMainEntry, oldVersion)
|
|
227
228
|
}
|
228
229
|
}
|
229
230
|
if (itemWithoutExt === import_constants.NESTED_ROUTE.SPLATE_DATA_FILE) {
|
230
|
-
splatData =
|
231
|
+
splatData = itemPathWithAlias;
|
231
232
|
if (await (0, import_utils2.hasAction)(itemPath)) {
|
232
|
-
splatAction =
|
233
|
+
splatAction = itemPathWithAlias;
|
233
234
|
}
|
234
235
|
}
|
235
236
|
if (itemWithoutExt === import_constants.NESTED_ROUTE.SPLATE_FILE) {
|
236
237
|
var _route_children2;
|
237
238
|
splatRoute = createRoute({
|
238
|
-
_component:
|
239
|
+
_component: itemPathWithAlias,
|
239
240
|
path: "*"
|
240
241
|
}, rootDir, itemPath, entryName, isMainEntry);
|
241
242
|
if (splatLoaderFile) {
|
@@ -256,10 +257,10 @@ const walk = async (dirname, rootDir, alias, entryName, isMainEntry, oldVersion)
|
|
256
257
|
(_route_children2 = route.children) === null || _route_children2 === void 0 ? void 0 : _route_children2.push(splatRoute);
|
257
258
|
}
|
258
259
|
if (itemWithoutExt === import_constants.NESTED_ROUTE.LOADING_FILE) {
|
259
|
-
route.loading =
|
260
|
+
route.loading = itemPathWithAlias;
|
260
261
|
}
|
261
262
|
if (itemWithoutExt === import_constants.NESTED_ROUTE.ERROR_FILE) {
|
262
|
-
route.error =
|
263
|
+
route.error = itemPathWithAlias;
|
263
264
|
}
|
264
265
|
}
|
265
266
|
let finalRoute = createRoute(route, rootDir, path.join(dirname, `${import_constants.NESTED_ROUTE.LAYOUT_FILE}.ts`), entryName, isMainEntry);
|
@@ -61,7 +61,7 @@ const walkDirectory = (dir) => import_fs.default.readdirSync(dir).reduce((previo
|
|
61
61
|
];
|
62
62
|
}
|
63
63
|
}, []);
|
64
|
-
const getDefaultImports = ({ entrypoint, srcDirectory, internalSrcAlias, internalDirAlias
|
64
|
+
const getDefaultImports = ({ entrypoint, srcDirectory, appDirectory, internalSrcAlias, internalDirAlias }) => {
|
65
65
|
const { entryName, fileSystemRoutes, customBootstrap, entry } = entrypoint;
|
66
66
|
const imports = [
|
67
67
|
{
|
@@ -78,7 +78,7 @@ const getDefaultImports = ({ entrypoint, srcDirectory, internalSrcAlias, interna
|
|
78
78
|
local: "ReactDOM"
|
79
79
|
}
|
80
80
|
],
|
81
|
-
value: (0, import_utils.isReact18)(import_path.default.join(
|
81
|
+
value: (0, import_utils.isReact18)(import_path.default.join(appDirectory)) ? "react-dom/client" : "react-dom"
|
82
82
|
},
|
83
83
|
{
|
84
84
|
specifiers: [
|
@@ -73,7 +73,7 @@ function applyBottomHtmlPlugin({ api, chain, options, CHAIN_ID, HtmlBundlerPlugi
|
|
73
73
|
}
|
74
74
|
]);
|
75
75
|
}
|
76
|
-
chain.plugin(
|
76
|
+
chain.plugin("bottom-template").use(import_bundlerPlugins.BottomTemplatePlugin, [
|
77
77
|
HtmlBundlerPlugin
|
78
78
|
]);
|
79
79
|
}
|
@@ -53,7 +53,7 @@ const builderPluginAdapterSSR = (options) => ({
|
|
53
53
|
api.modifyBundlerChain(async (chain, { target, CHAIN_ID, isProd, HtmlPlugin: HtmlBundlerPlugin, isServer }) => {
|
54
54
|
const builderConfig = api.getNormalizedConfig();
|
55
55
|
const { normalizedConfig: normalizedConfig2 } = options;
|
56
|
-
applyRouterPlugin(chain,
|
56
|
+
applyRouterPlugin(chain, "route-plugin", options, HtmlBundlerPlugin);
|
57
57
|
if ((0, import_utils.isSSR)(normalizedConfig2)) {
|
58
58
|
await applySSRLoaderEntry(chain, options, isServer);
|
59
59
|
applySSRDataLoader(chain, options);
|
package/dist/cjs/index.js
CHANGED
@@ -46,6 +46,7 @@ var import_analyze = __toESM(require("./analyze"));
|
|
46
46
|
var import_initialize = __toESM(require("./initialize"));
|
47
47
|
var import_hooks = require("./hooks");
|
48
48
|
var import_locale = require("./locale");
|
49
|
+
var import_serverBuild = __toESM(require("./plugins/serverBuild"));
|
49
50
|
var import_restart = require("./utils/restart");
|
50
51
|
var import_generateWatchFiles = require("./utils/generateWatchFiles");
|
51
52
|
var import_core = require("@modern-js/core");
|
@@ -118,6 +119,7 @@ const appTools = (options = {
|
|
118
119
|
(0, import_analyze.default)({
|
119
120
|
bundler: (options === null || options === void 0 ? void 0 : options.bundler) === "experimental-rspack" ? "rspack" : "webpack"
|
120
121
|
}),
|
122
|
+
(0, import_serverBuild.default)(),
|
121
123
|
(0, import_plugin_lint.lintPlugin)()
|
122
124
|
],
|
123
125
|
setup: (api) => {
|
@@ -0,0 +1,74 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __create = Object.create;
|
3
|
+
var __defProp = Object.defineProperty;
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __export = (target, all) => {
|
9
|
+
for (var name in all)
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
+
};
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
14
|
+
for (let key of __getOwnPropNames(from))
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
17
|
+
}
|
18
|
+
return to;
|
19
|
+
};
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26
|
+
mod
|
27
|
+
));
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
+
var serverBuild_exports = {};
|
30
|
+
__export(serverBuild_exports, {
|
31
|
+
default: () => serverBuild_default
|
32
|
+
});
|
33
|
+
module.exports = __toCommonJS(serverBuild_exports);
|
34
|
+
var import_path = __toESM(require("path"));
|
35
|
+
var import_fs = __toESM(require("fs"));
|
36
|
+
var import_utils = require("@modern-js/utils");
|
37
|
+
var import_server_utils = require("@modern-js/server-utils");
|
38
|
+
const TS_CONFIG_FILENAME = "tsconfig.json";
|
39
|
+
var serverBuild_default = () => ({
|
40
|
+
name: "@modern-js/server-build",
|
41
|
+
setup(api) {
|
42
|
+
return {
|
43
|
+
async afterBuild() {
|
44
|
+
const { appDirectory, distDirectory } = api.useAppContext();
|
45
|
+
const modernConfig = api.useResolvedConfigContext();
|
46
|
+
const distDir = import_path.default.resolve(distDirectory);
|
47
|
+
const serverDir = import_path.default.resolve(appDirectory, import_utils.SERVER_DIR);
|
48
|
+
const sharedDir = import_path.default.resolve(appDirectory, import_utils.SHARED_DIR);
|
49
|
+
const tsconfigPath = import_path.default.resolve(appDirectory, TS_CONFIG_FILENAME);
|
50
|
+
const sourceDirs = [];
|
51
|
+
if (import_fs.default.existsSync(serverDir)) {
|
52
|
+
sourceDirs.push(serverDir);
|
53
|
+
if (import_fs.default.existsSync(sharedDir)) {
|
54
|
+
sourceDirs.push(sharedDir);
|
55
|
+
}
|
56
|
+
}
|
57
|
+
const { server } = modernConfig;
|
58
|
+
const { alias } = modernConfig.source;
|
59
|
+
const { babel } = modernConfig.tools;
|
60
|
+
if (sourceDirs.length > 0) {
|
61
|
+
await (0, import_server_utils.compile)(appDirectory, {
|
62
|
+
server,
|
63
|
+
alias,
|
64
|
+
babelConfig: babel
|
65
|
+
}, {
|
66
|
+
sourceDirs,
|
67
|
+
distDir,
|
68
|
+
tsconfigPath
|
69
|
+
});
|
70
|
+
}
|
71
|
+
}
|
72
|
+
};
|
73
|
+
}
|
74
|
+
});
|
@@ -94,7 +94,7 @@ var createImportStatements = function(statements) {
|
|
94
94
|
};
|
95
95
|
var generateCode = function() {
|
96
96
|
var _ref = _async_to_generator(function(appContext, config, entrypoints, api) {
|
97
|
-
var internalDirectory, srcDirectory, internalDirAlias, internalSrcAlias, packageName, hookRunners, isV5, getRoutes, importsStatemets, oldVersion;
|
97
|
+
var internalDirectory, srcDirectory, appDirectory, internalDirAlias, internalSrcAlias, packageName, hookRunners, isV5, getRoutes, importsStatemets, oldVersion;
|
98
98
|
function generateEntryCode(entrypoint) {
|
99
99
|
return _generateEntryCode.apply(this, arguments);
|
100
100
|
}
|
@@ -265,9 +265,9 @@ var generateCode = function() {
|
|
265
265
|
imports: getDefaultImports({
|
266
266
|
entrypoint,
|
267
267
|
srcDirectory,
|
268
|
+
appDirectory,
|
268
269
|
internalSrcAlias,
|
269
|
-
internalDirAlias
|
270
|
-
internalDirectory
|
270
|
+
internalDirAlias
|
271
271
|
})
|
272
272
|
})
|
273
273
|
];
|
@@ -289,7 +289,7 @@ var generateCode = function() {
|
|
289
289
|
return _ts_generator(this, function(_state) {
|
290
290
|
switch (_state.label) {
|
291
291
|
case 0:
|
292
|
-
internalDirectory = appContext.internalDirectory, srcDirectory = appContext.srcDirectory, internalDirAlias = appContext.internalDirAlias, internalSrcAlias = appContext.internalSrcAlias, packageName = appContext.packageName;
|
292
|
+
internalDirectory = appContext.internalDirectory, srcDirectory = appContext.srcDirectory, appDirectory = appContext.appDirectory, internalDirAlias = appContext.internalDirAlias, internalSrcAlias = appContext.internalSrcAlias, packageName = appContext.packageName;
|
293
293
|
hookRunners = api.useHookRunners();
|
294
294
|
isV5 = isRouterV5(config);
|
295
295
|
getRoutes = isV5 ? getClientRoutesLegacy : getClientRoutes;
|
@@ -70,7 +70,7 @@ var optimizeRoute = function(routeTree) {
|
|
70
70
|
};
|
71
71
|
var walk = function() {
|
72
72
|
var _ref = _async_to_generator(function(dirname, rootDir, alias, entryName, isMainEntry, oldVersion) {
|
73
|
-
var _finalRoute_children, isDirectory, relativeDir, pathSegments, lastSegment, isRoot, isPathlessLayout, isWithoutLayoutPath, routePath, route, pageLoaderFile, pageRoute, pageConfigFile, pageClientData, pageData, pageAction, splatLoaderFile, splatRoute, splatConfigFile, splatClientData, splatData, splatAction, items, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, item, itemPath, extname, itemWithoutExt, isDirectory1, childRoute, _route_children, _route_children1, _route_children2, err, finalRoute, childRoutes, childRoute1, _$path, optimizedRoutes;
|
73
|
+
var _finalRoute_children, isDirectory, relativeDir, pathSegments, lastSegment, isRoot, isPathlessLayout, isWithoutLayoutPath, routePath, route, pageLoaderFile, pageRoute, pageConfigFile, pageClientData, pageData, pageAction, splatLoaderFile, splatRoute, splatConfigFile, splatClientData, splatData, splatAction, items, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, item, itemPath, itemPathWithAlias, extname, itemWithoutExt, isDirectory1, childRoute, _route_children, _route_children1, _route_children2, err, finalRoute, childRoutes, childRoute1, _$path, optimizedRoutes;
|
74
74
|
return _ts_generator(this, function(_state) {
|
75
75
|
switch (_state.label) {
|
76
76
|
case 0:
|
@@ -150,6 +150,7 @@ var walk = function() {
|
|
150
150
|
];
|
151
151
|
item = _step.value;
|
152
152
|
itemPath = path.join(dirname, item);
|
153
|
+
itemPathWithAlias = replaceWithAlias(alias.basename, itemPath, alias.name);
|
153
154
|
extname = path.extname(item);
|
154
155
|
itemWithoutExt = item.slice(0, -extname.length);
|
155
156
|
return [
|
@@ -183,65 +184,65 @@ var walk = function() {
|
|
183
184
|
}
|
184
185
|
if (itemWithoutExt === NESTED_ROUTE.LAYOUT_LOADER_FILE) {
|
185
186
|
if (!route.loader) {
|
186
|
-
route.loader =
|
187
|
+
route.loader = itemPathWithAlias;
|
187
188
|
}
|
188
189
|
}
|
189
190
|
if (itemWithoutExt === NESTED_ROUTE.LAYOUT_CLIENT_LOADER) {
|
190
|
-
route.clientData =
|
191
|
+
route.clientData = itemPathWithAlias;
|
191
192
|
}
|
192
193
|
if (!(itemWithoutExt === NESTED_ROUTE.LAYOUT_DATA_FILE))
|
193
194
|
return [
|
194
195
|
3,
|
195
196
|
10
|
196
197
|
];
|
197
|
-
route.data =
|
198
|
+
route.data = itemPathWithAlias;
|
198
199
|
return [
|
199
200
|
4,
|
200
201
|
hasAction(itemPath)
|
201
202
|
];
|
202
203
|
case 9:
|
203
204
|
if (_state.sent()) {
|
204
|
-
route.action =
|
205
|
+
route.action = itemPathWithAlias;
|
205
206
|
}
|
206
207
|
_state.label = 10;
|
207
208
|
case 10:
|
208
209
|
if (itemWithoutExt === NESTED_ROUTE.LAYOUT_CONFIG_FILE) {
|
209
210
|
if (!route.config) {
|
210
|
-
route.config =
|
211
|
+
route.config = itemPathWithAlias;
|
211
212
|
}
|
212
213
|
}
|
213
214
|
if (itemWithoutExt === NESTED_ROUTE.LAYOUT_FILE) {
|
214
|
-
route._component =
|
215
|
+
route._component = itemPathWithAlias;
|
215
216
|
}
|
216
217
|
if (itemWithoutExt === NESTED_ROUTE.PAGE_LOADER_FILE) {
|
217
|
-
pageLoaderFile =
|
218
|
+
pageLoaderFile = itemPathWithAlias;
|
218
219
|
}
|
219
220
|
if (itemWithoutExt === NESTED_ROUTE.PAGE_CLIENT_LOADER) {
|
220
|
-
pageClientData =
|
221
|
+
pageClientData = itemPathWithAlias;
|
221
222
|
}
|
222
223
|
if (!(itemWithoutExt === NESTED_ROUTE.PAGE_DATA_FILE))
|
223
224
|
return [
|
224
225
|
3,
|
225
226
|
12
|
226
227
|
];
|
227
|
-
pageData =
|
228
|
+
pageData = itemPathWithAlias;
|
228
229
|
return [
|
229
230
|
4,
|
230
231
|
hasAction(itemPath)
|
231
232
|
];
|
232
233
|
case 11:
|
233
234
|
if (_state.sent()) {
|
234
|
-
pageAction =
|
235
|
+
pageAction = itemPathWithAlias;
|
235
236
|
}
|
236
237
|
_state.label = 12;
|
237
238
|
case 12:
|
238
239
|
if (itemWithoutExt === NESTED_ROUTE.PAGE_CONFIG_FILE) {
|
239
|
-
pageConfigFile =
|
240
|
+
pageConfigFile = itemPathWithAlias;
|
240
241
|
}
|
241
242
|
if (itemWithoutExt === NESTED_ROUTE.PAGE_FILE) {
|
242
243
|
;
|
243
244
|
pageRoute = createIndexRoute({
|
244
|
-
_component:
|
245
|
+
_component: itemPathWithAlias
|
245
246
|
}, rootDir, itemPath, entryName, isMainEntry);
|
246
247
|
if (pageLoaderFile) {
|
247
248
|
pageRoute.loader = pageLoaderFile;
|
@@ -261,10 +262,10 @@ var walk = function() {
|
|
261
262
|
(_route_children1 = route.children) === null || _route_children1 === void 0 ? void 0 : _route_children1.push(pageRoute);
|
262
263
|
}
|
263
264
|
if (itemWithoutExt === NESTED_ROUTE.SPLATE_LOADER_FILE) {
|
264
|
-
splatLoaderFile =
|
265
|
+
splatLoaderFile = itemPathWithAlias;
|
265
266
|
}
|
266
267
|
if (itemWithoutExt === NESTED_ROUTE.SPLATE_CLIENT_DATA) {
|
267
|
-
splatClientData =
|
268
|
+
splatClientData = itemPathWithAlias;
|
268
269
|
}
|
269
270
|
if (itemWithoutExt === NESTED_ROUTE.SPLATE_CONFIG_FILE) {
|
270
271
|
if (!route.config) {
|
@@ -276,21 +277,21 @@ var walk = function() {
|
|
276
277
|
3,
|
277
278
|
14
|
278
279
|
];
|
279
|
-
splatData =
|
280
|
+
splatData = itemPathWithAlias;
|
280
281
|
return [
|
281
282
|
4,
|
282
283
|
hasAction(itemPath)
|
283
284
|
];
|
284
285
|
case 13:
|
285
286
|
if (_state.sent()) {
|
286
|
-
splatAction =
|
287
|
+
splatAction = itemPathWithAlias;
|
287
288
|
}
|
288
289
|
_state.label = 14;
|
289
290
|
case 14:
|
290
291
|
if (itemWithoutExt === NESTED_ROUTE.SPLATE_FILE) {
|
291
292
|
;
|
292
293
|
splatRoute = createRoute({
|
293
|
-
_component:
|
294
|
+
_component: itemPathWithAlias,
|
294
295
|
path: "*"
|
295
296
|
}, rootDir, itemPath, entryName, isMainEntry);
|
296
297
|
if (splatLoaderFile) {
|
@@ -311,10 +312,10 @@ var walk = function() {
|
|
311
312
|
(_route_children2 = route.children) === null || _route_children2 === void 0 ? void 0 : _route_children2.push(splatRoute);
|
312
313
|
}
|
313
314
|
if (itemWithoutExt === NESTED_ROUTE.LOADING_FILE) {
|
314
|
-
route.loading =
|
315
|
+
route.loading = itemPathWithAlias;
|
315
316
|
}
|
316
317
|
if (itemWithoutExt === NESTED_ROUTE.ERROR_FILE) {
|
317
|
-
route.error =
|
318
|
+
route.error = itemPathWithAlias;
|
318
319
|
}
|
319
320
|
_state.label = 15;
|
320
321
|
case 15:
|
@@ -21,7 +21,7 @@ var walkDirectory = function(dir) {
|
|
21
21
|
}, []);
|
22
22
|
};
|
23
23
|
var getDefaultImports = function(param) {
|
24
|
-
var entrypoint = param.entrypoint, srcDirectory = param.srcDirectory,
|
24
|
+
var entrypoint = param.entrypoint, srcDirectory = param.srcDirectory, appDirectory = param.appDirectory, internalSrcAlias = param.internalSrcAlias, internalDirAlias = param.internalDirAlias;
|
25
25
|
var entryName = entrypoint.entryName, fileSystemRoutes = entrypoint.fileSystemRoutes, customBootstrap = entrypoint.customBootstrap, entry = entrypoint.entry;
|
26
26
|
var imports = [
|
27
27
|
{
|
@@ -38,7 +38,7 @@ var getDefaultImports = function(param) {
|
|
38
38
|
local: "ReactDOM"
|
39
39
|
}
|
40
40
|
],
|
41
|
-
value: isReact18(path.join(
|
41
|
+
value: isReact18(path.join(appDirectory)) ? "react-dom/client" : "react-dom"
|
42
42
|
},
|
43
43
|
{
|
44
44
|
specifiers: [
|
@@ -29,7 +29,7 @@ var builderPluginAdapterSSR = function(options) {
|
|
29
29
|
target = param.target, CHAIN_ID = param.CHAIN_ID, isProd = param.isProd, HtmlBundlerPlugin = param.HtmlPlugin, isServer = param.isServer;
|
30
30
|
builderConfig = api.getNormalizedConfig();
|
31
31
|
normalizedConfig2 = options.normalizedConfig;
|
32
|
-
applyRouterPlugin(chain,
|
32
|
+
applyRouterPlugin(chain, "route-plugin", options, HtmlBundlerPlugin);
|
33
33
|
if (!isSSR(normalizedConfig2))
|
34
34
|
return [
|
35
35
|
3,
|
package/dist/esm/index.js
CHANGED
@@ -11,6 +11,7 @@ import analyzePlugin from "./analyze";
|
|
11
11
|
import initializePlugin from "./initialize";
|
12
12
|
import { hooks } from "./hooks";
|
13
13
|
import { i18n, localeKeys } from "./locale";
|
14
|
+
import serverBuildPlugin from "./plugins/serverBuild";
|
14
15
|
import { restart } from "./utils/restart";
|
15
16
|
import { generateWatchFiles } from "./utils/generateWatchFiles";
|
16
17
|
import { mergeConfig } from "@modern-js/core";
|
@@ -293,6 +294,7 @@ var appTools = function() {
|
|
293
294
|
analyzePlugin({
|
294
295
|
bundler: (options === null || options === void 0 ? void 0 : options.bundler) === "experimental-rspack" ? "rspack" : "webpack"
|
295
296
|
}),
|
297
|
+
serverBuildPlugin(),
|
296
298
|
lintPlugin()
|
297
299
|
],
|
298
300
|
setup: function(api) {
|
@@ -0,0 +1,70 @@
|
|
1
|
+
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
2
|
+
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
3
|
+
import path from "path";
|
4
|
+
import fs from "fs";
|
5
|
+
import { SERVER_DIR, SHARED_DIR } from "@modern-js/utils";
|
6
|
+
import { compile } from "@modern-js/server-utils";
|
7
|
+
var TS_CONFIG_FILENAME = "tsconfig.json";
|
8
|
+
function serverBuild_default() {
|
9
|
+
return {
|
10
|
+
name: "@modern-js/server-build",
|
11
|
+
setup: function setup(api) {
|
12
|
+
return {
|
13
|
+
afterBuild: function afterBuild() {
|
14
|
+
return _async_to_generator(function() {
|
15
|
+
var _api_useAppContext, appDirectory, distDirectory, modernConfig, distDir, serverDir, sharedDir, tsconfigPath, sourceDirs, server, alias, babel;
|
16
|
+
return _ts_generator(this, function(_state) {
|
17
|
+
switch (_state.label) {
|
18
|
+
case 0:
|
19
|
+
_api_useAppContext = api.useAppContext(), appDirectory = _api_useAppContext.appDirectory, distDirectory = _api_useAppContext.distDirectory;
|
20
|
+
modernConfig = api.useResolvedConfigContext();
|
21
|
+
distDir = path.resolve(distDirectory);
|
22
|
+
serverDir = path.resolve(appDirectory, SERVER_DIR);
|
23
|
+
sharedDir = path.resolve(appDirectory, SHARED_DIR);
|
24
|
+
tsconfigPath = path.resolve(appDirectory, TS_CONFIG_FILENAME);
|
25
|
+
sourceDirs = [];
|
26
|
+
if (fs.existsSync(serverDir)) {
|
27
|
+
sourceDirs.push(serverDir);
|
28
|
+
if (fs.existsSync(sharedDir)) {
|
29
|
+
sourceDirs.push(sharedDir);
|
30
|
+
}
|
31
|
+
}
|
32
|
+
server = modernConfig.server;
|
33
|
+
alias = modernConfig.source.alias;
|
34
|
+
babel = modernConfig.tools.babel;
|
35
|
+
if (!(sourceDirs.length > 0))
|
36
|
+
return [
|
37
|
+
3,
|
38
|
+
2
|
39
|
+
];
|
40
|
+
return [
|
41
|
+
4,
|
42
|
+
compile(appDirectory, {
|
43
|
+
server,
|
44
|
+
alias,
|
45
|
+
babelConfig: babel
|
46
|
+
}, {
|
47
|
+
sourceDirs,
|
48
|
+
distDir,
|
49
|
+
tsconfigPath
|
50
|
+
})
|
51
|
+
];
|
52
|
+
case 1:
|
53
|
+
_state.sent();
|
54
|
+
_state.label = 2;
|
55
|
+
case 2:
|
56
|
+
return [
|
57
|
+
2
|
58
|
+
];
|
59
|
+
}
|
60
|
+
});
|
61
|
+
})();
|
62
|
+
}
|
63
|
+
};
|
64
|
+
}
|
65
|
+
};
|
66
|
+
}
|
67
|
+
;
|
68
|
+
export {
|
69
|
+
serverBuild_default as default
|
70
|
+
};
|
@@ -50,7 +50,7 @@ ${initialize || ""}`);
|
|
50
50
|
${initialize || ""}`).join("\n");
|
51
51
|
};
|
52
52
|
const generateCode = async (appContext, config, entrypoints, api) => {
|
53
|
-
const { internalDirectory, srcDirectory, internalDirAlias, internalSrcAlias, packageName } = appContext;
|
53
|
+
const { internalDirectory, srcDirectory, appDirectory, internalDirAlias, internalSrcAlias, packageName } = appContext;
|
54
54
|
const hookRunners = api.useHookRunners();
|
55
55
|
const isV5 = isRouterV5(config);
|
56
56
|
const getRoutes = isV5 ? getClientRoutesLegacy : getClientRoutes;
|
@@ -141,9 +141,9 @@ const generateCode = async (appContext, config, entrypoints, api) => {
|
|
141
141
|
imports: getDefaultImports({
|
142
142
|
entrypoint,
|
143
143
|
srcDirectory,
|
144
|
+
appDirectory,
|
144
145
|
internalSrcAlias,
|
145
|
-
internalDirAlias
|
146
|
-
internalDirectory
|
146
|
+
internalDirAlias
|
147
147
|
})
|
148
148
|
});
|
149
149
|
importsStatemets.set(entryName, imports);
|
@@ -108,6 +108,7 @@ const walk = async (dirname, rootDir, alias, entryName, isMainEntry, oldVersion)
|
|
108
108
|
const items = await fs.readdir(dirname);
|
109
109
|
for (const item of items) {
|
110
110
|
const itemPath = path.join(dirname, item);
|
111
|
+
const itemPathWithAlias = replaceWithAlias(alias.basename, itemPath, alias.name);
|
111
112
|
const extname = path.extname(item);
|
112
113
|
const itemWithoutExt = item.slice(0, -extname.length);
|
113
114
|
const isDirectory2 = (await fs.stat(itemPath)).isDirectory();
|
@@ -123,45 +124,45 @@ const walk = async (dirname, rootDir, alias, entryName, isMainEntry, oldVersion)
|
|
123
124
|
}
|
124
125
|
if (itemWithoutExt === NESTED_ROUTE.LAYOUT_LOADER_FILE) {
|
125
126
|
if (!route.loader) {
|
126
|
-
route.loader =
|
127
|
+
route.loader = itemPathWithAlias;
|
127
128
|
}
|
128
129
|
}
|
129
130
|
if (itemWithoutExt === NESTED_ROUTE.LAYOUT_CLIENT_LOADER) {
|
130
|
-
route.clientData =
|
131
|
+
route.clientData = itemPathWithAlias;
|
131
132
|
}
|
132
133
|
if (itemWithoutExt === NESTED_ROUTE.LAYOUT_DATA_FILE) {
|
133
|
-
route.data =
|
134
|
+
route.data = itemPathWithAlias;
|
134
135
|
if (await hasAction(itemPath)) {
|
135
|
-
route.action =
|
136
|
+
route.action = itemPathWithAlias;
|
136
137
|
}
|
137
138
|
}
|
138
139
|
if (itemWithoutExt === NESTED_ROUTE.LAYOUT_CONFIG_FILE) {
|
139
140
|
if (!route.config) {
|
140
|
-
route.config =
|
141
|
+
route.config = itemPathWithAlias;
|
141
142
|
}
|
142
143
|
}
|
143
144
|
if (itemWithoutExt === NESTED_ROUTE.LAYOUT_FILE) {
|
144
|
-
route._component =
|
145
|
+
route._component = itemPathWithAlias;
|
145
146
|
}
|
146
147
|
if (itemWithoutExt === NESTED_ROUTE.PAGE_LOADER_FILE) {
|
147
|
-
pageLoaderFile =
|
148
|
+
pageLoaderFile = itemPathWithAlias;
|
148
149
|
}
|
149
150
|
if (itemWithoutExt === NESTED_ROUTE.PAGE_CLIENT_LOADER) {
|
150
|
-
pageClientData =
|
151
|
+
pageClientData = itemPathWithAlias;
|
151
152
|
}
|
152
153
|
if (itemWithoutExt === NESTED_ROUTE.PAGE_DATA_FILE) {
|
153
|
-
pageData =
|
154
|
+
pageData = itemPathWithAlias;
|
154
155
|
if (await hasAction(itemPath)) {
|
155
|
-
pageAction =
|
156
|
+
pageAction = itemPathWithAlias;
|
156
157
|
}
|
157
158
|
}
|
158
159
|
if (itemWithoutExt === NESTED_ROUTE.PAGE_CONFIG_FILE) {
|
159
|
-
pageConfigFile =
|
160
|
+
pageConfigFile = itemPathWithAlias;
|
160
161
|
}
|
161
162
|
if (itemWithoutExt === NESTED_ROUTE.PAGE_FILE) {
|
162
163
|
var _route_children1;
|
163
164
|
pageRoute = createIndexRoute({
|
164
|
-
_component:
|
165
|
+
_component: itemPathWithAlias
|
165
166
|
}, rootDir, itemPath, entryName, isMainEntry);
|
166
167
|
if (pageLoaderFile) {
|
167
168
|
pageRoute.loader = pageLoaderFile;
|
@@ -181,10 +182,10 @@ const walk = async (dirname, rootDir, alias, entryName, isMainEntry, oldVersion)
|
|
181
182
|
(_route_children1 = route.children) === null || _route_children1 === void 0 ? void 0 : _route_children1.push(pageRoute);
|
182
183
|
}
|
183
184
|
if (itemWithoutExt === NESTED_ROUTE.SPLATE_LOADER_FILE) {
|
184
|
-
splatLoaderFile =
|
185
|
+
splatLoaderFile = itemPathWithAlias;
|
185
186
|
}
|
186
187
|
if (itemWithoutExt === NESTED_ROUTE.SPLATE_CLIENT_DATA) {
|
187
|
-
splatClientData =
|
188
|
+
splatClientData = itemPathWithAlias;
|
188
189
|
}
|
189
190
|
if (itemWithoutExt === NESTED_ROUTE.SPLATE_CONFIG_FILE) {
|
190
191
|
if (!route.config) {
|
@@ -192,15 +193,15 @@ const walk = async (dirname, rootDir, alias, entryName, isMainEntry, oldVersion)
|
|
192
193
|
}
|
193
194
|
}
|
194
195
|
if (itemWithoutExt === NESTED_ROUTE.SPLATE_DATA_FILE) {
|
195
|
-
splatData =
|
196
|
+
splatData = itemPathWithAlias;
|
196
197
|
if (await hasAction(itemPath)) {
|
197
|
-
splatAction =
|
198
|
+
splatAction = itemPathWithAlias;
|
198
199
|
}
|
199
200
|
}
|
200
201
|
if (itemWithoutExt === NESTED_ROUTE.SPLATE_FILE) {
|
201
202
|
var _route_children2;
|
202
203
|
splatRoute = createRoute({
|
203
|
-
_component:
|
204
|
+
_component: itemPathWithAlias,
|
204
205
|
path: "*"
|
205
206
|
}, rootDir, itemPath, entryName, isMainEntry);
|
206
207
|
if (splatLoaderFile) {
|
@@ -221,10 +222,10 @@ const walk = async (dirname, rootDir, alias, entryName, isMainEntry, oldVersion)
|
|
221
222
|
(_route_children2 = route.children) === null || _route_children2 === void 0 ? void 0 : _route_children2.push(splatRoute);
|
222
223
|
}
|
223
224
|
if (itemWithoutExt === NESTED_ROUTE.LOADING_FILE) {
|
224
|
-
route.loading =
|
225
|
+
route.loading = itemPathWithAlias;
|
225
226
|
}
|
226
227
|
if (itemWithoutExt === NESTED_ROUTE.ERROR_FILE) {
|
227
|
-
route.error =
|
228
|
+
route.error = itemPathWithAlias;
|
228
229
|
}
|
229
230
|
}
|
230
231
|
let finalRoute = createRoute(route, rootDir, path.join(dirname, `${NESTED_ROUTE.LAYOUT_FILE}.ts`), entryName, isMainEntry);
|
@@ -18,7 +18,7 @@ const walkDirectory = (dir) => fs.readdirSync(dir).reduce((previous, filename) =
|
|
18
18
|
];
|
19
19
|
}
|
20
20
|
}, []);
|
21
|
-
const getDefaultImports = ({ entrypoint, srcDirectory, internalSrcAlias, internalDirAlias
|
21
|
+
const getDefaultImports = ({ entrypoint, srcDirectory, appDirectory, internalSrcAlias, internalDirAlias }) => {
|
22
22
|
const { entryName, fileSystemRoutes, customBootstrap, entry } = entrypoint;
|
23
23
|
const imports = [
|
24
24
|
{
|
@@ -35,7 +35,7 @@ const getDefaultImports = ({ entrypoint, srcDirectory, internalSrcAlias, interna
|
|
35
35
|
local: "ReactDOM"
|
36
36
|
}
|
37
37
|
],
|
38
|
-
value: isReact18(path.join(
|
38
|
+
value: isReact18(path.join(appDirectory)) ? "react-dom/client" : "react-dom"
|
39
39
|
},
|
40
40
|
{
|
41
41
|
specifiers: [
|
@@ -50,7 +50,7 @@ function applyBottomHtmlPlugin({ api, chain, options, CHAIN_ID, HtmlBundlerPlugi
|
|
50
50
|
}
|
51
51
|
]);
|
52
52
|
}
|
53
|
-
chain.plugin(
|
53
|
+
chain.plugin("bottom-template").use(BottomTemplatePlugin, [
|
54
54
|
HtmlBundlerPlugin
|
55
55
|
]);
|
56
56
|
}
|
@@ -20,7 +20,7 @@ const builderPluginAdapterSSR = (options) => ({
|
|
20
20
|
api.modifyBundlerChain(async (chain, { target, CHAIN_ID, isProd, HtmlPlugin: HtmlBundlerPlugin, isServer }) => {
|
21
21
|
const builderConfig = api.getNormalizedConfig();
|
22
22
|
const { normalizedConfig: normalizedConfig2 } = options;
|
23
|
-
applyRouterPlugin(chain,
|
23
|
+
applyRouterPlugin(chain, "route-plugin", options, HtmlBundlerPlugin);
|
24
24
|
if (isSSR(normalizedConfig2)) {
|
25
25
|
await applySSRLoaderEntry(chain, options, isServer);
|
26
26
|
applySSRDataLoader(chain, options);
|
package/dist/esm-node/index.js
CHANGED
@@ -7,6 +7,7 @@ import analyzePlugin from "./analyze";
|
|
7
7
|
import initializePlugin from "./initialize";
|
8
8
|
import { hooks } from "./hooks";
|
9
9
|
import { i18n, localeKeys } from "./locale";
|
10
|
+
import serverBuildPlugin from "./plugins/serverBuild";
|
10
11
|
import { restart } from "./utils/restart";
|
11
12
|
import { generateWatchFiles } from "./utils/generateWatchFiles";
|
12
13
|
import { mergeConfig } from "@modern-js/core";
|
@@ -79,6 +80,7 @@ const appTools = (options = {
|
|
79
80
|
analyzePlugin({
|
80
81
|
bundler: (options === null || options === void 0 ? void 0 : options.bundler) === "experimental-rspack" ? "rspack" : "webpack"
|
81
82
|
}),
|
83
|
+
serverBuildPlugin(),
|
82
84
|
lintPlugin()
|
83
85
|
],
|
84
86
|
setup: (api) => {
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import path from "path";
|
2
|
+
import fs from "fs";
|
3
|
+
import { SERVER_DIR, SHARED_DIR } from "@modern-js/utils";
|
4
|
+
import { compile } from "@modern-js/server-utils";
|
5
|
+
const TS_CONFIG_FILENAME = "tsconfig.json";
|
6
|
+
var serverBuild_default = () => ({
|
7
|
+
name: "@modern-js/server-build",
|
8
|
+
setup(api) {
|
9
|
+
return {
|
10
|
+
async afterBuild() {
|
11
|
+
const { appDirectory, distDirectory } = api.useAppContext();
|
12
|
+
const modernConfig = api.useResolvedConfigContext();
|
13
|
+
const distDir = path.resolve(distDirectory);
|
14
|
+
const serverDir = path.resolve(appDirectory, SERVER_DIR);
|
15
|
+
const sharedDir = path.resolve(appDirectory, SHARED_DIR);
|
16
|
+
const tsconfigPath = path.resolve(appDirectory, TS_CONFIG_FILENAME);
|
17
|
+
const sourceDirs = [];
|
18
|
+
if (fs.existsSync(serverDir)) {
|
19
|
+
sourceDirs.push(serverDir);
|
20
|
+
if (fs.existsSync(sharedDir)) {
|
21
|
+
sourceDirs.push(sharedDir);
|
22
|
+
}
|
23
|
+
}
|
24
|
+
const { server } = modernConfig;
|
25
|
+
const { alias } = modernConfig.source;
|
26
|
+
const { babel } = modernConfig.tools;
|
27
|
+
if (sourceDirs.length > 0) {
|
28
|
+
await compile(appDirectory, {
|
29
|
+
server,
|
30
|
+
alias,
|
31
|
+
babelConfig: babel
|
32
|
+
}, {
|
33
|
+
sourceDirs,
|
34
|
+
distDir,
|
35
|
+
tsconfigPath
|
36
|
+
});
|
37
|
+
}
|
38
|
+
}
|
39
|
+
};
|
40
|
+
}
|
41
|
+
});
|
42
|
+
export {
|
43
|
+
serverBuild_default as default
|
44
|
+
};
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import type { Entrypoint } from '@modern-js/types';
|
2
2
|
import type { ImportStatement } from '../types';
|
3
3
|
export declare const walkDirectory: (dir: string) => string[];
|
4
|
-
export declare const getDefaultImports: ({ entrypoint, srcDirectory, internalSrcAlias, internalDirAlias,
|
4
|
+
export declare const getDefaultImports: ({ entrypoint, srcDirectory, appDirectory, internalSrcAlias, internalDirAlias, }: {
|
5
5
|
entrypoint: Entrypoint;
|
6
6
|
srcDirectory: string;
|
7
|
+
appDirectory: string;
|
7
8
|
internalSrcAlias: string;
|
8
9
|
internalDirAlias: string;
|
9
|
-
internalDirectory: string;
|
10
10
|
}) => ImportStatement[];
|
11
11
|
export declare const isPageComponentFile: (filePath: string) => boolean;
|
12
12
|
export declare const replaceWithAlias: (base: string, filePath: string, alias: string) => string;
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.
|
18
|
+
"version": "2.43.0",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/types/index.d.ts",
|
21
21
|
"main": "./dist/cjs/index.js",
|
@@ -68,28 +68,29 @@
|
|
68
68
|
"dependencies": {
|
69
69
|
"@babel/parser": "^7.22.15",
|
70
70
|
"@babel/traverse": "^7.23.2",
|
71
|
-
"@babel/types": "^7.
|
71
|
+
"@babel/types": "^7.23.0",
|
72
72
|
"es-module-lexer": "^1.1.0",
|
73
73
|
"esbuild": "0.17.19",
|
74
74
|
"@swc/helpers": "0.5.3",
|
75
|
-
"@modern-js/builder": "2.
|
76
|
-
"@modern-js/builder-plugin-
|
77
|
-
"@modern-js/builder-plugin-
|
78
|
-
"@modern-js/builder-
|
79
|
-
"@modern-js/
|
80
|
-
"@modern-js/
|
81
|
-
"@modern-js/
|
82
|
-
"@modern-js/plugin
|
83
|
-
"@modern-js/
|
84
|
-
"@modern-js/plugin-data-loader": "2.
|
85
|
-
"@modern-js/
|
86
|
-
"@modern-js/plugin-lint": "2.
|
87
|
-
"@modern-js/
|
88
|
-
"@modern-js/
|
89
|
-
"@modern-js/utils": "2.
|
90
|
-
"@modern-js/
|
91
|
-
"@modern-js/
|
92
|
-
"@modern-js/
|
75
|
+
"@modern-js/builder": "2.43.0",
|
76
|
+
"@modern-js/builder-plugin-node-polyfill": "2.43.0",
|
77
|
+
"@modern-js/builder-plugin-esbuild": "2.43.0",
|
78
|
+
"@modern-js/builder-shared": "2.43.0",
|
79
|
+
"@modern-js/builder-webpack-provider": "2.43.0",
|
80
|
+
"@modern-js/core": "2.43.0",
|
81
|
+
"@modern-js/new-action": "2.43.0",
|
82
|
+
"@modern-js/plugin": "2.43.0",
|
83
|
+
"@modern-js/node-bundle-require": "2.43.0",
|
84
|
+
"@modern-js/plugin-data-loader": "2.43.0",
|
85
|
+
"@modern-js/plugin-i18n": "2.43.0",
|
86
|
+
"@modern-js/plugin-lint": "2.43.0",
|
87
|
+
"@modern-js/prod-server": "2.43.0",
|
88
|
+
"@modern-js/server": "2.43.0",
|
89
|
+
"@modern-js/server-utils": "2.43.0",
|
90
|
+
"@modern-js/types": "2.43.0",
|
91
|
+
"@modern-js/upgrade": "2.43.0",
|
92
|
+
"@modern-js/utils": "2.43.0",
|
93
|
+
"@modern-js/server-core": "2.43.0"
|
93
94
|
},
|
94
95
|
"devDependencies": {
|
95
96
|
"@types/babel__traverse": "7.18.5",
|
@@ -97,14 +98,14 @@
|
|
97
98
|
"@types/node": "^14",
|
98
99
|
"jest": "^29",
|
99
100
|
"typescript": "^5",
|
100
|
-
"webpack": "^5.
|
101
|
-
"@modern-js/builder-plugin-swc": "2.
|
102
|
-
"@
|
103
|
-
"@
|
104
|
-
"@scripts/jest-config": "2.
|
101
|
+
"webpack": "^5.89.0",
|
102
|
+
"@modern-js/builder-plugin-swc": "2.43.0",
|
103
|
+
"@modern-js/builder-rspack-provider": "2.43.0",
|
104
|
+
"@scripts/build": "2.43.0",
|
105
|
+
"@scripts/jest-config": "2.43.0"
|
105
106
|
},
|
106
107
|
"peerDependencies": {
|
107
|
-
"@modern-js/builder-rspack-provider": "^2.
|
108
|
+
"@modern-js/builder-rspack-provider": "^2.43.0"
|
108
109
|
},
|
109
110
|
"peerDependenciesMeta": {
|
110
111
|
"@modern-js/builder-rspack-provider": {
|