@lark-apaas/fullstack-rspack-preset 1.0.32-alpha.22 → 1.0.32-alpha.23
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.
|
@@ -7,8 +7,6 @@ declare class RouteParserPlugin {
|
|
|
7
7
|
private options;
|
|
8
8
|
private lastAppPathHash;
|
|
9
9
|
private cachedRoutes;
|
|
10
|
-
/** 不带 basePath 前缀的路由(供日志服务消费) */
|
|
11
|
-
private cachedPageRoutes;
|
|
12
10
|
constructor(options?: RouteParserPluginOptions);
|
|
13
11
|
private normalizeBasePath;
|
|
14
12
|
private log;
|
|
@@ -48,8 +48,6 @@ class RouteParserPlugin {
|
|
|
48
48
|
constructor(options = {}) {
|
|
49
49
|
this.lastAppPathHash = null;
|
|
50
50
|
this.cachedRoutes = null;
|
|
51
|
-
/** 不带 basePath 前缀的路由(供日志服务消费) */
|
|
52
|
-
this.cachedPageRoutes = null;
|
|
53
51
|
// 从环境变量读取 basePath,并规范化(确保以 / 开头,不以 / 结尾)
|
|
54
52
|
const envBasePath = process.env.CLIENT_BASE_PATH || '';
|
|
55
53
|
const normalizedBasePath = this.normalizeBasePath(options.basePath ?? envBasePath);
|
|
@@ -104,12 +102,6 @@ class RouteParserPlugin {
|
|
|
104
102
|
source: () => routesJson,
|
|
105
103
|
size: () => routesJson.length
|
|
106
104
|
};
|
|
107
|
-
// 不带 basePath 前缀的路由,供日志服务消费
|
|
108
|
-
const pageRoutesJson = JSON.stringify(this.cachedPageRoutes, null, 2);
|
|
109
|
-
compilation.assets['page-routes.json'] = {
|
|
110
|
-
source: () => pageRoutesJson,
|
|
111
|
-
size: () => pageRoutesJson.length
|
|
112
|
-
};
|
|
113
105
|
callback();
|
|
114
106
|
}
|
|
115
107
|
catch (error) {
|
|
@@ -118,16 +110,10 @@ class RouteParserPlugin {
|
|
|
118
110
|
const defaultPath = basePath ? `${basePath}/` : '/';
|
|
119
111
|
const defaultRoutes = [{ path: defaultPath }];
|
|
120
112
|
const routesJson = JSON.stringify(defaultRoutes, null, 2);
|
|
121
|
-
const defaultPageRoutes = [{ path: '/' }];
|
|
122
|
-
const pageRoutesJson = JSON.stringify(defaultPageRoutes, null, 2);
|
|
123
113
|
compilation.assets['routes.json'] = {
|
|
124
114
|
source: () => routesJson,
|
|
125
115
|
size: () => routesJson.length
|
|
126
116
|
};
|
|
127
|
-
compilation.assets['page-routes.json'] = {
|
|
128
|
-
source: () => pageRoutesJson,
|
|
129
|
-
size: () => pageRoutesJson.length
|
|
130
|
-
};
|
|
131
117
|
callback();
|
|
132
118
|
}
|
|
133
119
|
});
|
|
@@ -214,11 +200,6 @@ class RouteParserPlugin {
|
|
|
214
200
|
}
|
|
215
201
|
});
|
|
216
202
|
const { basePath } = this.options;
|
|
217
|
-
// 不带前缀的纯页面路由(供日志服务消费)
|
|
218
|
-
const pageRoutes = Array.from(routeSet).map(routePath => ({
|
|
219
|
-
path: routePath,
|
|
220
|
-
}));
|
|
221
|
-
this.cachedPageRoutes = pageRoutes.length > 0 ? pageRoutes : [{ path: '/' }];
|
|
222
203
|
const routes = Array.from(routeSet).map(routePath => ({
|
|
223
204
|
path: basePath ? `${basePath}${routePath}` : routePath,
|
|
224
205
|
}));
|
|
@@ -230,7 +211,6 @@ class RouteParserPlugin {
|
|
|
230
211
|
this.log('warn', '⚠️ 路由解析失败,使用默认路由:', error.message);
|
|
231
212
|
const { basePath } = this.options;
|
|
232
213
|
const defaultPath = basePath ? `${basePath}/` : '/';
|
|
233
|
-
this.cachedPageRoutes = [{ path: '/' }];
|
|
234
214
|
return [{ path: defaultPath }];
|
|
235
215
|
}
|
|
236
216
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/fullstack-rspack-preset",
|
|
3
|
-
"version": "1.0.32-alpha.
|
|
3
|
+
"version": "1.0.32-alpha.23",
|
|
4
4
|
"files": [
|
|
5
5
|
"lib",
|
|
6
6
|
"patches",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@babel/parser": "^7.28.0",
|
|
32
32
|
"@babel/traverse": "^7.28.0",
|
|
33
33
|
"@babel/types": "^7.28.2",
|
|
34
|
-
"@lark-apaas/devtool-kits": "1.2.17-alpha.
|
|
34
|
+
"@lark-apaas/devtool-kits": "1.2.17-alpha.36",
|
|
35
35
|
"@lark-apaas/miaoda-inspector-babel-plugin": "^1.0.2",
|
|
36
36
|
"@lark-apaas/styled-jsx": "^1.0.1",
|
|
37
37
|
"@rspack/plugin-react-refresh": "^1.5.1",
|