@farm.js/plugin 0.1.39 → 0.1.40
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 +13 -0
- 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,CA2yC1D"}
|
package/dist/rsc/entries/rsc.js
CHANGED
|
@@ -89,6 +89,7 @@ import {
|
|
|
89
89
|
applyProductionMiddlewareHeaders,
|
|
90
90
|
createProductionMiddlewareRunner,
|
|
91
91
|
} from '@farm.js/core/middleware';
|
|
92
|
+
import { _withFarmGuardedResponseCache } from '@farm.js/core/internal/production-runtime';
|
|
92
93
|
import {
|
|
93
94
|
getAllowedAPIRouteMethods,
|
|
94
95
|
invokeAPIRouteEndpoint,
|
|
@@ -667,8 +668,19 @@ function getMatchingBoundary(pageFilePath, modules, kind) {
|
|
|
667
668
|
/**
|
|
668
669
|
* Main request handler - entry point for both dev and production (Nitro).
|
|
669
670
|
* Exported as { fetch: handler } for the RSC/Nitro contract (see vite-plugin-rsc-deploy-example).
|
|
671
|
+
*
|
|
672
|
+
* Middleware that let a request through may have been a guard: an IP allowlist, an API key
|
|
673
|
+
* header, a VPN header. A CDN keys its copy by URL and never runs the guard on a hit, so
|
|
674
|
+
* whatever such a request answers stays out of shared caches, as in core's server. Only
|
|
675
|
+
* middleware declaring cache: "public" leaves the policy alone.
|
|
670
676
|
*/
|
|
671
677
|
async function handleFarmRequest(request, context) {
|
|
678
|
+
const farmCacheGuard = { guarded: false };
|
|
679
|
+
const response = await resolveFarmRequest(farmCacheGuard, request, context);
|
|
680
|
+
return farmCacheGuard.guarded ? _withFarmGuardedResponseCache(response) : response;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
async function resolveFarmRequest(farmCacheGuard, request, context) {
|
|
672
684
|
let url = new URL(request.url);
|
|
673
685
|
let matchedPage = null;
|
|
674
686
|
let errorData = new Map();
|
|
@@ -708,6 +720,7 @@ async function handleFarmRequest(request, context) {
|
|
|
708
720
|
// Execute middleware first
|
|
709
721
|
const middlewareResult = await executeMiddleware(request, context);
|
|
710
722
|
${generateRscMiddlewareResultHandling()}
|
|
723
|
+
if (middlewareResult.guarded) farmCacheGuard.guarded = true;
|
|
711
724
|
|
|
712
725
|
request = middlewareResult.request;
|
|
713
726
|
url = new URL(request.url);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farm.js/plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.40",
|
|
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.40"
|
|
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.40"
|
|
87
87
|
},
|
|
88
88
|
"peerDependenciesMeta": {
|
|
89
89
|
"@vitejs/plugin-rsc": {
|