bun-plugin-stx 0.2.149 → 0.2.151
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.
|
@@ -119,6 +119,10 @@ function matchRoute(pathname, routes) {
|
|
|
119
119
|
}
|
|
120
120
|
return null;
|
|
121
121
|
}
|
|
122
|
+
function bracketPathToRegex(routePath) {
|
|
123
|
+
const pattern = routePath.replace(/\[\[([^\]]+)\]\]/g, ":$1?").replace(/\[([^\]]+)\]/g, ":$1").replace(/:\.\.\.([^/]+)/g, ":$1*");
|
|
124
|
+
return patternToRegex(pattern);
|
|
125
|
+
}
|
|
122
126
|
|
|
123
127
|
// ../router/src/nested-layouts.ts
|
|
124
128
|
import fs2 from "fs";
|
|
@@ -1719,6 +1723,7 @@ export {
|
|
|
1719
1723
|
createMiddlewareContext,
|
|
1720
1724
|
createClientCookieManager,
|
|
1721
1725
|
clearMiddleware,
|
|
1726
|
+
bracketPathToRegex,
|
|
1722
1727
|
abortNavigation,
|
|
1723
1728
|
Router
|
|
1724
1729
|
};
|
package/dist/serve.js
CHANGED
|
@@ -8757,7 +8757,7 @@ function extractServerScriptsFromTemplate(content) {
|
|
|
8757
8757
|
return { serverScripts, templateContent: retained.join("") };
|
|
8758
8758
|
}
|
|
8759
8759
|
function buildDynamicRouteRegexes(fileRouteBase) {
|
|
8760
|
-
const toPattern = (p) => p.replace(/\[([^\]]+)\]/g, "([^/]+)").replace(/\//g, "\\/");
|
|
8760
|
+
const toPattern = (p) => p.replace(/\[\.\.\.([^\]]+)\]/g, "(.+)").replace(/\[([^\]]+)\]/g, "([^/]+)").replace(/\//g, "\\/");
|
|
8761
8761
|
const patterns = [new RegExp(`^${toPattern(fileRouteBase)}$`)];
|
|
8762
8762
|
const noIndex = fileRouteBase.replace(/\/index$/, "");
|
|
8763
8763
|
if (noIndex !== fileRouteBase)
|
|
@@ -9361,7 +9361,7 @@ After installing: bun add bun-plugin-stx`);
|
|
|
9361
9361
|
pageMiddlewarePatterns.length = 0;
|
|
9362
9362
|
await Promise.all(files.map((f) => detectPageMiddleware(f)));
|
|
9363
9363
|
try {
|
|
9364
|
-
const { Router } = await import("./chunk-
|
|
9364
|
+
const { Router } = await import("./chunk-8nbccnre.js");
|
|
9365
9365
|
const pagesDirs = patterns.map((p) => p.replace(/\/$/, "")).filter(Boolean);
|
|
9366
9366
|
const router = new Router(process19.cwd(), { pagesDirs, stateDir: stateDirName() });
|
|
9367
9367
|
if (!options.quiet)
|
|
@@ -9708,7 +9708,7 @@ After installing: bun add bun-plugin-stx`);
|
|
|
9708
9708
|
for (const regex of regexPatterns) {
|
|
9709
9709
|
const match = normalizedPath.match(regex);
|
|
9710
9710
|
if (match) {
|
|
9711
|
-
const paramNames = [...fileRouteBase.matchAll(/\[([^\]]+)\]/g)].map((m) => m[1]);
|
|
9711
|
+
const paramNames = [...fileRouteBase.matchAll(/\[([^\]]+)\]/g)].map((m) => m[1].replace(/^\.\.\./, ""));
|
|
9712
9712
|
const paramValues = match.slice(1);
|
|
9713
9713
|
const output = await processTemplateDynamic(filePath, paramNames, paramValues, normalizedPath, reqCtx);
|
|
9714
9714
|
routes.set(requestPath, output);
|
package/package.json
CHANGED