@timber-js/app 0.2.0-alpha.13 → 0.2.0-alpha.14
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/LICENSE +8 -0
- package/dist/_chunks/{debug-gwlJkDuf.js → debug-B3Gypr3D.js} +2 -2
- package/dist/_chunks/debug-B3Gypr3D.js.map +1 -0
- package/dist/_chunks/{format-DviM89f0.js → format-RyoGQL74.js} +2 -2
- package/dist/_chunks/{format-DviM89f0.js.map → format-RyoGQL74.js.map} +1 -1
- package/dist/_chunks/{request-context-DIkVh_jG.js → request-context-BQUC8PHn.js} +2 -2
- package/dist/_chunks/{request-context-DIkVh_jG.js.map → request-context-BQUC8PHn.js.map} +1 -1
- package/dist/cookies/index.js +1 -1
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/plugins/entries.d.ts.map +1 -1
- package/dist/server/debug.d.ts +1 -1
- package/dist/server/index.js +13 -13
- package/dist/server/index.js.map +1 -1
- package/dist/server/pipeline.d.ts +7 -4
- package/dist/server/pipeline.d.ts.map +1 -1
- package/dist/server/rsc-entry/index.d.ts.map +1 -1
- package/package.json +6 -7
- package/src/cli.ts +0 -0
- package/src/index.ts +16 -0
- package/src/plugins/entries.ts +1 -0
- package/src/server/debug.ts +1 -1
- package/src/server/pipeline.ts +27 -20
- package/src/server/rsc-entry/index.ts +16 -1
- package/dist/_chunks/debug-gwlJkDuf.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entries.d.ts","sourceRoot":"","sources":["../../src/plugins/entries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAInC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"entries.d.ts","sourceRoot":"","sources":["../../src/plugins/entries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAInC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AA6GhD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAUrE;AAED;;;;;;;;GAQG;AACH,wBAAgB,6BAA6B,CAAC,mBAAmB,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAwBxF;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAwExD"}
|
package/dist/server/debug.d.ts
CHANGED
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
*
|
|
46
46
|
* This is the ONLY function that should gate client-visible dev behavior:
|
|
47
47
|
* - Dev error pages with stack traces
|
|
48
|
-
* -
|
|
48
|
+
* - Server-Timing mode default (`'detailed'` in dev, `'total'` in prod)
|
|
49
49
|
* - Error messages in action `INTERNAL_ERROR` payloads
|
|
50
50
|
* - Pipeline error handler wiring (Vite overlay)
|
|
51
51
|
*
|
package/dist/server/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as isDevMode, t as isDebug } from "../_chunks/debug-
|
|
2
|
-
import { a as warnDenyAfterFlush, c as warnRedirectInAccess, d as warnSlowSlotWithoutSuspense, f as warnStaticRequestApi, i as warnCacheRequestProps, l as warnRedirectInSlotAccess, n as WarningId, o as warnDenyInSuspense, p as warnSuspenseWrappingChildren, r as setViteServer, s as warnDynamicApiInStaticBuild, t as formatSize, u as warnRedirectInSuspense } from "../_chunks/format-
|
|
1
|
+
import { n as isDevMode, t as isDebug } from "../_chunks/debug-B3Gypr3D.js";
|
|
2
|
+
import { a as warnDenyAfterFlush, c as warnRedirectInAccess, d as warnSlowSlotWithoutSuspense, f as warnStaticRequestApi, i as warnCacheRequestProps, l as warnRedirectInSlotAccess, n as WarningId, o as warnDenyInSuspense, p as warnSuspenseWrappingChildren, r as setViteServer, s as warnDynamicApiInStaticBuild, t as formatSize, u as warnRedirectInSuspense } from "../_chunks/format-RyoGQL74.js";
|
|
3
3
|
import { i as getMetadataRouteServePath, n as classifyMetadataRoute, r as getMetadataRouteAutoLink, t as METADATA_ROUTE_CONVENTIONS } from "../_chunks/metadata-routes-Cjmvi3rQ.js";
|
|
4
4
|
import { a as timingAls, i as revalidationAls, n as formFlashAls, s as waitUntilAls, t as earlyHintsSenderAls } from "../_chunks/als-registry-B7DbZ2hS.js";
|
|
5
|
-
import { a as markResponseFlushed, c as setCookieSecrets, i as headers, l as setMutableCookieContext, n as cookies, o as runWithRequestContext, r as getSetCookieHeaders, s as searchParams, t as applyRequestHeaderOverlay, u as setParsedSearchParams } from "../_chunks/request-context-
|
|
5
|
+
import { a as markResponseFlushed, c as setCookieSecrets, i as headers, l as setMutableCookieContext, n as cookies, o as runWithRequestContext, r as getSetCookieHeaders, s as searchParams, t as applyRequestHeaderOverlay, u as setParsedSearchParams } from "../_chunks/request-context-BQUC8PHn.js";
|
|
6
6
|
import { a as getTraceStore, c as setSpanAttribute, d as withSpan, i as getOtelTraceId, l as spanId, o as replaceTraceId, r as generateTraceId, s as runWithTraceId, t as addSpanEvent, u as traceId } from "../_chunks/tracing-CemImE6h.js";
|
|
7
7
|
import { readFile } from "node:fs/promises";
|
|
8
8
|
//#region src/server/waituntil-bridge.ts
|
|
@@ -819,7 +819,7 @@ function pathnameMatchesPattern(pathname, pattern) {
|
|
|
819
819
|
* and produces a Response. This is the top-level entry point for the server.
|
|
820
820
|
*/
|
|
821
821
|
function createPipeline(config) {
|
|
822
|
-
const { proxy, matchRoute, render, earlyHints, stripTrailingSlash = true, slowRequestMs = 3e3,
|
|
822
|
+
const { proxy, matchRoute, render, earlyHints, stripTrailingSlash = true, slowRequestMs = 3e3, serverTiming = "total", onPipelineError } = config;
|
|
823
823
|
let activeRequests = 0;
|
|
824
824
|
return async (req) => {
|
|
825
825
|
const url = new URL(req.url);
|
|
@@ -844,13 +844,13 @@ function createPipeline(config) {
|
|
|
844
844
|
if (proxy || config.proxyLoader) result = await runProxyPhase(req, method, path);
|
|
845
845
|
else result = await handleRequest(req, method, path);
|
|
846
846
|
await setSpanAttribute("http.response.status_code", result.status);
|
|
847
|
-
if (
|
|
848
|
-
const
|
|
849
|
-
if (
|
|
847
|
+
if (serverTiming === "detailed") {
|
|
848
|
+
const timingHeader = getServerTimingHeader();
|
|
849
|
+
if (timingHeader) {
|
|
850
850
|
result = ensureMutableResponse(result);
|
|
851
|
-
result.headers.set("Server-Timing",
|
|
851
|
+
result.headers.set("Server-Timing", timingHeader);
|
|
852
852
|
}
|
|
853
|
-
} else {
|
|
853
|
+
} else if (serverTiming === "total") {
|
|
854
854
|
const totalMs = Math.round(performance.now() - startTime);
|
|
855
855
|
result = ensureMutableResponse(result);
|
|
856
856
|
result.headers.set("Server-Timing", `total;dur=${totalMs}`);
|
|
@@ -877,7 +877,7 @@ function createPipeline(config) {
|
|
|
877
877
|
});
|
|
878
878
|
return response;
|
|
879
879
|
};
|
|
880
|
-
return
|
|
880
|
+
return serverTiming === "detailed" ? runWithTimingCollector(runRequest) : runRequest();
|
|
881
881
|
});
|
|
882
882
|
});
|
|
883
883
|
};
|
|
@@ -887,7 +887,7 @@ function createPipeline(config) {
|
|
|
887
887
|
if (config.proxyLoader) proxyExport = (await config.proxyLoader()).default;
|
|
888
888
|
else proxyExport = config.proxy;
|
|
889
889
|
const proxyFn = () => runProxy(proxyExport, req, () => handleRequest(req, method, path));
|
|
890
|
-
return await withSpan("timber.proxy", {}, () =>
|
|
890
|
+
return await withSpan("timber.proxy", {}, () => serverTiming === "detailed" ? withTiming("proxy", "proxy.ts", proxyFn) : proxyFn());
|
|
891
891
|
} catch (error) {
|
|
892
892
|
logProxyError({ error });
|
|
893
893
|
await fireOnRequestError(error, req, "proxy");
|
|
@@ -973,7 +973,7 @@ function createPipeline(config) {
|
|
|
973
973
|
try {
|
|
974
974
|
setMutableCookieContext(true);
|
|
975
975
|
const middlewareFn = () => runMiddleware(match.middleware, ctx);
|
|
976
|
-
const middlewareResponse = await withSpan("timber.middleware", {}, () =>
|
|
976
|
+
const middlewareResponse = await withSpan("timber.middleware", {}, () => serverTiming === "detailed" ? withTiming("mw", "middleware.ts", middlewareFn) : middlewareFn());
|
|
977
977
|
setMutableCookieContext(false);
|
|
978
978
|
if (middlewareResponse) {
|
|
979
979
|
const finalResponse = ensureMutableResponse(middlewareResponse);
|
|
@@ -1017,7 +1017,7 @@ function createPipeline(config) {
|
|
|
1017
1017
|
applyCookieJar(responseHeaders);
|
|
1018
1018
|
try {
|
|
1019
1019
|
const renderFn = () => render(req, match, responseHeaders, requestHeaderOverlay, interception);
|
|
1020
|
-
const response = await withSpan("timber.render", { "http.route": canonicalPathname }, () =>
|
|
1020
|
+
const response = await withSpan("timber.render", { "http.route": canonicalPathname }, () => serverTiming === "detailed" ? withTiming("render", "RSC + SSR render", renderFn) : renderFn());
|
|
1021
1021
|
markResponseFlushed();
|
|
1022
1022
|
return response;
|
|
1023
1023
|
} catch (error) {
|