veryfront 0.1.931 → 0.1.932
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/esm/deno.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/src/server/handlers/request/rsc/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EAEf,aAAa,EACd,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/src/server/handlers/request/rsc/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EAEf,aAAa,EACd,MAAM,gBAAgB,CAAC;AAWxB,qBAAa,UAAW,SAAQ,WAAW;IACzC,QAAQ,EAAE,eAAe,CAIvB;IAEF,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAiFlE"}
|
|
@@ -11,6 +11,8 @@ import { applyCORSHeaders } from "../../../../security/index.js";
|
|
|
11
11
|
import { HTTP_NOT_FOUND, PRIORITY_MEDIUM } from "../../../../utils/constants/index.js";
|
|
12
12
|
import { withSpan } from "../../../../observability/tracing/otlp-setup.js";
|
|
13
13
|
import { generateNonce } from "../../../../security/http/response/security-handler.js";
|
|
14
|
+
import { isExtendedFSAdapter } from "../../../../platform/adapters/fs/wrapper.js";
|
|
15
|
+
import { getHostEnv } from "../../../../platform/compat/process.js";
|
|
14
16
|
export class RSCHandler extends BaseHandler {
|
|
15
17
|
metadata = {
|
|
16
18
|
name: "RSCHandler",
|
|
@@ -34,7 +36,7 @@ export class RSCHandler extends BaseHandler {
|
|
|
34
36
|
return this.respond(new Response("Not Found", { status: HTTP_NOT_FOUND }));
|
|
35
37
|
}
|
|
36
38
|
const nonce = generateNonce();
|
|
37
|
-
const
|
|
39
|
+
const execute = () => handleRSCEndpoint({
|
|
38
40
|
req,
|
|
39
41
|
pathname,
|
|
40
42
|
projectDir: ctx.projectDir,
|
|
@@ -43,6 +45,20 @@ export class RSCHandler extends BaseHandler {
|
|
|
43
45
|
config: ctx.config,
|
|
44
46
|
nonce,
|
|
45
47
|
});
|
|
48
|
+
const fsAdapter = ctx.adapter.fs;
|
|
49
|
+
const isMultiProject = ctx.projectSlug &&
|
|
50
|
+
isExtendedFSAdapter(fsAdapter) &&
|
|
51
|
+
fsAdapter.isMultiProjectMode();
|
|
52
|
+
const res = isMultiProject
|
|
53
|
+
? await fsAdapter.runWithContext(ctx.projectSlug, ctx.proxyToken || getHostEnv("VERYFRONT_API_TOKEN") || "", execute, ctx.projectId, {
|
|
54
|
+
productionMode: isRSCProductionMode(ctx),
|
|
55
|
+
releaseId: ctx.releaseId,
|
|
56
|
+
branch: ctx.resolvedEnvironment === "production"
|
|
57
|
+
? null
|
|
58
|
+
: ctx.requestContext?.branch ?? ctx.parsedDomain?.branch ?? null,
|
|
59
|
+
environmentName: ctx.environmentName,
|
|
60
|
+
})
|
|
61
|
+
: await execute();
|
|
46
62
|
if (!res) {
|
|
47
63
|
return this.continue();
|
|
48
64
|
}
|
|
@@ -61,3 +77,8 @@ export class RSCHandler extends BaseHandler {
|
|
|
61
77
|
}, { "rsc.pathname": pathname, "rsc.endpoint": endpoint });
|
|
62
78
|
}
|
|
63
79
|
}
|
|
80
|
+
function isRSCProductionMode(ctx) {
|
|
81
|
+
if (ctx.config?.fs?.veryfront?.productionMode === true)
|
|
82
|
+
return true;
|
|
83
|
+
return (ctx.resolvedEnvironment ?? ctx.requestContext?.mode) === "production";
|
|
84
|
+
}
|