gemi 0.49.0-rc.3 → 0.49.0
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/app/index.js +1 -1
- package/dist/bin/gemi.js +46 -11
- package/dist/bin/gemi.js.map +5 -4
- package/dist/{chunk-x2zemc8f.js → chunk-jesnw3h2.js} +1 -1
- package/dist/{chunk-vjwgfkwn.js → chunk-pd3ycrny.js} +1 -1
- package/dist/{chunk-370e8c8b.js → chunk-swq81w29.js} +1 -1
- package/dist/chunk-twg652g2.js +81 -0
- package/dist/{chunk-tjqn206t.js.map → chunk-twg652g2.js.map} +5 -4
- package/dist/chunk-x2ahg1k8.js +6 -0
- package/dist/{chunk-vc448e6t.js.map → chunk-x2ahg1k8.js.map} +2 -2
- package/dist/client/ClientRouter.d.ts.map +1 -1
- package/dist/client/ClientRouterContext.d.ts.map +1 -1
- package/dist/client/QueryManagerContext.d.ts.map +1 -1
- package/dist/client/QueryResource.d.ts +8 -0
- package/dist/client/QueryResource.d.ts.map +1 -1
- package/dist/client/helpers/loadRoutePayload.d.ts +7 -0
- package/dist/client/helpers/loadRoutePayload.d.ts.map +1 -1
- package/dist/client/helpers/readRoutePayload.d.ts +28 -0
- package/dist/client/helpers/readRoutePayload.d.ts.map +1 -0
- package/dist/client/index.js +155 -28
- package/dist/client/index.js.map +1 -1
- package/dist/facades/index.js +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/kernel/index.js +1 -1
- package/dist/server/index.js +1 -1
- package/dist/services/router/ViewRouterServiceContainer.d.ts.map +1 -1
- package/dist/services/router/routePayloadStream.d.ts +22 -0
- package/dist/services/router/routePayloadStream.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-tjqn206t.js +0 -79
- package/dist/chunk-vc448e6t.js +0 -6
- /package/dist/{chunk-x2zemc8f.js.map → chunk-jesnw3h2.js.map} +0 -0
- /package/dist/{chunk-vjwgfkwn.js.map → chunk-pd3ycrny.js.map} +0 -0
- /package/dist/{chunk-370e8c8b.js.map → chunk-swq81w29.js.map} +0 -0
package/dist/app/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{o as a,p as b}from"../chunk-
|
|
2
|
+
import{o as a,p as b}from"../chunk-pd3ycrny.js";import"../chunk-twg652g2.js";import"../chunk-x5f4e2fp.js";import"../chunk-p5r0t9jh.js";import"../chunk-xkrthw08.js";import"../chunk-4z53shav.js";import"../chunk-m0earq80.js";import"../chunk-f18weffa.js";export{b as prismaExtension,a as App};
|
|
3
3
|
|
|
4
4
|
//# debugId=15EBDBCE0B2D702364756E2164756E21
|
package/dist/bin/gemi.js
CHANGED
|
@@ -68556,6 +68556,36 @@ function isBotUserAgent(userAgent) {
|
|
|
68556
68556
|
return BOT_UA.test(userAgent);
|
|
68557
68557
|
}
|
|
68558
68558
|
|
|
68559
|
+
// services/router/routePayloadStream.ts
|
|
68560
|
+
var PAYLOAD_STREAM_DEADLINE_MS = 1e4;
|
|
68561
|
+
function createRoutePayloadStream(envelope, store, deadlineMs = PAYLOAD_STREAM_DEADLINE_MS) {
|
|
68562
|
+
const encoder = new TextEncoder;
|
|
68563
|
+
return new ReadableStream({
|
|
68564
|
+
start(controller) {
|
|
68565
|
+
let closed = false;
|
|
68566
|
+
const close = () => {
|
|
68567
|
+
if (closed)
|
|
68568
|
+
return;
|
|
68569
|
+
closed = true;
|
|
68570
|
+
clearTimeout(deadline);
|
|
68571
|
+
try {
|
|
68572
|
+
controller.close();
|
|
68573
|
+
} catch {}
|
|
68574
|
+
};
|
|
68575
|
+
controller.enqueue(encoder.encode(`${JSON.stringify(envelope)}
|
|
68576
|
+
`));
|
|
68577
|
+
store.onSettle((entry) => {
|
|
68578
|
+
if (closed || entry.status !== "resolved")
|
|
68579
|
+
return;
|
|
68580
|
+
controller.enqueue(encoder.encode(`${JSON.stringify([entry.path, entry.variantKey, entry.data])}
|
|
68581
|
+
`));
|
|
68582
|
+
});
|
|
68583
|
+
const deadline = setTimeout(close, deadlineMs);
|
|
68584
|
+
store.allSettled().then(close, close);
|
|
68585
|
+
}
|
|
68586
|
+
});
|
|
68587
|
+
}
|
|
68588
|
+
|
|
68559
68589
|
// services/router/ViewRouterServiceContainer.ts
|
|
68560
68590
|
var STREAM_DEADLINE_MS = 1e4;
|
|
68561
68591
|
var themeScript = `
|
|
@@ -68636,6 +68666,7 @@ class ViewRouterServiceContainer extends ServiceContainer {
|
|
|
68636
68666
|
pathname,
|
|
68637
68667
|
serverQueries,
|
|
68638
68668
|
userAgent,
|
|
68669
|
+
noStream,
|
|
68639
68670
|
url,
|
|
68640
68671
|
user,
|
|
68641
68672
|
viewData,
|
|
@@ -68726,7 +68757,7 @@ class ViewRouterServiceContainer extends ServiceContainer {
|
|
|
68726
68757
|
serverQueries.markRenderStart();
|
|
68727
68758
|
const deadline = new AbortController;
|
|
68728
68759
|
const deadlineTimer = setTimeout(() => deadline.abort(), STREAM_DEADLINE_MS);
|
|
68729
|
-
const
|
|
68760
|
+
const settled = isBotUserAgent(userAgent) || noStream;
|
|
68730
68761
|
try {
|
|
68731
68762
|
const stream = await renderToReadableStream(import_react.createElement(import_react.Fragment, {
|
|
68732
68763
|
children: [
|
|
@@ -68749,7 +68780,7 @@ class ViewRouterServiceContainer extends ServiceContainer {
|
|
|
68749
68780
|
bootstrapScriptContent: `window.__GEMI_DATA__ = ${JSON.stringify(result.data)}; window.loaders=${loaders}`,
|
|
68750
68781
|
bootstrapModules,
|
|
68751
68782
|
signal: deadline.signal,
|
|
68752
|
-
...
|
|
68783
|
+
...settled ? { progressiveChunkSize: Number.MAX_SAFE_INTEGER } : {},
|
|
68753
68784
|
onError(error) {
|
|
68754
68785
|
if (true) {
|
|
68755
68786
|
console.error(error);
|
|
@@ -68757,7 +68788,7 @@ class ViewRouterServiceContainer extends ServiceContainer {
|
|
|
68757
68788
|
}
|
|
68758
68789
|
});
|
|
68759
68790
|
stream.allReady.catch(() => {}).finally(() => clearTimeout(deadlineTimer));
|
|
68760
|
-
if (
|
|
68791
|
+
if (settled) {
|
|
68761
68792
|
await stream.allReady.catch(() => {});
|
|
68762
68793
|
}
|
|
68763
68794
|
return new Response(injectQueryPayloads(stream, serverQueries), {
|
|
@@ -68813,6 +68844,7 @@ class ViewRouterServiceContainer extends ServiceContainer {
|
|
|
68813
68844
|
let currentPathName = null;
|
|
68814
68845
|
let params = {};
|
|
68815
68846
|
let partial = null;
|
|
68847
|
+
let noStream = false;
|
|
68816
68848
|
try {
|
|
68817
68849
|
const match = matchViewRoute(this.flatViewRoutes, urlPathname);
|
|
68818
68850
|
if (match) {
|
|
@@ -68820,6 +68852,7 @@ class ViewRouterServiceContainer extends ServiceContainer {
|
|
|
68820
68852
|
params = match.params;
|
|
68821
68853
|
handlers = match.route.exec;
|
|
68822
68854
|
middlewares = match.route.middleware;
|
|
68855
|
+
noStream = middlewares.includes("no-stream");
|
|
68823
68856
|
if (isViewDataRequest && this.service.partialRendering) {
|
|
68824
68857
|
const from = req.headers.get(PARTIAL_RENDER_HEADER);
|
|
68825
68858
|
const plan = resolvePartialRender({
|
|
@@ -68875,9 +68908,6 @@ class ViewRouterServiceContainer extends ServiceContainer {
|
|
|
68875
68908
|
};
|
|
68876
68909
|
}
|
|
68877
68910
|
const data = await Promise.all(handlers.map((fn2) => fn2(httpRequest2)));
|
|
68878
|
-
if (isViewDataRequest) {
|
|
68879
|
-
await ctx.serverQueries.allSettled();
|
|
68880
|
-
}
|
|
68881
68911
|
const cookies = ctx.cookies;
|
|
68882
68912
|
const headers = ctx.headers;
|
|
68883
68913
|
pageData = {
|
|
@@ -68918,26 +68948,30 @@ class ViewRouterServiceContainer extends ServiceContainer {
|
|
|
68918
68948
|
return await createFileResponse(fileOutput, headers);
|
|
68919
68949
|
}
|
|
68920
68950
|
if (isViewDataRequest) {
|
|
68921
|
-
headers.set("Content-Type", "application/
|
|
68951
|
+
headers.set("Content-Type", "application/x-ndjson; charset=utf-8");
|
|
68922
68952
|
headers.append("Vary", PARTIAL_RENDER_HEADER);
|
|
68923
68953
|
cookies.forEach((cookie) => headers.append("Set-Cookie", cookie.toString()));
|
|
68924
68954
|
await this.service.onRequestEnd(httpRequest2);
|
|
68925
|
-
|
|
68955
|
+
const envelope = {
|
|
68926
68956
|
meta: partial && !ctx.metadata.touched ? null : pageData.meta,
|
|
68927
68957
|
data: {
|
|
68928
68958
|
[urlPathname]: viewData
|
|
68929
68959
|
},
|
|
68930
68960
|
breadcrumbs,
|
|
68931
|
-
prefetchedData:
|
|
68961
|
+
prefetchedData: ctx.serverQueries.snapshotResolved(),
|
|
68932
68962
|
i18n,
|
|
68933
68963
|
is404: !currentPathName2,
|
|
68934
68964
|
appId: pageData.appId,
|
|
68935
68965
|
partial
|
|
68936
|
-
}
|
|
68966
|
+
};
|
|
68967
|
+
return new Response(createRoutePayloadStream(envelope, ctx.serverQueries), {
|
|
68937
68968
|
headers
|
|
68938
68969
|
});
|
|
68939
68970
|
}
|
|
68940
68971
|
headers.set("Content-Type", "text/html; charset=utf-8");
|
|
68972
|
+
if (!noStream) {
|
|
68973
|
+
headers.append("Vary", "User-Agent");
|
|
68974
|
+
}
|
|
68941
68975
|
for (const cookie of cookies) {
|
|
68942
68976
|
headers.append("Set-Cookie", cookie.toString());
|
|
68943
68977
|
}
|
|
@@ -68959,6 +68993,7 @@ class ViewRouterServiceContainer extends ServiceContainer {
|
|
|
68959
68993
|
pathname: url.pathname,
|
|
68960
68994
|
serverQueries: ctx.serverQueries,
|
|
68961
68995
|
userAgent: req.headers.get("user-agent"),
|
|
68996
|
+
noStream,
|
|
68962
68997
|
url,
|
|
68963
68998
|
user,
|
|
68964
68999
|
viewData,
|
|
@@ -70006,5 +70041,5 @@ program.command("app:route-manifest").action(async () => {
|
|
|
70006
70041
|
});
|
|
70007
70042
|
program.parse();
|
|
70008
70043
|
|
|
70009
|
-
//# debugId=
|
|
70044
|
+
//# debugId=DCB90EA813E43E3464756E2164756E21
|
|
70010
70045
|
//# sourceMappingURL=gemi.js.map
|