@olenbetong/appframe-vite 5.0.2 → 5.1.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/lib/devServer.js +10 -1
- package/package.json +2 -2
package/lib/devServer.js
CHANGED
|
@@ -172,12 +172,21 @@ async function getCachedOrArticleHtml(skipCache = false) {
|
|
|
172
172
|
export function createDevMiddleware(vite) {
|
|
173
173
|
return async (req, res, next) => {
|
|
174
174
|
const url = req.originalUrl;
|
|
175
|
+
let isRootArticle = url?.startsWith("/" + appPkg.appframe.article.id);
|
|
176
|
+
if (!isRootArticle && Array.isArray(appPkg.appframe.article.altNames)) {
|
|
177
|
+
for (let name of appPkg.appframe.article.altNames) {
|
|
178
|
+
if (url?.startsWith("/" + name)) {
|
|
179
|
+
isRootArticle = true;
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
175
184
|
if (url === "/") {
|
|
176
185
|
res.statusCode = 302;
|
|
177
186
|
res.setHeader("Location", `/${appPkg.appframe.article.id}`);
|
|
178
187
|
res.end("");
|
|
179
188
|
}
|
|
180
|
-
else if (
|
|
189
|
+
else if (isRootArticle) {
|
|
181
190
|
try {
|
|
182
191
|
// Unless the browser is explicitly disabling cache by setting the Cache-Control header
|
|
183
192
|
// to "no-cache", we cache the generated HTML for up to 3 hours
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olenbetong/appframe-vite",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "Tools to use and deploy Vite applications to Appframe",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"open": "^9.1.0",
|
|
41
41
|
"tcp-port-used": "^1.0.2"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "bba83f9bc3cb6cf33496f9074189f9149d9be5f3"
|
|
44
44
|
}
|