@olenbetong/appframe-vite 5.0.2 → 5.1.1

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.
Files changed (2) hide show
  1. package/lib/devServer.js +10 -1
  2. package/package.json +3 -3
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 (url?.startsWith("/" + appPkg.appframe.article.id)) {
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.2",
3
+ "version": "5.1.1",
4
4
  "description": "Tools to use and deploy Vite applications to Appframe",
5
5
  "main": "./lib/index.js",
6
6
  "type": "module",
@@ -19,7 +19,7 @@
19
19
  "author": "Bjørnar Vister Hansen <bvh@olenbetong.no>",
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "@olenbetong/appframe-data": "0.9.5",
22
+ "@olenbetong/appframe-data": "0.9.6",
23
23
  "body-parser": "^1.20.2",
24
24
  "chalk": "^5.3.0",
25
25
  "chokidar": "^3.5.3",
@@ -40,5 +40,5 @@
40
40
  "open": "^9.1.0",
41
41
  "tcp-port-used": "^1.0.2"
42
42
  },
43
- "gitHead": "8770c759220229228943da5678fa18a31deb9145"
43
+ "gitHead": "c9b51be949d9b0ffe57f7134d4962beb0a5d490d"
44
44
  }