lambder 3.2.6 → 3.3.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/Lambder.d.ts +11 -7
- package/dist/Lambder.js +7 -6
- package/package.json +1 -1
package/dist/Lambder.d.ts
CHANGED
|
@@ -27,8 +27,11 @@ export type LambderIndexHtmlOptions = {
|
|
|
27
27
|
/** Methods that reach the index handler. Default: ["GET", "HEAD"]. */
|
|
28
28
|
methods?: string[];
|
|
29
29
|
/**
|
|
30
|
-
* Skip paths whose last segment
|
|
31
|
-
*
|
|
30
|
+
* Skip paths whose last segment contains a dot, treating them as missing
|
|
31
|
+
* assets rather than app routes. Default: false — real files have already
|
|
32
|
+
* been served by servePublicFiles at this point, and plenty of app routes
|
|
33
|
+
* carry dots (JWTs, coordinates, domain names, version numbers). Turn it
|
|
34
|
+
* on to get 404s instead of a 200 shell for missing-asset requests.
|
|
32
35
|
*/
|
|
33
36
|
skipFilePaths?: boolean;
|
|
34
37
|
/** 301-redirect trailing-slash paths to the canonical no-slash URL. Default: false. */
|
|
@@ -150,11 +153,12 @@ export default class Lambder<TSessionData = any, _TContract extends Record<strin
|
|
|
150
153
|
servePublicFiles(options?: LambderPublicFilesOptions): this;
|
|
151
154
|
/**
|
|
152
155
|
* Serve the app shell for page requests that nothing else handled. Runs
|
|
153
|
-
* after servePublicFiles in the fallback chain,
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
156
|
+
* after servePublicFiles in the fallback chain, so real files are already
|
|
157
|
+
* gone; everything left is an app route (option `skipFilePaths` opts back
|
|
158
|
+
* into 404ing dotted paths). Only configured methods reach it, default
|
|
159
|
+
* GET/HEAD. Gated-out requests fall through to setRouteFallbackHandler.
|
|
160
|
+
* Without a handler, publicPath/index.html is served via res.templateFile
|
|
161
|
+
* (markers optional) with no-cache.
|
|
158
162
|
*/
|
|
159
163
|
serveIndexHtml(handler?: FallbackHandlerFunction, options?: LambderIndexHtmlOptions): this;
|
|
160
164
|
/** Apply the serveIndexHtml gates; null means fall through. */
|
package/dist/Lambder.js
CHANGED
|
@@ -121,11 +121,12 @@ export default class Lambder {
|
|
|
121
121
|
}
|
|
122
122
|
/**
|
|
123
123
|
* Serve the app shell for page requests that nothing else handled. Runs
|
|
124
|
-
* after servePublicFiles in the fallback chain,
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
124
|
+
* after servePublicFiles in the fallback chain, so real files are already
|
|
125
|
+
* gone; everything left is an app route (option `skipFilePaths` opts back
|
|
126
|
+
* into 404ing dotted paths). Only configured methods reach it, default
|
|
127
|
+
* GET/HEAD. Gated-out requests fall through to setRouteFallbackHandler.
|
|
128
|
+
* Without a handler, publicPath/index.html is served via res.templateFile
|
|
129
|
+
* (markers optional) with no-cache.
|
|
129
130
|
*/
|
|
130
131
|
serveIndexHtml(handler, options = {}) {
|
|
131
132
|
this.indexHtmlConfig = { handler: handler ?? null, options };
|
|
@@ -139,7 +140,7 @@ export default class Lambder {
|
|
|
139
140
|
const methods = (options.methods ?? ["GET", "HEAD"]).map((m) => m.toUpperCase());
|
|
140
141
|
if (!methods.includes(ctx.method.toUpperCase()))
|
|
141
142
|
return null;
|
|
142
|
-
if ((options.skipFilePaths ??
|
|
143
|
+
if ((options.skipFilePaths ?? false) && (ctx.path.split("/").pop() ?? "").includes("."))
|
|
143
144
|
return null;
|
|
144
145
|
if (options.redirectTrailingSlash && ctx.path.length > 1 && ctx.path.endsWith("/")) {
|
|
145
146
|
const target = ctx.path.replace(/\/+$/, "") || "/";
|