appstage 0.2.18 → 0.2.19

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/index.cjs CHANGED
@@ -81,7 +81,7 @@ const defaultExtensions = ["html", "htm"];
81
81
  const defaultPath = (req) => req.path;
82
82
  const defaultLanguages = getLanguageList;
83
83
  /**
84
- * Serves files from the specified directory path in a locale-aware
84
+ * Serves files from the specified directory path or paths in a locale-aware
85
85
  * fashion after applying optional transforms.
86
86
  */
87
87
  const files = (params) => {
@@ -90,7 +90,6 @@ const files = (params) => {
90
90
  let exts = p.extensions ?? defaultExtensions;
91
91
  let fallthrough = p.fallthrough ?? true;
92
92
  return async (req, res, next) => {
93
- let langs = (p.languages ?? defaultLanguages)(req);
94
93
  let path = typeof p.path === "string" ? p.path : (p.path ?? defaultPath)(req);
95
94
  if (!matches(path, p.matches)) {
96
95
  if (fallthrough) next();
@@ -114,6 +113,7 @@ const files = (params) => {
114
113
  }
115
114
  return;
116
115
  }
116
+ let langs = (p.languages ?? defaultLanguages)(req);
117
117
  let filePath = null;
118
118
  for (let k = 0; k < bases.length && filePath === null; k++) {
119
119
  let base = bases[k];
package/dist/index.d.ts CHANGED
@@ -27,7 +27,7 @@ type FilesParams = {
27
27
  fallthrough?: boolean;
28
28
  };
29
29
  /**
30
- * Serves files from the specified directory path in a locale-aware
30
+ * Serves files from the specified directory path or paths in a locale-aware
31
31
  * fashion after applying optional transforms.
32
32
  */
33
33
  declare const files: Controller<string | FilesParams>;
package/dist/index.mjs CHANGED
@@ -55,7 +55,7 @@ const defaultExtensions = ["html", "htm"];
55
55
  const defaultPath = (req) => req.path;
56
56
  const defaultLanguages = getLanguageList;
57
57
  /**
58
- * Serves files from the specified directory path in a locale-aware
58
+ * Serves files from the specified directory path or paths in a locale-aware
59
59
  * fashion after applying optional transforms.
60
60
  */
61
61
  const files = (params) => {
@@ -64,7 +64,6 @@ const files = (params) => {
64
64
  let exts = p.extensions ?? defaultExtensions;
65
65
  let fallthrough = p.fallthrough ?? true;
66
66
  return async (req, res, next) => {
67
- let langs = (p.languages ?? defaultLanguages)(req);
68
67
  let path = typeof p.path === "string" ? p.path : (p.path ?? defaultPath)(req);
69
68
  if (!matches(path, p.matches)) {
70
69
  if (fallthrough) next();
@@ -88,6 +87,7 @@ const files = (params) => {
88
87
  }
89
88
  return;
90
89
  }
90
+ let langs = (p.languages ?? defaultLanguages)(req);
91
91
  let filePath = null;
92
92
  for (let k = 0; k < bases.length && filePath === null; k++) {
93
93
  let base = bases[k];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appstage",
3
- "version": "0.2.18",
3
+ "version": "0.2.19",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -77,7 +77,7 @@ const defaultPath = (req: Request) => req.path;
77
77
  const defaultLanguages = getLanguageList;
78
78
 
79
79
  /**
80
- * Serves files from the specified directory path in a locale-aware
80
+ * Serves files from the specified directory path or paths in a locale-aware
81
81
  * fashion after applying optional transforms.
82
82
  */
83
83
  export const files: Controller<string | FilesParams> = (params) => {
@@ -88,8 +88,6 @@ export const files: Controller<string | FilesParams> = (params) => {
88
88
  let fallthrough = p.fallthrough ?? true;
89
89
 
90
90
  return async (req, res, next) => {
91
- let langs = (p.languages ?? defaultLanguages)(req);
92
-
93
91
  let path =
94
92
  typeof p.path === "string" ? p.path : (p.path ?? defaultPath)(req);
95
93
 
@@ -127,10 +125,10 @@ export const files: Controller<string | FilesParams> = (params) => {
127
125
  return;
128
126
  }
129
127
 
128
+ let langs = (p.languages ?? defaultLanguages)(req);
130
129
  let filePath: string | null = null;
131
130
 
132
- // path: /x
133
- // langs: en, ru
131
+ // Example: path = /x, langs = [en, ru], exts = [html, htm]
134
132
  for (let k = 0; k < bases.length && filePath === null; k++) {
135
133
  let base = bases[k];
136
134