@timber-js/app 0.2.0-alpha.235 → 0.2.0-alpha.236
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/_chunks/{actions-CYjRMpZI.js → actions-Top9GftB.js} +3 -3
- package/dist/_chunks/{actions-CYjRMpZI.js.map → actions-Top9GftB.js.map} +1 -1
- package/dist/_chunks/{cache-api-BZJNt01a.js → cache-api-Bo8c7XVF.js} +6 -6
- package/dist/_chunks/{cache-api-BZJNt01a.js.map → cache-api-Bo8c7XVF.js.map} +1 -1
- package/dist/_chunks/{chains-D-RRc7CM.js → chains-BsGKkMTK.js} +2 -2
- package/dist/_chunks/{chains-D-RRc7CM.js.map → chains-BsGKkMTK.js.map} +1 -1
- package/dist/_chunks/chains-DHmoKxkO.js +1 -0
- package/dist/_chunks/{classify-_W0RWa5w.js → classify-cmE0Gins.js} +2 -2
- package/dist/_chunks/{classify-_W0RWa5w.js.map → classify-cmE0Gins.js.map} +1 -1
- package/dist/_chunks/{cli-check-Dl3yo3Zv.js → cli-check-BwiahbTC.js} +3 -3
- package/dist/_chunks/{cli-check-Dl3yo3Zv.js.map → cli-check-BwiahbTC.js.map} +1 -1
- package/dist/_chunks/{cli-schema-sync-CyrOHbAo.js → cli-schema-sync-B2ldclRO.js} +2 -2
- package/dist/_chunks/{cli-schema-sync-CyrOHbAo.js.map → cli-schema-sync-B2ldclRO.js.map} +1 -1
- package/dist/_chunks/{cli-schema-sync-CTWiBMZZ.js → cli-schema-sync-Brw7kTmm.js} +1 -1
- package/dist/_chunks/{client-dep-entries-C9hv-3k9.js → client-dep-entries-C1nMlLKV.js} +2 -2
- package/dist/_chunks/{client-dep-entries-C9hv-3k9.js.map → client-dep-entries-C1nMlLKV.js.map} +1 -1
- package/dist/_chunks/{cloudflare-_2fhxQE8.js → cloudflare-Dk5Hqo-O.js} +3 -3
- package/dist/_chunks/{cloudflare-_2fhxQE8.js.map → cloudflare-Dk5Hqo-O.js.map} +1 -1
- package/dist/_chunks/{convention-lint-D54k6uUM.js → convention-lint-CLpuzY5h.js} +3 -3
- package/dist/_chunks/{convention-lint-D54k6uUM.js.map → convention-lint-CLpuzY5h.js.map} +1 -1
- package/dist/_chunks/dev-server-BGGGhHXx.js +1 -0
- package/dist/_chunks/{dev-server-cmWVDgTf.js → dev-server-lrdpD7Ws.js} +121 -5
- package/dist/_chunks/dev-server-lrdpD7Ws.js.map +1 -0
- package/dist/_chunks/{dev-span-_NzMX-au.js → dev-span-RsVeYYc_.js} +5 -2
- package/dist/_chunks/dev-span-RsVeYYc_.js.map +1 -0
- package/dist/_chunks/{error-boundary-Cf1m-Ywk.js → error-boundary-Bh-egWUI.js} +6 -6
- package/dist/_chunks/{error-boundary-Cf1m-Ywk.js.map → error-boundary-Bh-egWUI.js.map} +1 -1
- package/dist/_chunks/{flight-source-node-BGanuoSS.js → flight-source-node-BO_xD9jC.js} +2 -2
- package/dist/_chunks/{flight-source-node-BGanuoSS.js.map → flight-source-node-BO_xD9jC.js.map} +1 -1
- package/dist/_chunks/{href-BtspoNc9.js → href-8l5VD23D.js} +2 -2
- package/dist/_chunks/{href-BtspoNc9.js.map → href-8l5VD23D.js.map} +1 -1
- package/dist/_chunks/{json-lossy-check-BXM45k8p.js → json-lossy-check-D47R9Fp5.js} +2 -2
- package/dist/_chunks/{json-lossy-check-BXM45k8p.js.map → json-lossy-check-D47R9Fp5.js.map} +1 -1
- package/dist/_chunks/{live-graph-C7-yA8W9.js → live-graph-ChuFfmLi.js} +4 -4
- package/dist/_chunks/{live-graph-C7-yA8W9.js.map → live-graph-ChuFfmLi.js.map} +1 -1
- package/dist/_chunks/{logger-YtMSKfft.js → logger-DDLtp5e-.js} +16 -1
- package/dist/_chunks/logger-DDLtp5e-.js.map +1 -0
- package/dist/_chunks/navigation-root-Cvb7P1ud.js.map +1 -1
- package/dist/_chunks/{node-response-D3hXWb8y.js → node-response-DNNnKnoS.js} +2 -2
- package/dist/_chunks/{node-response-D3hXWb8y.js.map → node-response-DNNnKnoS.js.map} +1 -1
- package/dist/_chunks/{poison-scan-CRSP06Es.js → poison-scan-CJ9QfJWb.js} +2 -2
- package/dist/_chunks/{poison-scan-CRSP06Es.js.map → poison-scan-CJ9QfJWb.js.map} +1 -1
- package/dist/_chunks/{scanner-BNQ4qnLX.js → scanner-CrB_h6FA.js} +5 -5
- package/dist/_chunks/{scanner-BNQ4qnLX.js.map → scanner-CrB_h6FA.js.map} +1 -1
- package/dist/_chunks/{sizeof-Cmx6Fs-Y.js → sizeof-DVhEVN_y.js} +2 -2
- package/dist/_chunks/{sizeof-Cmx6Fs-Y.js.map → sizeof-DVhEVN_y.js.map} +1 -1
- package/dist/_chunks/{walkers-DFC9KsBL.js → walkers-BUvpsb2Q.js} +3 -3
- package/dist/_chunks/{walkers-DFC9KsBL.js.map → walkers-BUvpsb2Q.js.map} +1 -1
- package/dist/adapters/cloudflare-dev.js +1 -1
- package/dist/adapters/cloudflare-kv-cache.js +2 -2
- package/dist/adapters/cloudflare.js +1 -1
- package/dist/adapters/nitro.js +1 -1
- package/dist/analyze/crawl-entry.js +3 -3
- package/dist/analyze/graph-command.js +3 -3
- package/dist/cache/index.js +2 -2
- package/dist/cache/stores/memory.js +1 -1
- package/dist/cli.js +3 -3
- package/dist/client/dev-pill/index.d.ts +2 -1
- package/dist/client/dev-pill/index.d.ts.map +1 -1
- package/dist/client/dev-pill/view.d.ts.map +1 -1
- package/dist/client/error-boundary.js +1 -1
- package/dist/client/index.js +4 -4
- package/dist/client/internal.js +3 -3
- package/dist/cookies/index.js +1 -1
- package/dist/dev-tools/await-span.d.ts +7 -0
- package/dist/dev-tools/await-span.d.ts.map +1 -1
- package/dist/dev-tools/instrumentation.d.ts.map +1 -1
- package/dist/dev-tools/logger.d.ts +8 -2
- package/dist/dev-tools/logger.d.ts.map +1 -1
- package/dist/dev-tools/span-sink.d.ts +9 -1
- package/dist/dev-tools/span-sink.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +73 -31
- package/dist/index.js.map +1 -1
- package/dist/native/rsc/_react/chunks/{react-server-dom-webpack-server.node.development-hQ_odxIB.js → react-server-dom-webpack-server.node.development-CAttMzVD.js} +2 -2
- package/dist/native/rsc/_react/flight-client.js +2 -2
- package/dist/native/rsc/_react/flight-server.js +1 -1
- package/dist/native/rsc/_react/flight-static.js +1 -1
- package/dist/native/rsc/adapters/cloudflare-kv-cache.js +1 -1
- package/dist/native/rsc/adapters/cloudflare.js +2 -2
- package/dist/native/rsc/cache/cache-api.js +3 -3
- package/dist/native/rsc/cache/index.js +3 -3
- package/dist/native/rsc/cache/timber-cache.js +2 -2
- package/dist/native/rsc/cdn/index.js +1 -1
- package/dist/native/rsc/client/use-cookie.js +1 -1
- package/dist/native/rsc/dev-tools/404-page.js +1 -1
- package/dist/native/rsc/dev-tools/await-span.js +5 -2
- package/dist/native/rsc/dev-tools/await-span.js.map +1 -1
- package/dist/native/rsc/dev-tools/error-page.js +2 -2
- package/dist/native/rsc/dev-tools/instrumentation.js +38 -3
- package/dist/native/rsc/dev-tools/instrumentation.js.map +1 -1
- package/dist/native/rsc/dev-tools/logger.js +123 -80
- package/dist/native/rsc/dev-tools/logger.js.map +1 -1
- package/dist/native/rsc/dev-tools/span-sink.js +1 -0
- package/dist/native/rsc/dev-tools/span-sink.js.map +1 -1
- package/dist/native/rsc/dev-tools/terminal.js +1 -1
- package/dist/native/rsc/manifest.json +1 -0
- package/dist/native/rsc/params/index.js +1 -1
- package/dist/native/rsc/routing/collision-probe.js +1 -1
- package/dist/native/rsc/routing/interception.js +1 -1
- package/dist/native/rsc/search-params/define.js +2 -2
- package/dist/native/rsc/server/access-gate.js +1 -1
- package/dist/native/rsc/server/action-client.js +2 -2
- package/dist/native/rsc/server/action-handler.js +8 -8
- package/dist/native/rsc/server/actions.js +3 -3
- package/dist/native/rsc/server/children-interception.js +1 -1
- package/dist/native/rsc/server/deny-boundary.js +1 -1
- package/dist/native/rsc/server/deny-renderer.js +10 -10
- package/dist/native/rsc/server/fallback-error.js +1 -1
- package/dist/native/rsc/server/flight-injector-core.js +2 -2
- package/dist/native/rsc/server/flight-source-node.js +2 -2
- package/dist/native/rsc/server/index.js +4 -4
- package/dist/native/rsc/server/interception-gates.js +2 -2
- package/dist/native/rsc/server/internal.js +15 -15
- package/dist/native/rsc/server/logger.js +2 -2
- package/dist/native/rsc/server/metadata-route-links.js +1 -1
- package/dist/native/rsc/server/node-body-response.js +1 -1
- package/dist/native/rsc/server/param-coercion.js +1 -1
- package/dist/native/rsc/server/pipeline-helpers.js +10 -10
- package/dist/native/rsc/server/pipeline-interception.js +4 -4
- package/dist/native/rsc/server/pipeline-metadata-route.js +10 -10
- package/dist/native/rsc/server/pipeline-outcome.js +4 -4
- package/dist/native/rsc/server/pipeline-phases.js +11 -11
- package/dist/native/rsc/server/pipeline.js +10 -10
- package/dist/native/rsc/server/prebuilt/capture-render.js +1 -1
- package/dist/native/rsc/server/prebuilt/dev-store.js +1 -1
- package/dist/native/rsc/server/prebuilt/overlay.js +3 -3
- package/dist/native/rsc/server/prebuilt-builder.js +8 -8
- package/dist/native/rsc/server/prebuilt-runtime.js +15 -15
- package/dist/native/rsc/server/primitives.js +2 -2
- package/dist/native/rsc/server/publish-params.js +1 -1
- package/dist/native/rsc/server/request-context.js +1 -1
- package/dist/native/rsc/server/route-element-builder.js +7 -7
- package/dist/native/rsc/server/route-element-helpers.js +1 -1
- package/dist/native/rsc/server/route-handler.js +1 -1
- package/dist/native/rsc/server/rsc-entry/action-dispatcher.js +1 -1
- package/dist/native/rsc/server/rsc-entry/action-middleware-runner.js +1 -1
- package/dist/native/rsc/server/rsc-entry/api-handler.js +1 -1
- package/dist/native/rsc/server/rsc-entry/deny-fallback.js +6 -6
- package/dist/native/rsc/server/rsc-entry/error-renderer.js +7 -7
- package/dist/native/rsc/server/rsc-entry/helpers.js +1 -1
- package/dist/native/rsc/server/rsc-entry/render-route.js +4 -4
- package/dist/native/rsc/server/rsc-entry/revalidate-renderer.js +7 -7
- package/dist/native/rsc/server/rsc-entry/rsc-payload.js +3 -3
- package/dist/native/rsc/server/rsc-entry/rsc-stream.js +6 -6
- package/dist/native/rsc/server/rsc-entry/ssr-renderer.js +10 -10
- package/dist/native/rsc/server/rsc-error-envelope.js +1 -1
- package/dist/native/rsc/server/sitemap-handler.js +1 -1
- package/dist/native/rsc/server/skippable-prefix.js +2 -2
- package/dist/native/rsc/server/slot-interception.js +1 -1
- package/dist/native/rsc/server/slot-resolver.js +11 -11
- package/dist/native/rsc/server/static-generator.js +2 -2
- package/dist/native/rsc/server/traced-access.js +1 -1
- package/dist/native/rsc/server/tracing.js +10 -0
- package/dist/native/rsc/server/tracing.js.map +1 -1
- package/dist/native/rsc/shared/dev-span.js +8 -2
- package/dist/native/rsc/shared/dev-span.js.map +1 -1
- package/dist/native/rsc/shared/href.js +1 -1
- package/dist/native/rsc/shared/span-waterfall.js +90 -0
- package/dist/native/rsc/shared/span-waterfall.js.map +1 -0
- package/dist/native/ssr/adapters/cloudflare-kv-cache.js +1 -1
- package/dist/native/ssr/adapters/cloudflare.js +2 -2
- package/dist/native/ssr/cache/cache-api.js +3 -3
- package/dist/native/ssr/cache/guarded-read.js +1 -1
- package/dist/native/ssr/cache/index.js +3 -3
- package/dist/native/ssr/cache/timber-cache.js +3 -3
- package/dist/native/ssr/cdn/index.js +1 -1
- package/dist/native/ssr/client/error-boundary.js +1 -1
- package/dist/native/ssr/client/index.js +5 -5
- package/dist/native/ssr/client/link.js +5 -5
- package/dist/native/ssr/client/navigation-commit.js +2 -2
- package/dist/native/ssr/client/nuqs-adapter.js +2 -2
- package/dist/native/ssr/client/params-context.js +1 -1
- package/dist/native/ssr/client/router-skew.js +1 -1
- package/dist/native/ssr/client/rsc-fetch.js +2 -2
- package/dist/native/ssr/client/use-pending-navigation.js +1 -1
- package/dist/native/ssr/client/use-search-params.js +2 -2
- package/dist/native/ssr/client/use-segment-params.js +1 -1
- package/dist/native/ssr/client/use-selected-layout-segment.js +1 -1
- package/dist/native/ssr/dev-tools/await-span.js +5 -2
- package/dist/native/ssr/dev-tools/await-span.js.map +1 -1
- package/dist/native/ssr/dev-tools/instrumentation.js +38 -3
- package/dist/native/ssr/dev-tools/instrumentation.js.map +1 -1
- package/dist/native/ssr/dev-tools/logger.js +123 -80
- package/dist/native/ssr/dev-tools/logger.js.map +1 -1
- package/dist/native/ssr/dev-tools/span-sink.js +1 -0
- package/dist/native/ssr/dev-tools/span-sink.js.map +1 -1
- package/dist/native/ssr/manifest.json +1 -0
- package/dist/native/ssr/params/index.js +1 -1
- package/dist/native/ssr/search-params/define.js +2 -2
- package/dist/native/ssr/server/access-gate.js +1 -1
- package/dist/native/ssr/server/action-client.js +2 -2
- package/dist/native/ssr/server/actions.js +3 -3
- package/dist/native/ssr/server/deny-boundary.js +2 -2
- package/dist/native/ssr/server/flight-injector-core.js +1 -1
- package/dist/native/ssr/server/flight-source-node.js +2 -2
- package/dist/native/ssr/server/index.js +4 -4
- package/dist/native/ssr/server/internal.js +12 -12
- package/dist/native/ssr/server/logger.js +2 -2
- package/dist/native/ssr/server/node-body-response.js +1 -1
- package/dist/native/ssr/server/node-stream-transforms.js +2 -2
- package/dist/native/ssr/server/param-coercion.js +3 -3
- package/dist/native/ssr/server/pipeline-helpers.js +7 -7
- package/dist/native/ssr/server/pipeline-interception.js +4 -4
- package/dist/native/ssr/server/pipeline-metadata-route.js +10 -10
- package/dist/native/ssr/server/pipeline-outcome.js +4 -4
- package/dist/native/ssr/server/pipeline-phases.js +10 -10
- package/dist/native/ssr/server/pipeline.js +10 -10
- package/dist/native/ssr/server/prebuilt/capture-render.js +2 -2
- package/dist/native/ssr/server/prebuilt/dev-store.js +1 -1
- package/dist/native/ssr/server/prebuilt/overlay.js +4 -4
- package/dist/native/ssr/server/prebuilt-runtime.js +14 -14
- package/dist/native/ssr/server/primitives.js +2 -2
- package/dist/native/ssr/server/request-context.js +2 -2
- package/dist/native/ssr/server/route-handler.js +1 -1
- package/dist/native/ssr/server/rsc-error-envelope.js +1 -1
- package/dist/native/ssr/server/ssr-form-state.js +2 -2
- package/dist/native/ssr/server/ssr-wrappers.js +1 -1
- package/dist/native/ssr/server/traced-access.js +1 -1
- package/dist/native/ssr/server/tracing.js +10 -0
- package/dist/native/ssr/server/tracing.js.map +1 -1
- package/dist/native/ssr/shared/dev-span.js +8 -2
- package/dist/native/ssr/shared/dev-span.js.map +1 -1
- package/dist/native/ssr/shared/href.js +1 -1
- package/dist/native/ssr/shared/span-waterfall.js +90 -0
- package/dist/native/ssr/shared/span-waterfall.js.map +1 -0
- package/dist/plugins/dev-precompile.d.ts +84 -0
- package/dist/plugins/dev-precompile.d.ts.map +1 -0
- package/dist/plugins/dev-server.d.ts.map +1 -1
- package/dist/plugins/entries.d.ts.map +1 -1
- package/dist/plugins/virtual-ids.d.ts +16 -0
- package/dist/plugins/virtual-ids.d.ts.map +1 -0
- package/dist/routes/index.js +1 -1
- package/dist/routing/index.js +3 -3
- package/dist/search-params/index.js +2 -2
- package/dist/server/index.js +2 -2
- package/dist/server/internal.js +14 -14
- package/dist/server/tracing.d.ts.map +1 -1
- package/dist/shared/dev-span.d.ts +12 -1
- package/dist/shared/dev-span.d.ts.map +1 -1
- package/dist/shared/span-waterfall.d.ts +88 -0
- package/dist/shared/span-waterfall.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/client/dev-pill/index.ts +5 -2
- package/src/client/dev-pill/store.ts +1 -1
- package/src/client/dev-pill/view.ts +15 -5
- package/src/dev-tools/await-span.ts +10 -0
- package/src/dev-tools/instrumentation.ts +44 -6
- package/src/dev-tools/logger.ts +230 -155
- package/src/dev-tools/span-sink.ts +34 -3
- package/src/index.ts +21 -11
- package/src/plugins/dev-precompile.ts +168 -0
- package/src/plugins/dev-server.ts +16 -3
- package/src/plugins/entries.ts +1 -11
- package/src/plugins/virtual-ids.ts +15 -0
- package/src/server/tracing.ts +29 -0
- package/src/shared/dev-span.ts +17 -2
- package/src/{client/dev-pill/waterfall.ts → shared/span-waterfall.ts} +84 -51
- package/dist/_chunks/chains-KblEfYzm.js +0 -1
- package/dist/_chunks/dev-server-DrYBIg66.js +0 -1
- package/dist/_chunks/dev-server-cmWVDgTf.js.map +0 -1
- package/dist/_chunks/dev-span-_NzMX-au.js.map +0 -1
- package/dist/_chunks/logger-YtMSKfft.js.map +0 -1
- package/dist/client/dev-pill/waterfall.d.ts +0 -64
- package/dist/client/dev-pill/waterfall.d.ts.map +0 -1
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { AWAIT_SPAN_NAME, FETCH_BODY_SPAN_NAME, FETCH_SPAN_NAME } from "./dev-span.js";
|
|
2
|
+
// src/shared/span-waterfall.ts
|
|
3
|
+
var IO_SPANS = new Set([
|
|
4
|
+
AWAIT_SPAN_NAME,
|
|
5
|
+
FETCH_SPAN_NAME,
|
|
6
|
+
FETCH_BODY_SPAN_NAME
|
|
7
|
+
]);
|
|
8
|
+
var WAIT_COVERAGE = .8;
|
|
9
|
+
var FOLD_COVERAGE = .9;
|
|
10
|
+
var duration = (s) => s.endMs - s.startMs;
|
|
11
|
+
function unionLength(intervals) {
|
|
12
|
+
let total = 0;
|
|
13
|
+
let reach = -Infinity;
|
|
14
|
+
for (const [start, end] of intervals.sort((a, b) => a[0] - b[0])) {
|
|
15
|
+
if (end <= reach) continue;
|
|
16
|
+
total += end - Math.max(start, reach);
|
|
17
|
+
reach = end;
|
|
18
|
+
}
|
|
19
|
+
return total;
|
|
20
|
+
}
|
|
21
|
+
function explainedWaits(spans) {
|
|
22
|
+
const byId = new Map(spans.map((s) => [s.spanId, s]));
|
|
23
|
+
const parents = new Set(spans.map((s) => s.parentSpanId));
|
|
24
|
+
const isCandidate = (s) => s.attributes["timber.await_wait"] === true && !parents.has(s.spanId);
|
|
25
|
+
const work = spans.filter((s) => IO_SPANS.has(s.name) && !isCandidate(s));
|
|
26
|
+
const explained = new Set();
|
|
27
|
+
for (const wait of spans) {
|
|
28
|
+
if (!isCandidate(wait) || duration(wait) <= 0) continue;
|
|
29
|
+
const ancestors = new Set();
|
|
30
|
+
for (let p = wait.parentSpanId; p && !ancestors.has(p); p = byId.get(p)?.parentSpanId) ancestors.add(p);
|
|
31
|
+
const covering = [];
|
|
32
|
+
for (const s of work) {
|
|
33
|
+
if (ancestors.has(s.spanId)) continue;
|
|
34
|
+
const start = Math.max(s.startMs, wait.startMs);
|
|
35
|
+
const end = Math.min(s.endMs, wait.endMs);
|
|
36
|
+
if (end > start) covering.push([start, end]);
|
|
37
|
+
}
|
|
38
|
+
if (unionLength(covering) >= WAIT_COVERAGE * duration(wait)) explained.add(wait.spanId);
|
|
39
|
+
}
|
|
40
|
+
return explained;
|
|
41
|
+
}
|
|
42
|
+
function buildWaterfall(spans, { ioOnly = false, skip, hideWaits = false, fold = false, expanded = new Set() } = {}) {
|
|
43
|
+
if (spans.length === 0) return {
|
|
44
|
+
rows: [],
|
|
45
|
+
hiddenWaits: 0
|
|
46
|
+
};
|
|
47
|
+
const ids = new Set(spans.map((s) => s.spanId));
|
|
48
|
+
const children = new Map();
|
|
49
|
+
for (const span of spans) {
|
|
50
|
+
const parent = span.parentSpanId && ids.has(span.parentSpanId) ? span.parentSpanId : void 0;
|
|
51
|
+
const siblings = children.get(parent) ?? [];
|
|
52
|
+
siblings.push(span);
|
|
53
|
+
children.set(parent, siblings);
|
|
54
|
+
}
|
|
55
|
+
for (const siblings of children.values()) siblings.sort((a, b) => a.startMs - b.startMs);
|
|
56
|
+
const waits = explainedWaits(spans);
|
|
57
|
+
const kept = (s) => (!ioOnly || IO_SPANS.has(s.name)) && !skip?.(s);
|
|
58
|
+
const hidden = (s) => hideWaits && waits.has(s.spanId);
|
|
59
|
+
const visibleChildren = (parent) => (children.get(parent) ?? []).flatMap((s) => hidden(s) ? [] : kept(s) ? [s] : visibleChildren(s.spanId));
|
|
60
|
+
const origin = Math.min(...spans.map((s) => s.startMs));
|
|
61
|
+
const rows = [];
|
|
62
|
+
const emit = (span, depth) => {
|
|
63
|
+
const folded = [];
|
|
64
|
+
let tail = span;
|
|
65
|
+
let kids = visibleChildren(tail.spanId);
|
|
66
|
+
const foldable = (kid) => kid !== void 0 && !waits.has(kid.spanId) && (tail.name === "timber.await" || kid.name === "timber.await" && !IO_SPANS.has(tail.name)) && kid.startMs >= tail.startMs && kid.endMs <= tail.endMs && duration(kid) >= FOLD_COVERAGE * duration(tail);
|
|
67
|
+
if (fold && !expanded.has(span.spanId)) for (let only = kids.length === 1 ? kids[0] : void 0; foldable(only); only = kids.length === 1 ? kids[0] : void 0) {
|
|
68
|
+
tail = only;
|
|
69
|
+
folded.push(tail);
|
|
70
|
+
kids = visibleChildren(tail.spanId);
|
|
71
|
+
}
|
|
72
|
+
rows.push({
|
|
73
|
+
span,
|
|
74
|
+
folded,
|
|
75
|
+
wait: waits.has(span.spanId),
|
|
76
|
+
depth,
|
|
77
|
+
offsetMs: span.startMs - origin,
|
|
78
|
+
durationMs: duration(span)
|
|
79
|
+
});
|
|
80
|
+
for (const kid of kids) emit(kid, depth + 1);
|
|
81
|
+
};
|
|
82
|
+
for (const span of visibleChildren(void 0)) emit(span, 0);
|
|
83
|
+
return {
|
|
84
|
+
rows,
|
|
85
|
+
hiddenWaits: hideWaits ? waits.size : 0
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
export { buildWaterfall, explainedWaits };
|
|
89
|
+
|
|
90
|
+
//# sourceMappingURL=span-waterfall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"span-waterfall.js","names":[],"sources":["../../../../src/shared/span-waterfall.ts"],"mappings":";;AAqBA,IAAM,WAAW,IAAI,IAAI;CAAC;CAAiB;CAAiB;AAAoB,CAAC;AAMjF,IAAM,gBAAgB;AAMtB,IAAM,gBAAgB;AAgDtB,IAAM,YAAY,MAAqB,EAAE,QAAQ,EAAE;AAGnD,SAAS,YAAY,WAA4C;CAC/D,IAAI,QAAQ;CACZ,IAAI,QAAQ;CACZ,KAAK,MAAM,CAAC,OAAO,QAAQ,UAAU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,WAAW,KAAK,WACpB,IAAI,SAAS,KAAK,SAClB,SAAS,GAAG,KAAK,gBAAgB,SAAS,IAAI;EAChD,IAAI,QAAQ,CAAC,SAAS,IAAI,KAAK,MAAM,GACnC,KACE,IAAI,OAAO,KAAK,WAAW,IAAI,KAAK,KAAK,QACzC,SAAS,IAAI,GACb,OAAO,KAAK,WAAW,IAAI,KAAK,KAAK,QACrC;GACA,OAAO;GACP,OAAO,KAAK,IAAI;GAChB,OAAO,gBAAgB,KAAK,MAAM;EACpC;EAEF,KAAK,KAAK;GACR;GACA;GACA,MAAM,MAAM,IAAI,KAAK,MAAM;GAC3B;GACA,UAAU,KAAK,UAAU;GACzB,YAAY,SAAS,IAAI;EAC3B,CAAC;EACD,KAAK,MAAM,OAAO,MAAM,KAAK,KAAK,QAAQ,CAAC;CAC7C;CACA,KAAK,MAAM,QAAQ,gBAAgB,MAAS,GAAG,KAAK,MAAM,CAAC;CAC3D,OAAO;EAAE;EAAM,aAAa,YAAY,MAAM,OAAO;CAAE;AACzD"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dev pre-compile — transform the server module graphs in the background
|
|
3
|
+
* once the dev server listens, so the first request does not wait on Vite
|
|
4
|
+
* compiling server code module by module.
|
|
5
|
+
*
|
|
6
|
+
* Vite pre-transforms nothing in server environments: the first request's
|
|
7
|
+
* module runner asks for each module as an import reaches it, one after
|
|
8
|
+
* another. On the kitchen-sink that was ~1.2s importing the RSC entry
|
|
9
|
+
* (~270 modules) and ~650ms more importing the SSR entry, which only starts
|
|
10
|
+
* after the RSC render. The crawl here transforms the same graph ahead of
|
|
11
|
+
* the request, without running it.
|
|
12
|
+
*
|
|
13
|
+
* - `env.transformRequest()` only: nothing executes, so the app's
|
|
14
|
+
* instrumentation `register()` and cache handler setup still run at the
|
|
15
|
+
* first request, as before.
|
|
16
|
+
* - Static imports only (`result.deps`), from the entries and the root
|
|
17
|
+
* layout. A route's own page and layouts are dynamic imports of the route
|
|
18
|
+
* manifest; they compile at the request for them.
|
|
19
|
+
* - Errors are swallowed. The request that loads the module hits the same
|
|
20
|
+
* error and reports it as it always has; Vite's `warmupRequest` was
|
|
21
|
+
* rejected because it logs each error a second time.
|
|
22
|
+
*
|
|
23
|
+
* - It stops when the HTTP server closes, and after
|
|
24
|
+
* {@link PRECOMPILE_DEADLINE_MS}. Vite's `close()` waits for every
|
|
25
|
+
* transform in flight, and server environments do not refuse new ones
|
|
26
|
+
* while closing, so a crawl that kept going would hold a restart for the
|
|
27
|
+
* rest of the graph.
|
|
28
|
+
*
|
|
29
|
+
* `analyze/crawl.ts` also walks `transformRequest`, for a different job:
|
|
30
|
+
* classifying every module the app can reach, dynamic imports included, in
|
|
31
|
+
* a throwaway middleware-mode server. Following its edges here would
|
|
32
|
+
* compile every route of the app at each start.
|
|
33
|
+
*
|
|
34
|
+
* See design/21-dev-server.md §"Server Pre-compile".
|
|
35
|
+
*/
|
|
36
|
+
import { type DevEnvironment, type ViteDevServer } from 'vite';
|
|
37
|
+
/** `TIMBER_DEV_PRECOMPILE=0` turns the crawl off (A/B measurement, escape hatch). */
|
|
38
|
+
export declare const PRECOMPILE_ENV = "TIMBER_DEV_PRECOMPILE";
|
|
39
|
+
/**
|
|
40
|
+
* Past this, the crawl starts no new transform. Generous: ~1.2s covers the
|
|
41
|
+
* kitchen-sink. It bounds a crawl stuck behind a slow transform plugin.
|
|
42
|
+
*/
|
|
43
|
+
export declare const PRECOMPILE_DEADLINE_MS = 60000;
|
|
44
|
+
/** The roots of each server environment's crawl. */
|
|
45
|
+
export interface PrecompileRoots {
|
|
46
|
+
rsc: string[];
|
|
47
|
+
ssr: string[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The id `transformRequest` takes for an entry of `result.deps`, or null for
|
|
51
|
+
* one it must not follow: a bare specifier, which in a server environment is
|
|
52
|
+
* a Node builtin (`node:fs`) or a package Vite externalized, both loaded by
|
|
53
|
+
* Node natively.
|
|
54
|
+
* Import analysis writes a `\0` virtual id as `/@id/__x00__…`, and other
|
|
55
|
+
* non-URL ids as `/@id/…`; the module runner unwraps both the same way.
|
|
56
|
+
*/
|
|
57
|
+
export declare function crawlableId(dep: string): string | null;
|
|
58
|
+
/**
|
|
59
|
+
* The URL a module importing `file` asks for, after import analysis: root
|
|
60
|
+
* relative inside the Vite root, `/@fs/…` outside it. Vite shares a
|
|
61
|
+
* transform in flight only between requests for the same URL, so a root
|
|
62
|
+
* seeded as a bare path would be transformed twice when a request for it
|
|
63
|
+
* arrives mid-crawl.
|
|
64
|
+
*/
|
|
65
|
+
export declare function fileUrl(file: string, root: string): string;
|
|
66
|
+
/**
|
|
67
|
+
* Transform `roots` and every module they statically import in `env`.
|
|
68
|
+
* Starts no transform once `shouldStop()` is true. Resolves with the
|
|
69
|
+
* number of modules visited once the graph is done; never rejects.
|
|
70
|
+
*/
|
|
71
|
+
export declare function crawlServerGraph(env: DevEnvironment, roots: string[], shouldStop?: () => boolean): Promise<number>;
|
|
72
|
+
/**
|
|
73
|
+
* Crawl the RSC graph, then the SSR graph with the client references the
|
|
74
|
+
* RSC crawl found. A request that arrives mid-crawl shares the transforms
|
|
75
|
+
* already in flight for the URLs it asks for.
|
|
76
|
+
*/
|
|
77
|
+
export declare function precompileServerGraphs(server: ViteDevServer, roots: PrecompileRoots, shouldStop: () => boolean): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Start the crawl in the background once `server` listens. Middleware mode
|
|
80
|
+
* (no HTTP server of Vite's own) is left alone: the host decides when
|
|
81
|
+
* requests start.
|
|
82
|
+
*/
|
|
83
|
+
export declare function precompileOnListen(server: ViteDevServer, roots: () => PrecompileRoots): void;
|
|
84
|
+
//# sourceMappingURL=dev-precompile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-precompile.d.ts","sourceRoot":"","sources":["../../src/plugins/dev-precompile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAiC1D;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,KAAK,CAAC;AA2BpC;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../../src/plugins/dev-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAGL,KAAK,MAAM,EAGZ,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,eAAe,EAAkB,MAAM,WAAW,CAAC;AAKjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAiC1D;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,KAAK,CAAC;AA2BpC;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAyP1D;AAgOD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,GAAG,IAAI,CA6CrE"}
|
|
@@ -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,sBAAsB,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,sBAAsB,CAAC;AAS1D,eAAO,MAAM,OAAO,QAEe,CAAC;AAiBpC;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,QAA2C,CAAC;AAE3E;;;GAGG;AACH,eAAO,MAAM,cAAc,QAAuC,CAAC;AAqInE;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAUlF;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAErE;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE3D;AAED;;;;;;;;GAQG;AACH,wBAAgB,6BAA6B,CAAC,mBAAmB,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAqBxF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CA+B3E;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAiFxD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* timber's virtual module IDs. A module of its own, with no imports, so any
|
|
3
|
+
* plugin can name an entry without importing `entries.ts`: that module
|
|
4
|
+
* finds `src/` from its own location (`SRC_DIR`), and an import from a
|
|
5
|
+
* plugin the bundler places in another chunk moves it there and breaks the
|
|
6
|
+
* lookup in the published package (TIM-1627).
|
|
7
|
+
*/
|
|
8
|
+
export declare const VIRTUAL_IDS: {
|
|
9
|
+
readonly rscEntry: 'virtual:timber-rsc-entry';
|
|
10
|
+
readonly ssrEntry: 'virtual:timber-ssr-entry';
|
|
11
|
+
readonly browserEntry: 'virtual:timber-browser-entry';
|
|
12
|
+
readonly config: 'virtual:timber-config';
|
|
13
|
+
readonly instrumentation: 'virtual:timber-instrumentation';
|
|
14
|
+
readonly cacheHandler: 'virtual:timber-cache-handler';
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=virtual-ids.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"virtual-ids.d.ts","sourceRoot":"","sources":["../../src/plugins/virtual-ids.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,WAAW;aACtB,QAAQ,EAAE,0BAA0B;aACpC,QAAQ,EAAE,0BAA0B;aACpC,YAAY,EAAE,8BAA8B;aAC5C,MAAM,EAAE,uBAAuB;aAC/B,eAAe,EAAE,gCAAgC;aACjD,YAAY,EAAE,8BAA8B;CACpC,CAAC"}
|
package/dist/routes/index.js
CHANGED
package/dist/routing/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { d as collectInterceptionRewrites, n as scanRoutes } from "../_chunks/scanner-BNQ4qnLX.js";
|
|
1
|
+
import { d as collectInterceptionRewrites, n as scanRoutes } from "../_chunks/scanner-CrB_h6FA.js";
|
|
3
2
|
import { t as generateRouteMap } from "../_chunks/codegen-vaCyFyVN.js";
|
|
4
|
-
import {
|
|
3
|
+
import { a as INTERCEPTION_MARKERS, i as DEFAULT_PAGE_EXTENSIONS, n as classifyUrlSegment, t as classifySegment } from "../_chunks/segment-classify-Ho8jXWeC.js";
|
|
4
|
+
import { n as collectDynamicSegmentsFromTree, r as validateSchemaAgainstRoutes, t as collectLeafRoutes } from "../_chunks/walkers-BUvpsb2Q.js";
|
|
5
5
|
export { DEFAULT_PAGE_EXTENSIONS, INTERCEPTION_MARKERS, classifySegment, classifyUrlSegment, collectDynamicSegmentsFromTree, collectInterceptionRewrites, collectLeafRoutes, generateRouteMap, scanRoutes, validateSchemaAgainstRoutes };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as getSearchParamsFromAls } from "../_chunks/als-slots-kbQrHTzm.js";
|
|
2
|
-
import { i as isStandardSchema, n as fromSchema, r as isCodec } from "../_chunks/schema-bridge-DyRs3cqy.js";
|
|
3
1
|
import { i as parseTotal, n as useQueryStates, r as serializedEqual } from "../_chunks/use-query-states-D3MMl-KM.js";
|
|
2
|
+
import { i as isStandardSchema, n as fromSchema, r as isCodec } from "../_chunks/schema-bridge-DyRs3cqy.js";
|
|
3
|
+
import { r as getSearchParamsFromAls } from "../_chunks/als-slots-kbQrHTzm.js";
|
|
4
4
|
import { debounce, defaultRateLimit, throttle } from "nuqs/server";
|
|
5
5
|
// src/search-params/define.ts
|
|
6
6
|
/**
|
package/dist/server/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as getHeaders, a as parseFormData, c as deny, d as waitUntil, i as coerce, l as redirect, n as revalidatePath, p as getCookieJar, r as revalidateTag, u as redirectExternal, y as getSegmentParams } from "../_chunks/actions-Top9GftB.js";
|
|
2
2
|
import { t as formatSize } from "../_chunks/format-DuPOoXUP.js";
|
|
3
|
-
import {
|
|
3
|
+
import { C as addSpanEvent, D as getSpanId, I as isDenySignal, L as isRedirectSignal, M as withSpan, O as getTraceId, S as isDevMode, x as isDebug } from "../_chunks/logger-DDLtp5e-.js";
|
|
4
4
|
// src/shared/redirect-type.ts
|
|
5
5
|
/**
|
|
6
6
|
* Next.js redirect type discriminator.
|
package/dist/server/internal.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as
|
|
3
|
-
import {
|
|
1
|
+
import { C as setMatchedSegmentPath, E as runOutsideReactCacheScope, S as runWithSegmentParams, T as setSegmentParams, b as markResponseFlushed, f as getCookie, g as getHeader, h as applyRequestHeaderOverlay, i as coerce, m as getSetCookieHeaders, o as DenySignal, s as RedirectSignal, t as executeAction, v as getSearchParams, w as setMutableCookieContext, x as runWithRequestContext, y as getSegmentParams } from "../_chunks/actions-Top9GftB.js";
|
|
2
|
+
import { i as requestContextAls, n as prebuiltCaptureAls, o as timingAls, t as earlyHintsSenderAls } from "../_chunks/als-registry-DpygwCp0.js";
|
|
3
|
+
import { c as collectRouteModulepreloads, i as traceTimingEntry, o as collectRouteCss, s as collectRouteFonts } from "../_chunks/dev-span-RsVeYYc_.js";
|
|
4
|
+
import { c as drainWithDeadline, d as isAbortError, f as releaseReason, i as withResponseInit, n as discardResponseBody, o as concatBytes, p as onAbortUntil, r as nodeBodyOps, u as wrapResponseWithStreamTiming } from "../_chunks/node-response-DNNnKnoS.js";
|
|
5
|
+
import { A as runWithTraceId, E as getOtelTraceId, F as isControlFlowSignal, I as isDenySignal, L as isRedirectSignal, M as withSpan, O as getTraceId, T as generateTraceId, _ as logWaitUntilRejected, b as swallow, c as logMiddlewareShortCircuit, d as logRequestCompleted, f as logRequestReceived, g as logSwrRefetchFailed, h as logSlowRequest, i as logCsrfRejected, j as setSpanAttribute, k as replaceTraceId, l as logProxyError, m as logRouteSetupError, n as logCacheMiss, p as logRouteError, s as logMiddlewareError, t as getLogger, u as logRenderError, v as logWaitUntilUnsupported, x as isDebug, y as setLogger } from "../_chunks/logger-DDLtp5e-.js";
|
|
6
|
+
import { _ as getWaitUntil, a as storeOverlayEntry, c as lookupArtifactSeed, d as checkVersionSkew, g as observeKeyDiscipline, i as overlayKey, l as setPrebuiltPayloadSource, n as lookupOverlay, o as hasPrebuiltPayloadSource, r as mayStoreRerender, s as isParamIndependent, u as applyReloadHeaders } from "../_chunks/cache-api-Bo8c7XVF.js";
|
|
4
7
|
import { i as getMetadataRouteServePath, n as classifyMetadataRoute, r as getMetadataRouteAutoLink, t as METADATA_ROUTE_CONVENTIONS } from "../_chunks/metadata-routes-BL26HCDd.js";
|
|
5
8
|
import { i as canonicalize, r as canonicalRequestPath } from "../_chunks/canonicalize-CqK135BN.js";
|
|
6
|
-
import {
|
|
7
|
-
import { n as classifyUrlSegment, r as effectiveUrlSegment } from "../_chunks/segment-classify-Ho8jXWeC.js";
|
|
8
|
-
import { t as computeSegmentTreePaths } from "../_chunks/segment-keys-Y60KNc8C.js";
|
|
9
|
-
import { i as requestContextAls, n as prebuiltCaptureAls, o as timingAls, t as earlyHintsSenderAls } from "../_chunks/als-registry-DpygwCp0.js";
|
|
10
|
-
import { A as runWithTraceId, E as getOtelTraceId, F as isControlFlowSignal, I as isDenySignal, L as isRedirectSignal, M as withSpan, O as getTraceId, T as generateTraceId, _ as logWaitUntilRejected, b as swallow, c as logMiddlewareShortCircuit, d as logRequestCompleted, f as logRequestReceived, g as logSwrRefetchFailed, h as logSlowRequest, i as logCsrfRejected, j as setSpanAttribute, k as replaceTraceId, l as logProxyError, m as logRouteSetupError, n as logCacheMiss, p as logRouteError, s as logMiddlewareError, t as getLogger, u as logRenderError, v as logWaitUntilUnsupported, x as isDebug, y as setLogger } from "../_chunks/logger-YtMSKfft.js";
|
|
11
|
-
import { n as isHttpMethod, t as HTTP_METHODS } from "../_chunks/route-methods-Dk2kZc0n.js";
|
|
12
|
-
import { c as collectRouteModulepreloads, i as traceTimingEntry, o as collectRouteCss, s as collectRouteFonts } from "../_chunks/dev-span-_NzMX-au.js";
|
|
9
|
+
import { n as isRscContentType, r as isRscRequest } from "../_chunks/rsc-media-type-m8jz9u6_.js";
|
|
13
10
|
import { i as isRscCacheKeyShape, n as RSC_KEY_PARAM, r as appVisibleSearch, s as rscCacheKey, t as RSC_KEY_HEADERS } from "../_chunks/rsc-cache-key-D0cb0Gmc.js";
|
|
14
|
-
import { C as setMatchedSegmentPath, E as runOutsideReactCacheScope, S as runWithSegmentParams, T as setSegmentParams, b as markResponseFlushed, f as getCookie, g as getHeader, h as applyRequestHeaderOverlay, i as coerce, m as getSetCookieHeaders, o as DenySignal, s as RedirectSignal, t as executeAction, v as getSearchParams, w as setMutableCookieContext, x as runWithRequestContext, y as getSegmentParams } from "../_chunks/actions-CYjRMpZI.js";
|
|
15
|
-
import { _ as getWaitUntil, a as storeOverlayEntry, c as lookupArtifactSeed, d as checkVersionSkew, g as observeKeyDiscipline, i as overlayKey, l as setPrebuiltPayloadSource, n as lookupOverlay, o as hasPrebuiltPayloadSource, r as mayStoreRerender, s as isParamIndependent, u as applyReloadHeaders } from "../_chunks/cache-api-BZJNt01a.js";
|
|
16
|
-
import { n as createSingleflight } from "../_chunks/singleflight-CzoOVB9Y.js";
|
|
17
11
|
import { t as TIMBER_ERROR_HEADER } from "../_chunks/rsc-error-envelope-D6gNqh52.js";
|
|
12
|
+
import { n as classifyUrlSegment, r as effectiveUrlSegment } from "../_chunks/segment-classify-Ho8jXWeC.js";
|
|
18
13
|
import { n as toBracketKey } from "../_chunks/resolve-schema-B-aCuTu3.js";
|
|
19
14
|
import { n as hasSchemaCodecs, t as getSchemaCodec } from "../_chunks/codec-registry-C8hOGmZo.js";
|
|
20
15
|
import { t as normalizeParamValue } from "../_chunks/param-value-DqlGfF57.js";
|
|
16
|
+
import { n as isHttpMethod, t as HTTP_METHODS } from "../_chunks/route-methods-Dk2kZc0n.js";
|
|
17
|
+
import { i as resolveRenderTimeoutMs, r as RenderTimeoutError, t as DEFAULT_RENDER_TIMEOUT_MS } from "../_chunks/render-timeout-MrrqD1wd.js";
|
|
18
|
+
import { t as computeSegmentTreePaths } from "../_chunks/segment-keys-Y60KNc8C.js";
|
|
19
|
+
import { _ as wasInvalidatedSince, a as devEntryKey, c as getDevSeed, d as isDevPrebuiltStoreActive, f as isHardReload, h as lastInvalidationEpochFor, m as currentInvalidationEpoch, n as clearDevPrebuiltStore, p as setDevSeed, r as devComponentTag, s as discardDevEntry, u as isDevPrebuiltCacheBypassed } from "../_chunks/dev-store-BvdqtHvK.js";
|
|
20
|
+
import { n as createSingleflight } from "../_chunks/singleflight-CzoOVB9Y.js";
|
|
21
21
|
import { createHash } from "node:crypto";
|
|
22
22
|
import { readFile } from "node:fs/promises";
|
|
23
23
|
import { createElement } from "react";
|
|
@@ -4371,7 +4371,7 @@ function noteWrapperRender(innerId, options, props) {
|
|
|
4371
4371
|
}
|
|
4372
4372
|
}
|
|
4373
4373
|
// src/server/flight-source.ts
|
|
4374
|
-
var nodeFlight = typeof process !== "undefined" && process.release?.name === "node" && !(typeof navigator !== "undefined" && navigator.userAgent === "Cloudflare-Workers") ? await import("../_chunks/flight-source-node-
|
|
4374
|
+
var nodeFlight = typeof process !== "undefined" && process.release?.name === "node" && !(typeof navigator !== "undefined" && navigator.userAgent === "Cloudflare-Workers") ? await import("../_chunks/flight-source-node-BO_xD9jC.js") : null;
|
|
4375
4375
|
/** The Node helpers, which a `kind: 'node'` source can only exist alongside. */
|
|
4376
4376
|
function requireNodeFlight() {
|
|
4377
4377
|
if (!nodeFlight) throw new Error("[timber] a Node Flight source reached a runtime without node:stream");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracing.d.ts","sourceRoot":"","sources":["../../src/server/tracing.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI9D,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAIpD;;;;;;;GAOG;AACH,wBAAgB,UAAU,IAAI,MAAM,CASnC;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,MAAM,GAAG,SAAS,CAE9C;AAID;;;GAGG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAE5D;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAKvD;AAiBD;;;GAGG;AACH,wBAAgB,aAAa,IAAI,UAAU,GAAG,SAAS,CAEtD;AAcD;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,OAAO,wBAAwB,EAAE,eAAe,GACvD,OAAO,CAAC,IAAI,CAAC,CAgBf;AAID;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;CACnE;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,cAAc;IAC7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,GAAG,MAAM,GAAG,OAAO,CAAC,EACrD,EAAE,EAAE,MAAM,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAC3B,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAehB;AA2ID;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAC/B,OAAO,CAAC,IAAI,CAAC,CAWf;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GACrD,OAAO,CAAC,IAAI,CAAC,CAKf;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GACrD,IAAI,CAKN;AAED;;;;GAIG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAWlE"}
|
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Isomorphic: no server, client, or build-time imports.
|
|
6
6
|
*/
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* HMR event that carries finished spans to the browser: a
|
|
9
|
+
* `DevSpanPayload[]` of one trace, in the order the spans ended.
|
|
10
|
+
*/
|
|
8
11
|
export declare const DEV_SPAN_EVENT = "timber:span";
|
|
9
12
|
/** HMR event a tab sends to ask for a trace's spans that ended before it connected. */
|
|
10
13
|
export declare const DEV_SPAN_REPLAY_EVENT = "timber:span-replay";
|
|
@@ -39,6 +42,14 @@ export declare const AWAIT_WAIT_ATTRIBUTE = "timber.await_wait";
|
|
|
39
42
|
* otherwise drown the I/O the spans exist to show.
|
|
40
43
|
*/
|
|
41
44
|
export declare const AWAIT_SPAN_MIN_MS = 1;
|
|
45
|
+
/** Span name for one dev-instrumented `fetch()`, ended when headers arrive. */
|
|
46
|
+
export declare const FETCH_SPAN_NAME = "timber.fetch";
|
|
47
|
+
/**
|
|
48
|
+
* Span name for reading a fetched response's body (`.text()`, `.json()`,
|
|
49
|
+
* …), a child of the fetch span. The fetch span ends at headers, so without
|
|
50
|
+
* it a slow body read showed only as the `await res.text()` that waited on it.
|
|
51
|
+
*/
|
|
52
|
+
export declare const FETCH_BODY_SPAN_NAME = "timber.fetch.body";
|
|
42
53
|
/** Root span of every pipeline request. */
|
|
43
54
|
export declare const ROOT_SPAN_NAME = "http.server.request";
|
|
44
55
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-span.d.ts","sourceRoot":"","sources":["../../src/shared/dev-span.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH
|
|
1
|
+
{"version":3,"file":"dev-span.d.ts","sourceRoot":"","sources":["../../src/shared/dev-span.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,eAAO,MAAM,cAAc,gBAAgB,CAAC;AAE5C,uFAAuF;AACvF,eAAO,MAAM,qBAAqB,uBAAuB,CAAC;AAE1D;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,eAAqC,CAAC;AAEpE,0EAA0E;AAC1E,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,eAAiC,CAAC;AAE5D,yDAAyD;AACzD,eAAO,MAAM,eAAe,iBAAiB,CAAC;AAE9C;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,sBAAsB,CAAC;AAExD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC,+EAA+E;AAC/E,eAAO,MAAM,eAAe,iBAAiB,CAAC;AAE9C;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,sBAAsB,CAAC;AAExD,2CAA2C;AAC3C,eAAO,MAAM,cA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,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAID,2EAA2E;AAC3E,KAAK,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAQxD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAiDhG"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A trace's spans as rows to read: the dev request pill's waterfall and the
|
|
3
|
+
* terminal tree.
|
|
4
|
+
*
|
|
5
|
+
* Pure: spans in, rows out. Built to be read, not to mirror the span tree.
|
|
6
|
+
* Waits whose work other rows already show can be hidden, and pass-through
|
|
7
|
+
* wrappers can fold into the row they wrap. One implementation for both
|
|
8
|
+
* surfaces, so the pill and the terminal never disagree about which awaits
|
|
9
|
+
* are noise. See design/50-dev-request-pill.md §"Reading the awaits view".
|
|
10
|
+
*
|
|
11
|
+
* Isomorphic: no server, client, or build-time imports.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* What the rules read from a span. The pill's `DevSpanPayload` and the
|
|
15
|
+
* terminal's projection of an OTEL `ReadableSpan` both satisfy it.
|
|
16
|
+
*/
|
|
17
|
+
export interface WaterfallSpan {
|
|
18
|
+
spanId: string;
|
|
19
|
+
/** Absent, or not among the spans, for a top-level span. */
|
|
20
|
+
parentSpanId?: string;
|
|
21
|
+
name: string;
|
|
22
|
+
startMs: number;
|
|
23
|
+
endMs: number;
|
|
24
|
+
attributes: Readonly<Record<string, unknown>>;
|
|
25
|
+
}
|
|
26
|
+
export interface WaterfallOptions<T extends WaterfallSpan = WaterfallSpan> {
|
|
27
|
+
/** Keep only the I/O, awaits and fetches (the pill's awaits view). */
|
|
28
|
+
ioOnly?: boolean;
|
|
29
|
+
/** Spans to leave out, with their shown children in their place. */
|
|
30
|
+
skip?: (span: T) => boolean;
|
|
31
|
+
/** Leave out waits other spans explain. */
|
|
32
|
+
hideWaits?: boolean;
|
|
33
|
+
/** Fold pass-through awaits into the row they wrap. */
|
|
34
|
+
fold?: boolean;
|
|
35
|
+
/** Rows the user unfolded, by the outer span's ID. */
|
|
36
|
+
expanded?: ReadonlySet<string>;
|
|
37
|
+
}
|
|
38
|
+
export interface WaterfallRow<T extends WaterfallSpan> {
|
|
39
|
+
/** The row's outermost span: its position, depth and location. */
|
|
40
|
+
span: T;
|
|
41
|
+
/** Spans folded into this row, outermost first. Empty when nothing folded. */
|
|
42
|
+
folded: T[];
|
|
43
|
+
/** An explained wait: shown only on request, and dimmed. */
|
|
44
|
+
wait: boolean;
|
|
45
|
+
depth: number;
|
|
46
|
+
/** Milliseconds from the trace's start. */
|
|
47
|
+
offsetMs: number;
|
|
48
|
+
durationMs: number;
|
|
49
|
+
}
|
|
50
|
+
export interface Waterfall<T extends WaterfallSpan> {
|
|
51
|
+
rows: WaterfallRow<T>[];
|
|
52
|
+
/** Explained waits left out of `rows`. */
|
|
53
|
+
hiddenWaits: number;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Await spans that waited on work other spans already show, by ID.
|
|
57
|
+
*
|
|
58
|
+
* A wait (`timber.await_wait`) with no children waited on a promise made
|
|
59
|
+
* elsewhere. When that work is traced (an app function's awaits, a fetch),
|
|
60
|
+
* it runs at the same time outside the wait's own ancestry, so it covers the
|
|
61
|
+
* wait. When it isn't (`const p = pool.query(); … await p`, the driver
|
|
62
|
+
* being in node_modules), nothing covers it, and the wait is the only row
|
|
63
|
+
* that shows the time. Then it counts as work.
|
|
64
|
+
*
|
|
65
|
+
* A wait with children started work after all (a getter that returns a new
|
|
66
|
+
* promise), so it counts as work too.
|
|
67
|
+
*/
|
|
68
|
+
export declare function explainedWaits(spans: readonly WaterfallSpan[]): Set<string>;
|
|
69
|
+
/**
|
|
70
|
+
* Spans in tree order (parent before children, siblings by start). The time
|
|
71
|
+
* axis starts at the trace's first span.
|
|
72
|
+
*
|
|
73
|
+
* - `ioOnly` keeps only awaits and fetches, each nested under its nearest
|
|
74
|
+
* kept ancestor, so hiding framework phases leaves no gaps in the
|
|
75
|
+
* indentation.
|
|
76
|
+
* - `hideWaits` leaves out explained waits, with their children (they have
|
|
77
|
+
* none: a wait with children isn't explained).
|
|
78
|
+
* - `skip` leaves out the spans it matches, like `ioOnly` does.
|
|
79
|
+
* - `fold`: an await whose only shown child takes nearly all its time folds
|
|
80
|
+
* into one row with that child (unless the child is a wait), repeatedly,
|
|
81
|
+
* so `loadShow → def.load → fetch` is one row. So does a framework span
|
|
82
|
+
* into an only child that is an await (`proxy.ts → await next()`), which
|
|
83
|
+
* only arises when framework spans are shown. A fetch folds nothing. A
|
|
84
|
+
* row in `expanded`
|
|
85
|
+
* doesn't fold.
|
|
86
|
+
*/
|
|
87
|
+
export declare function buildWaterfall<T extends WaterfallSpan>(spans: readonly T[], { ioOnly, skip, hideWaits, fold, expanded, }?: WaterfallOptions<T>): Waterfall<T>;
|
|
88
|
+
//# sourceMappingURL=span-waterfall.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"span-waterfall.d.ts","sourceRoot":"","sources":["../../src/shared/span-waterfall.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAwBH;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,4DAA4D;IAC5D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa;IACvE,sEAAsE;IACtE,MAAM,C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
+
"version": "0.2.0-alpha.236",
|
|
4
4
|
"description": "Vite-native React framework built for Servers and Serverless Platforms — correct HTTP semantics, real status codes, pages that work without JavaScript",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare-workers",
|
|
@@ -177,7 +177,7 @@
|
|
|
177
177
|
"react": "19.3.1",
|
|
178
178
|
"react-dom": "19.3.1",
|
|
179
179
|
"satteri": "^0.10.5 || ^0.11.5",
|
|
180
|
-
"vite": "8.3.
|
|
180
|
+
"vite": "8.3.7",
|
|
181
181
|
"vite-plugin-satteri": "^0.3.7",
|
|
182
182
|
"wrangler": "^4.0.0",
|
|
183
183
|
"zod": "^3.22.0 || ^4.0.0"
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Dev request pill — wiring. Feeds the store from three places:
|
|
3
3
|
*
|
|
4
|
-
* - HMR `timber:span` events:
|
|
4
|
+
* - HMR `timber:span` events: finished server spans, batched per trace and
|
|
5
|
+
* event-loop turn as they end, and a trace's buffered spans on replay.
|
|
5
6
|
* - The document's navigation timing entry, whose `serverTiming` carries the
|
|
6
7
|
* page's trace ID (the one response header page JS can read for the
|
|
7
8
|
* document itself).
|
|
@@ -89,7 +90,9 @@ export function setupDevPill(hot: Hot, options: { slowMs: number }): void {
|
|
|
89
90
|
};
|
|
90
91
|
hot.on('vite:ws:connect', () => claimed.forEach(requestReplay));
|
|
91
92
|
|
|
92
|
-
hot.on(DEV_SPAN_EVENT, (data) =>
|
|
93
|
+
hot.on(DEV_SPAN_EVENT, (data) => {
|
|
94
|
+
for (const span of data as DevSpanPayload[]) store.addSpan(span);
|
|
95
|
+
});
|
|
93
96
|
|
|
94
97
|
const nav = performance.getEntriesByType('navigation')[0] as
|
|
95
98
|
| PerformanceNavigationTiming
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { ROOT_SPAN_NAME, type DevSpanPayload } from '../../shared/dev-span.ts';
|
|
10
10
|
import { RSC_KEY_PARAM } from '../../shared/rsc-cache-key.ts';
|
|
11
|
-
import { explainedWaits } from '
|
|
11
|
+
import { explainedWaits } from '../../shared/span-waterfall.ts';
|
|
12
12
|
|
|
13
13
|
export type DevRequestKind = 'document' | 'navigation' | 'action' | 'fetch';
|
|
14
14
|
|
|
@@ -7,12 +7,17 @@
|
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
AWAIT_SPAN_NAME,
|
|
10
|
+
FETCH_BODY_SPAN_NAME,
|
|
10
11
|
devSpanLabel,
|
|
11
12
|
ROOT_SPAN_NAME,
|
|
12
13
|
type DevSpanPayload,
|
|
13
14
|
} from '../../shared/dev-span.ts';
|
|
14
15
|
import type { DevPillStore, DevRequest } from './store.ts';
|
|
15
|
-
import { buildWaterfall, type WaterfallRow
|
|
16
|
+
import { buildWaterfall, type WaterfallRow } from '../../shared/span-waterfall.ts';
|
|
17
|
+
|
|
18
|
+
/** Every span, or only the I/O: awaits and fetches. */
|
|
19
|
+
type WaterfallView = 'all' | 'awaits';
|
|
20
|
+
type Row = WaterfallRow<DevSpanPayload>;
|
|
16
21
|
|
|
17
22
|
/** localStorage keys for per-browser choices, per dev origin. */
|
|
18
23
|
const MINIMIZED_KEY = 'timber:dev-pill:minimized';
|
|
@@ -209,7 +214,7 @@ function shortLocation(location: string): string {
|
|
|
209
214
|
}
|
|
210
215
|
|
|
211
216
|
/** Hover text: every span in the row, with its full location. */
|
|
212
|
-
function rowTitle(row:
|
|
217
|
+
function rowTitle(row: Row): string {
|
|
213
218
|
return [row.span, ...row.folded]
|
|
214
219
|
.map((span) => {
|
|
215
220
|
const where = span.attributes['timber.await_location'];
|
|
@@ -333,7 +338,11 @@ export function mountDevPill(store: DevPillStore): void {
|
|
|
333
338
|
|
|
334
339
|
const rows = el('div', 'rows');
|
|
335
340
|
const spans = store.spans(selected.traceId);
|
|
336
|
-
|
|
341
|
+
// Hiding and folding are the awaits view's; All shows every span as is.
|
|
342
|
+
const { rows: waterfall, hiddenWaits } = buildWaterfall(
|
|
343
|
+
spans,
|
|
344
|
+
view === 'awaits' ? { ioOnly: true, hideWaits: !showWaits, fold: true, expanded } : {}
|
|
345
|
+
);
|
|
337
346
|
if (waterfall.length === 0) {
|
|
338
347
|
const nothing =
|
|
339
348
|
view === 'awaits' && spans.length > 0
|
|
@@ -364,7 +373,7 @@ export function mountDevPill(store: DevPillStore): void {
|
|
|
364
373
|
return panel;
|
|
365
374
|
};
|
|
366
375
|
|
|
367
|
-
const renderRow = (row:
|
|
376
|
+
const renderRow = (row: Row, total: number): HTMLElement => {
|
|
368
377
|
const line = el('div', 'row');
|
|
369
378
|
line.title = rowTitle(row);
|
|
370
379
|
if (row.wait) line.classList.add('wait');
|
|
@@ -401,7 +410,8 @@ export function mountDevPill(store: DevPillStore): void {
|
|
|
401
410
|
|
|
402
411
|
const track = el('div', 'track');
|
|
403
412
|
const bar = el('div', 'bar');
|
|
404
|
-
if (named.name === 'timber.fetch'
|
|
413
|
+
if (named.name === 'timber.fetch' || named.name === FETCH_BODY_SPAN_NAME)
|
|
414
|
+
bar.classList.add('fetch');
|
|
405
415
|
else if (row.span.name === AWAIT_SPAN_NAME) bar.classList.add(row.wait ? 'wait' : 'await');
|
|
406
416
|
if ([row.span, ...row.folded].some((s) => s.error)) bar.classList.add('error');
|
|
407
417
|
// The request's own row spans everything; judge it by name, not
|
|
@@ -52,6 +52,16 @@ function noteWait(value: unknown, startsNoWork: boolean): void {
|
|
|
52
52
|
awaited.add(value);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Record a promise whose work another span already shows, so an await of it
|
|
57
|
+
* is a wait. The dev fetch patch calls this for a body read
|
|
58
|
+
* (`res.text()`): the read is drawn as a `timber.fetch.body` span under
|
|
59
|
+
* the fetch, and `await res.text()` would draw the same time again.
|
|
60
|
+
*/
|
|
61
|
+
export function noteTracedWork(promise: Promise<unknown>): void {
|
|
62
|
+
awaited.add(promise);
|
|
63
|
+
}
|
|
64
|
+
|
|
55
65
|
/**
|
|
56
66
|
* Install the wrapper on `globalThis[DEV_AWAIT_KEY]`. Transformed modules
|
|
57
67
|
* look it up per call, so a module evaluated before this ran still gets
|