@usenotra/agentside 0.2.1 → 0.2.3
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/build.d.ts +22 -10
- package/dist/build.js +18 -18
- package/package.json +1 -1
package/dist/build.d.ts
CHANGED
|
@@ -18,8 +18,22 @@ export declare function llmsTxt(pages: readonly PrerenderedPage[], options: {
|
|
|
18
18
|
}): string;
|
|
19
19
|
export declare function llmsFullTxt(pages: readonly PrerenderedPage[]): string;
|
|
20
20
|
export declare function vercelRoutes(paths?: readonly string[]): {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
routes: ({
|
|
22
|
+
src: string;
|
|
23
|
+
headers: {
|
|
24
|
+
"Content-Type": string;
|
|
25
|
+
Vary: string;
|
|
26
|
+
"X-Robots-Tag": string;
|
|
27
|
+
};
|
|
28
|
+
continue: boolean;
|
|
29
|
+
} | {
|
|
30
|
+
src: string;
|
|
31
|
+
headers: {
|
|
32
|
+
Vary: string;
|
|
33
|
+
};
|
|
34
|
+
continue: boolean;
|
|
35
|
+
} | {
|
|
36
|
+
src: string;
|
|
23
37
|
has: ({
|
|
24
38
|
readonly type: "header";
|
|
25
39
|
readonly key: "accept";
|
|
@@ -29,13 +43,11 @@ export declare function vercelRoutes(paths?: readonly string[]): {
|
|
|
29
43
|
readonly key: "user-agent";
|
|
30
44
|
readonly value: `.*(${string}).*`;
|
|
31
45
|
})[];
|
|
32
|
-
|
|
33
|
-
}[];
|
|
34
|
-
headers: {
|
|
35
|
-
source: string;
|
|
46
|
+
dest: string;
|
|
36
47
|
headers: {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
48
|
+
"Content-Type": string;
|
|
49
|
+
Vary: string;
|
|
50
|
+
"X-Robots-Tag": string;
|
|
51
|
+
};
|
|
52
|
+
})[];
|
|
41
53
|
};
|
package/dist/build.js
CHANGED
|
@@ -103,24 +103,24 @@ export function vercelRoutes(paths) {
|
|
|
103
103
|
{ type: "header", key: "accept", value: ".*text/markdown.*" },
|
|
104
104
|
{ type: "header", key: "user-agent", value: `.*(${agentTokens.map(escapeRegex).join("|")}).*` },
|
|
105
105
|
];
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
106
|
+
const markdownHeaders = {
|
|
107
|
+
"Content-Type": "text/markdown; charset=utf-8",
|
|
108
|
+
Vary: "Accept, User-Agent",
|
|
109
|
+
"X-Robots-Tag": "noindex",
|
|
110
|
+
};
|
|
111
|
+
const nested = paths?.filter((path) => path !== "/").map((path) => path.slice(1).replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
112
|
+
const pagePattern = nested ? `(${nested.join("|")})` : "((?!.*\\.).*[^/])";
|
|
113
|
+
const routes = [
|
|
114
|
+
{ src: "^/(.+)\\.md$", headers: markdownHeaders, continue: true },
|
|
115
|
+
{ src: `^/$|^/${pagePattern}/?$`, headers: { Vary: "Accept, User-Agent" }, continue: true },
|
|
116
|
+
...conditions.flatMap((condition) => [
|
|
117
|
+
...(!paths || paths.includes("/")
|
|
118
|
+
? [{ src: "^/$", has: [condition], dest: "/index.md", headers: markdownHeaders }]
|
|
113
119
|
: []),
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
headers: [
|
|
119
|
-
{ key: "Content-Type", value: "text/markdown; charset=utf-8" },
|
|
120
|
-
{ key: "Vary", value: "Accept, User-Agent" },
|
|
121
|
-
{ key: "X-Robots-Tag", value: "noindex" },
|
|
122
|
-
],
|
|
123
|
-
},
|
|
120
|
+
...(!nested || nested.length > 0
|
|
121
|
+
? [{ src: `^/${pagePattern}/?$`, has: [condition], dest: "/$1.md", headers: markdownHeaders }]
|
|
122
|
+
: []),
|
|
123
|
+
]),
|
|
124
124
|
];
|
|
125
|
-
return {
|
|
125
|
+
return { routes };
|
|
126
126
|
}
|