@farm.js/plugin 0.1.38 → 0.1.39
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.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/rsc/entries/rsc.d.ts.map +1 -1
- package/dist/rsc/entries/rsc.js +33 -10
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rsc.d.ts","sourceRoot":"","sources":["../../../src/rsc/entries/rsc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAYhD;;;GAGG;AACH,wBAAgB,mCAAmC,IAAI,MAAM,CAe5D;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"rsc.d.ts","sourceRoot":"","sources":["../../../src/rsc/entries/rsc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAYhD;;;GAGG;AACH,wBAAgB,mCAAmC,IAAI,MAAM,CAe5D;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CA8xC1D"}
|
package/dist/rsc/entries/rsc.js
CHANGED
|
@@ -124,8 +124,10 @@ const farmMarkdownConfig = ${JSON.stringify(ctx.markdown ?? { enabled: false, ex
|
|
|
124
124
|
createFarmLlmsFullRenderer,
|
|
125
125
|
createFarmLlmsMarkdownReader,
|
|
126
126
|
createFarmMetadataRouteResponse,
|
|
127
|
+
farmPathGuardCoversPage,
|
|
127
128
|
renderFarmLlmsFullTxt,
|
|
128
129
|
} from '@farm.js/core/internal/production-runtime';
|
|
130
|
+
import { FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS } from '@farm.js/core/internal/app-markdown-runtime';
|
|
129
131
|
|
|
130
132
|
const farmLlmsTxtConfig = ${JSON.stringify(ctx.llmsTxt)};
|
|
131
133
|
const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });
|
|
@@ -218,6 +220,10 @@ function applyActionResponseHeaders(headers, request) {
|
|
|
218
220
|
headers.set('cache-control', 'no-store');
|
|
219
221
|
headers.set('x-content-type-options', 'nosniff');
|
|
220
222
|
}
|
|
223
|
+
// A page renders per request (cookies, headers, client address), so a shared
|
|
224
|
+
// cache must not keep its HTML or Flight payload unless middleware chose a
|
|
225
|
+
// policy. Core's server defaults pages the same way.
|
|
226
|
+
if (!headers.has('cache-control')) headers.set('cache-control', 'private, no-store');
|
|
221
227
|
}
|
|
222
228
|
|
|
223
229
|
// Auto-discover all route modules. Every glob remains a literal so Vite can analyze it.
|
|
@@ -1164,14 +1170,24 @@ ${ctx.llmsTxt?.enabled
|
|
|
1164
1170
|
*/
|
|
1165
1171
|
function createFarmLlmsTxtContext(request, context, full) {
|
|
1166
1172
|
const origin = new URL(request.url).origin;
|
|
1173
|
+
// A page a path-specific guard covers (a non-root middleware.ts, a config
|
|
1174
|
+
// middleware matcher naming the path) is left out, as core's server does.
|
|
1175
|
+
const guard = {
|
|
1176
|
+
config: { middleware: farmConfigMiddleware },
|
|
1177
|
+
middlewareRoutes: Object.keys(middlewares)
|
|
1178
|
+
.map((filePath) => ({ path: middlewarePathToRoute(filePath) }))
|
|
1179
|
+
.filter((route) => route.path !== null),
|
|
1180
|
+
};
|
|
1167
1181
|
const pages = collectFarmLlmsTxtPages(
|
|
1168
|
-
pageRoutes
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1182
|
+
pageRoutes
|
|
1183
|
+
.map(({ module, segments }) => ({
|
|
1184
|
+
// Dynamic routes have no single URL, so the collector skips them.
|
|
1185
|
+
pattern: '/' + segments
|
|
1186
|
+
.map((part) => (part.isDynamic ? '[' + part.segment + ']' : part.segment))
|
|
1187
|
+
.join('/'),
|
|
1188
|
+
metadata: module && module.metadata,
|
|
1189
|
+
}))
|
|
1190
|
+
.filter((page) => page.pattern.includes('[') || !farmPathGuardCoversPage(guard, page.pattern)),
|
|
1175
1191
|
{
|
|
1176
1192
|
origin,
|
|
1177
1193
|
markdown: farmMarkdownConfig,
|
|
@@ -1187,10 +1203,17 @@ function createFarmLlmsTxtContext(request, context, full) {
|
|
|
1187
1203
|
config: farmLlmsTxtConfig,
|
|
1188
1204
|
rootMetadata: rootLayout && rootLayout.metadata,
|
|
1189
1205
|
}),
|
|
1190
|
-
// Pages are read in-process through the full handler
|
|
1191
|
-
// so the caller's cookies never shape the file
|
|
1206
|
+
// Pages are read in-process through the full handler as an anonymous
|
|
1207
|
+
// visitor: a fresh request, so the caller's cookies never shape the file,
|
|
1208
|
+
// and a neutral client address, so an IP allowlist never admits the read.
|
|
1209
|
+
// The body is shared across callers. HEAD reads nothing.
|
|
1192
1210
|
markdown: full && request.method.toUpperCase() !== 'HEAD'
|
|
1193
|
-
? createFarmLlmsMarkdownReader((page) =>
|
|
1211
|
+
? createFarmLlmsMarkdownReader((page) =>
|
|
1212
|
+
handler(page, {
|
|
1213
|
+
waitUntil: context && context.waitUntil,
|
|
1214
|
+
clientAddress: FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS,
|
|
1215
|
+
}),
|
|
1216
|
+
)
|
|
1194
1217
|
: async () => null,
|
|
1195
1218
|
};
|
|
1196
1219
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farm.js/plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.39",
|
|
4
4
|
"description": "Official plugins for Farm.js framework",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Farm.js Team",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"nitro": "3.0.260903-beta",
|
|
63
63
|
"picocolors": "^1.0.0",
|
|
64
64
|
"rsc-html-stream": "^0.0.4",
|
|
65
|
-
"@farm.js/core": "0.1.
|
|
65
|
+
"@farm.js/core": "0.1.39"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@types/node": "^22.20.5",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"react-dom": "19.2.8",
|
|
84
84
|
"react-server-dom-webpack": "19.2.8",
|
|
85
85
|
"vite": ">=6.0.0",
|
|
86
|
-
"@farm.js/core": "0.1.
|
|
86
|
+
"@farm.js/core": "0.1.39"
|
|
87
87
|
},
|
|
88
88
|
"peerDependenciesMeta": {
|
|
89
89
|
"@vitejs/plugin-rsc": {
|