@timber-js/app 0.2.0-alpha.165 → 0.2.0-alpha.166
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-CSDD6x7U.js → actions-CDPfMp_I.js} +3 -3
- package/dist/_chunks/{actions-CSDD6x7U.js.map → actions-CDPfMp_I.js.map} +1 -1
- package/dist/_chunks/{cache-api-eb1gydM7.js → cache-api-DygSeKCB.js} +2 -2
- package/dist/_chunks/{cache-api-eb1gydM7.js.map → cache-api-DygSeKCB.js.map} +1 -1
- package/dist/_chunks/{cli-schema-sync-mGfRbjh2.js → cli-schema-sync-EXGYPhI2.js} +3 -3
- package/dist/_chunks/{cli-schema-sync-mGfRbjh2.js.map → cli-schema-sync-EXGYPhI2.js.map} +1 -1
- package/dist/_chunks/{define-CFmvb4Bt.js → define-COtkxMRT.js} +16 -28
- package/dist/_chunks/define-COtkxMRT.js.map +1 -0
- package/dist/_chunks/{define-Bssfp6ot.js → define-c4au4I9R.js} +2 -2
- package/dist/_chunks/{define-Bssfp6ot.js.map → define-c4au4I9R.js.map} +1 -1
- package/dist/_chunks/{logger-B_O6-mdJ.js → logger-t3uxAmbX.js} +3 -3
- package/dist/_chunks/{logger-B_O6-mdJ.js.map → logger-t3uxAmbX.js.map} +1 -1
- package/dist/_chunks/{plugin-context-BnaiU_cF.js → plugin-context---kTF5v8.js} +2 -2
- package/dist/_chunks/{plugin-context-BnaiU_cF.js.map → plugin-context---kTF5v8.js.map} +1 -1
- package/dist/_chunks/{resolve-schema-3iUvBV5T.js → resolve-schema-Dz3fcFUo.js} +2 -2
- package/dist/_chunks/{resolve-schema-3iUvBV5T.js.map → resolve-schema-Dz3fcFUo.js.map} +1 -1
- package/dist/_chunks/{schema-bridge-BY3QLBL7.js → schema-bridge-DT_Tn0Xf.js} +2 -2
- package/dist/_chunks/{schema-bridge-BY3QLBL7.js.map → schema-bridge-DT_Tn0Xf.js.map} +1 -1
- package/dist/_chunks/{use-query-states-CbeQmext.js → use-query-states-DFvWd-EA.js} +65 -7
- package/dist/_chunks/use-query-states-DFvWd-EA.js.map +1 -0
- package/dist/_chunks/{walkers-BL3MCMgO.js → walkers-DBVzXuWc.js} +3 -3
- package/dist/_chunks/{walkers-BL3MCMgO.js.map → walkers-DBVzXuWc.js.map} +1 -1
- package/dist/adapters/nitro.js +1 -1
- package/dist/cache/index.js +1 -1
- package/dist/cli.js +2 -2
- package/dist/client/internal.js +1 -1
- package/dist/client/use-query-states.d.ts.map +1 -1
- package/dist/codec.js +1 -1
- package/dist/cookies/index.js +1 -1
- package/dist/dev-tools/logs.d.ts +15 -1
- package/dist/dev-tools/logs.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +104 -20
- package/dist/index.js.map +1 -1
- package/dist/params/index.js +1 -1
- package/dist/routing/index.js +2 -2
- package/dist/schema-bridge.d.ts.map +1 -1
- package/dist/search-params/define.d.ts +35 -4
- package/dist/search-params/define.d.ts.map +1 -1
- package/dist/search-params/index.js +3 -7
- package/dist/search-params/index.js.map +1 -1
- package/dist/search-params/wrappers.d.ts +2 -2
- package/dist/search-params/wrappers.d.ts.map +1 -1
- package/dist/segment-params/index.js +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/internal.js +8 -6
- package/dist/server/internal.js.map +1 -1
- package/dist/server/stream-utils.d.ts.map +1 -1
- package/docs/api/33-api-search-params.mdx +13 -0
- package/docs/learn/00-introduction.mdx +1 -2
- package/package.json +8 -7
- package/src/cli.ts +0 -0
- package/src/client/use-query-states.ts +99 -7
- package/src/dev-tools/logs.ts +119 -34
- package/src/index.ts +14 -1
- package/src/schema-bridge.ts +4 -3
- package/src/search-params/define.ts +57 -51
- package/src/search-params/wrappers.ts +17 -26
- package/src/server/stream-utils.ts +8 -6
- package/LICENSE +0 -8
- package/dist/_chunks/define-CFmvb4Bt.js.map +0 -1
- package/dist/_chunks/use-query-states-CbeQmext.js.map +0 -1
package/dist/params/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as toBracketKey, t as resolveSchemaCodecs } from "../_chunks/resolve-schema-
|
|
1
|
+
import { n as toBracketKey, t as resolveSchemaCodecs } from "../_chunks/resolve-schema-Dz3fcFUo.js";
|
|
2
2
|
import { n as setLinkCodecs, t as getLinkCodec } from "../_chunks/codec-registry-oOUxugz3.js";
|
|
3
3
|
//#region src/params/define-schema.ts
|
|
4
4
|
/**
|
package/dist/routing/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { i as INTERCEPTION_MARKERS, n as classifyUrlSegment, r as DEFAULT_PAGE_EXTENSIONS, t as classifySegment } from "../_chunks/segment-classify-CDDRVKs7.js";
|
|
2
|
-
import { i as scanRoutes } from "../_chunks/cli-schema-sync-
|
|
3
|
-
import { a as generateRouteMap, i as validateSchemaAgainstRoutes, n as collectInterceptionRewrites, r as collectDynamicSegmentsFromTree, t as collectLeafRoutes } from "../_chunks/walkers-
|
|
2
|
+
import { i as scanRoutes } from "../_chunks/cli-schema-sync-EXGYPhI2.js";
|
|
3
|
+
import { a as generateRouteMap, i as validateSchemaAgainstRoutes, n as collectInterceptionRewrites, r as collectDynamicSegmentsFromTree, t as collectLeafRoutes } from "../_chunks/walkers-DBVzXuWc.js";
|
|
4
4
|
export { DEFAULT_PAGE_EXTENSIONS, INTERCEPTION_MARKERS, classifySegment, classifyUrlSegment, collectDynamicSegmentsFromTree, collectInterceptionRewrites, collectLeafRoutes, generateRouteMap, scanRoutes, validateSchemaAgainstRoutes };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-bridge.d.ts","sourceRoot":"","sources":["../src/schema-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAUxC,4DAA4D;AAC5D,MAAM,WAAW,gBAAgB,CAAC,MAAM,GAAG,OAAO;IAChD,WAAW,EAAE;Q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GAAE,OAAO,GAAG,QAAmB,GAClC,KAAK,CAAC,OAAO,CAAC,CAYhB;AAMD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAmCnE;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAmCxE"}
|
|
@@ -111,8 +111,37 @@ export interface SearchParamsDefinition<T extends Record<string, unknown>> {
|
|
|
111
111
|
readonly _type?: T;
|
|
112
112
|
}
|
|
113
113
|
export type { StandardSchemaV1 } from '../schema-bridge.js';
|
|
114
|
-
/**
|
|
115
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Extract a Standard Schema's declared *input* type from its optional
|
|
116
|
+
* `~standard.types` property (part of the Standard Schema spec; Zod, Valibot,
|
|
117
|
+
* and ArkType all declare it at the type level). Falls back to `never` when
|
|
118
|
+
* the schema doesn't declare types (e.g. hand-written schemas): with no
|
|
119
|
+
* metadata we can't know whether the schema handles `undefined`, so InferField
|
|
120
|
+
* widens conservatively rather than risk a type lie.
|
|
121
|
+
*/
|
|
122
|
+
type InferSchemaInput<V> = V extends {
|
|
123
|
+
'~standard': {
|
|
124
|
+
types?: infer TS;
|
|
125
|
+
};
|
|
126
|
+
} ? [NonNullable<TS>] extends [{
|
|
127
|
+
input: infer I;
|
|
128
|
+
}] ? I : never : never;
|
|
129
|
+
/**
|
|
130
|
+
* Infer the output type from either a SearchParamCodec or a StandardSchemaV1.
|
|
131
|
+
*
|
|
132
|
+
* Schemas whose input type rejects `undefined` (e.g. bare `z.string()`, whose
|
|
133
|
+
* input is `string`) are implicitly optional: the URL might not contain the
|
|
134
|
+
* param, and fromSchema returns `undefined` when the schema rejects absent
|
|
135
|
+
* input and has no default. The output type widens to `T | undefined` so the
|
|
136
|
+
* type doesn't lie. Schemas that accept `undefined` input (`.optional()`,
|
|
137
|
+
* `.default()`) keep their declared output type.
|
|
138
|
+
*
|
|
139
|
+
* Limitation: `z.coerce.*` schemas declare input `unknown`, which accepts
|
|
140
|
+
* `undefined` at the type level — so a coerce schema without `.default()`
|
|
141
|
+
* keeps its narrow output type even though absent input yields `undefined`
|
|
142
|
+
* at runtime. Add `.default()` to coerce schemas for accurate types.
|
|
143
|
+
*/
|
|
144
|
+
export type InferField<V> = V extends SearchParamCodec<infer T> ? T : V extends StandardSchemaV1<infer T> ? undefined extends InferSchemaInput<V> ? T : T | undefined : never;
|
|
116
145
|
/** Acceptable field value for defineSearchParams: a codec or a Standard Schema. */
|
|
117
146
|
export type SearchParamField<T = unknown> = SearchParamCodec<T> | StandardSchemaV1<T>;
|
|
118
147
|
/**
|
|
@@ -145,9 +174,11 @@ export type SearchParamField<T = unknown> = SearchParamCodec<T> | StandardSchema
|
|
|
145
174
|
* )
|
|
146
175
|
* ```
|
|
147
176
|
*/
|
|
148
|
-
export declare function defineSearchParams<
|
|
177
|
+
export declare function defineSearchParams<S extends StandardSchemaV1<Record<string, unknown>> & {
|
|
149
178
|
shape: Record<string, StandardSchemaV1<unknown>>;
|
|
150
|
-
}): SearchParamsDefinition<
|
|
179
|
+
}>(schema: S): SearchParamsDefinition<{
|
|
180
|
+
[K in keyof S['shape'] & string]: InferField<S['shape'][K]>;
|
|
181
|
+
}>;
|
|
151
182
|
/**
|
|
152
183
|
* Overload: accept a map of codecs and/or Standard Schema objects.
|
|
153
184
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../../src/search-params/define.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAYzC;;;;GAIG;AACH,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B,CAAC;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC,CAAC"}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { n as registerSearchParams, t as getSearchParamsDefinition } from "../_chunks/registry-DbJPKoBp.js";
|
|
2
|
-
import { i as isStandardSchema, n as fromSchema,
|
|
3
|
-
import { n as defineSearchParams } from "../_chunks/define-
|
|
2
|
+
import { i as isStandardSchema, n as fromSchema, r as isCodec } from "../_chunks/schema-bridge-DT_Tn0Xf.js";
|
|
3
|
+
import { n as defineSearchParams } from "../_chunks/define-COtkxMRT.js";
|
|
4
4
|
//#region src/search-params/wrappers.ts
|
|
5
|
-
function validateSchemaAbsentParam(schema, fieldHint) {
|
|
6
|
-
if (validateSync(schema, void 0).issues) throw new Error(`[timber] withUrlKey: schema for '${fieldHint}' has no default value and rejects undefined input.\n Search params are optional — the URL might not contain ?${fieldHint}=anything.\n Add .default() to your schema or use .optional().`);
|
|
7
|
-
return fromSchema(schema);
|
|
8
|
-
}
|
|
9
5
|
/**
|
|
10
6
|
* Wrap a nullable codec with a default value. When the inner codec returns
|
|
11
7
|
* null, the default is used instead. The output type becomes non-nullable.
|
|
@@ -58,7 +54,7 @@ function withDefault(codec, defaultValue) {
|
|
|
58
54
|
* ```
|
|
59
55
|
*/
|
|
60
56
|
function withUrlKey(codecOrSchema, urlKey) {
|
|
61
|
-
const codec = isCodec(codecOrSchema) ? codecOrSchema : isStandardSchema(codecOrSchema) ?
|
|
57
|
+
const codec = isCodec(codecOrSchema) ? codecOrSchema : isStandardSchema(codecOrSchema) ? fromSchema(codecOrSchema) : codecOrSchema;
|
|
62
58
|
return {
|
|
63
59
|
parse: codec.parse.bind(codec),
|
|
64
60
|
serialize: codec.serialize.bind(codec),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/search-params/wrappers.ts"],"sourcesContent":["/**\n * Codec wrappers — withDefault and withUrlKey.\n *\n * These are timber-specific utilities that work with any SearchParamCodec.\n * For actual codecs (string, integer, boolean, etc.), use nuqs parsers\n * or Standard Schema objects (Zod, Valibot, ArkType) with auto-detection.\n *\n * Design doc: design/23-search-params.md\n */\n\nimport type {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/search-params/wrappers.ts"],"sourcesContent":["/**\n * Codec wrappers — withDefault and withUrlKey.\n *\n * These are timber-specific utilities that work with any SearchParamCodec.\n * For actual codecs (string, integer, boolean, etc.), use nuqs parsers\n * or Standard Schema objects (Zod, Valibot, ArkType) with auto-detection.\n *\n * Design doc: design/23-search-params.md\n */\n\nimport type {\n InferField,\n SearchParamCodec,\n SearchParamCodecWithUrlKey,\n SearchParamField,\n} from './define.js';\nimport { isCodec, isStandardSchema, fromSchema } from '../schema-bridge.js';\n\n// ---------------------------------------------------------------------------\n// withDefault\n// ---------------------------------------------------------------------------\n\n/**\n * Wrap a nullable codec with a default value. When the inner codec returns\n * null, the default is used instead. The output type becomes non-nullable.\n *\n * Works with any codec — nuqs parsers, custom codecs, fromSchema results.\n *\n * ```ts\n * import { parseAsInteger } from 'nuqs'\n * import { withDefault } from '@timber-js/app/search-params'\n *\n * const page = withDefault(parseAsInteger, 1)\n * // page.parse(undefined) → 1 (not null)\n * // page.parse('5') → 5\n * ```\n */\nexport function withDefault<T>(\n codec: SearchParamCodec<T | null>,\n defaultValue: T\n): SearchParamCodec<T> {\n return {\n parse(value: string | string[] | undefined): T {\n const result = codec.parse(value);\n return result === null ? defaultValue : result;\n },\n serialize(value: T): string | null {\n return codec.serialize(value);\n },\n };\n}\n\n// ---------------------------------------------------------------------------\n// withUrlKey\n// ---------------------------------------------------------------------------\n\n/**\n * Attach a URL key alias to a codec. The alias determines what query\n * parameter key is used in the URL, while the TypeScript property name\n * stays descriptive.\n *\n * Aliases travel with codecs through object spread composition — when\n * you spread a bundle containing aliased codecs into defineSearchParams,\n * the aliases come along automatically.\n *\n * ```ts\n * import { parseAsString } from 'nuqs'\n * import { withUrlKey } from '@timber-js/app/search-params'\n *\n * export const searchable = {\n * q: withUrlKey(parseAsString, 'search'),\n * // ?search=shoes → { q: 'shoes' }\n * }\n * ```\n *\n * Composes with withDefault:\n * ```ts\n * import { parseAsInteger } from 'nuqs'\n * withUrlKey(withDefault(parseAsInteger, 1), 'p')\n * ```\n */\nexport function withUrlKey<F extends SearchParamField>(\n codecOrSchema: F,\n urlKey: string\n): SearchParamCodecWithUrlKey<InferField<F>> {\n type T = InferField<F>;\n // Auto-detect Standard Schema (Zod, Valibot, ArkType) and wrap. Schemas\n // that reject undefined input are implicitly optional — fromSchema returns\n // undefined for absent params, and InferField widens the type to include\n // undefined. design/23-search-params.md §\"Implicit Optionality\"\n const codec: SearchParamCodec<T> = isCodec(codecOrSchema)\n ? (codecOrSchema as SearchParamCodec<T>)\n : isStandardSchema(codecOrSchema)\n ? (fromSchema(codecOrSchema) as SearchParamCodec<T>)\n : (codecOrSchema as SearchParamCodec<T>);\n return {\n parse: codec.parse.bind(codec),\n serialize: codec.serialize.bind(codec),\n urlKey,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqCA,SAAgB,YACd,OACA,cACqB;CACrB,OAAO;EACL,MAAM,OAAyC;GAC7C,MAAM,SAAS,MAAM,MAAM,KAAK;GAChC,OAAO,WAAW,OAAO,eAAe;EAC1C;EACA,UAAU,OAAyB;GACjC,OAAO,MAAM,UAAU,KAAK;EAC9B;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,SAAgB,WACd,eACA,QAC2C;CAM3C,MAAM,QAA6B,QAAQ,aAAa,IACnD,gBACD,iBAAiB,aAAa,IAC3B,WAAW,aAAa,IACxB;CACP,OAAO;EACL,OAAO,MAAM,MAAM,KAAK,KAAK;EAC7B,WAAW,MAAM,UAAU,KAAK,KAAK;EACrC;CACF;AACF"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Design doc: design/23-search-params.md
|
|
9
9
|
*/
|
|
10
|
-
import type { SearchParamCodec, SearchParamCodecWithUrlKey, SearchParamField } from './define.js';
|
|
10
|
+
import type { InferField, SearchParamCodec, SearchParamCodecWithUrlKey, SearchParamField } from './define.js';
|
|
11
11
|
/**
|
|
12
12
|
* Wrap a nullable codec with a default value. When the inner codec returns
|
|
13
13
|
* null, the default is used instead. The output type becomes non-nullable.
|
|
@@ -49,5 +49,5 @@ export declare function withDefault<T>(codec: SearchParamCodec<T | null>, defaul
|
|
|
49
49
|
* withUrlKey(withDefault(parseAsInteger, 1), 'p')
|
|
50
50
|
* ```
|
|
51
51
|
*/
|
|
52
|
-
export declare function withUrlKey<
|
|
52
|
+
export declare function withUrlKey<F extends SearchParamField>(codecOrSchema: F, urlKey: string): SearchParamCodecWithUrlKey<InferField<F>>;
|
|
53
53
|
//# sourceMappingURL=wrappers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrappers.d.ts","sourceRoot":"","sources":["../../src/search-params/wrappers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"wrappers.d.ts","sourceRoot":"","sources":["../../src/search-params/wrappers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,0BAA0B,EAC1B,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAOrB;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,KAAK,EAAE,gBAAgB,CAAC,CAAC,GAAG,IAAI,CAAC,EACjC,YAAY,EAAE,CAAC,GACd,gBAAgB,CAAC,CAAC,CAAC,CAUrB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,gBAAgB,EACnD,aAAa,EAAE,CAAC,EAChB,MAAM,EAAE,MAAM,GACb,0BAA0B,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAgB3C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as defineSegmentParams } from "../_chunks/define-
|
|
1
|
+
import { n as defineSegmentParams } from "../_chunks/define-c4au4I9R.js";
|
|
2
2
|
export { defineSegmentParams };
|
package/dist/server/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as addSpanEvent, C as RedirectType, E as getHeaders, F as getCookieJar, G as getTraceId, O as getSegmentParams, R as isDebug, S as waitUntil, W as getSpanId, Y as withSpan, Z as formFlashAls, _ as RedirectSignal, b as redirect, g as DenySignal, x as redirectExternal, y as deny, z as isDevMode } from "../_chunks/logger-
|
|
1
|
+
import { B as addSpanEvent, C as RedirectType, E as getHeaders, F as getCookieJar, G as getTraceId, O as getSegmentParams, R as isDebug, S as waitUntil, W as getSpanId, Y as withSpan, Z as formFlashAls, _ as RedirectSignal, b as redirect, g as DenySignal, x as redirectExternal, y as deny, z as isDevMode } from "../_chunks/logger-t3uxAmbX.js";
|
|
2
2
|
import { t as formatSize } from "../_chunks/format-CfwjgPz9.js";
|
|
3
|
-
import { a as parseFormData, i as coerce, n as revalidatePath, r as revalidateTag } from "../_chunks/actions-
|
|
3
|
+
import { a as parseFormData, i as coerce, n as revalidatePath, r as revalidateTag } from "../_chunks/actions-CDPfMp_I.js";
|
|
4
4
|
//#region src/server/sensitive-fields.ts
|
|
5
5
|
/**
|
|
6
6
|
* Sensitive field stripping — removes password/token/CVV-style fields
|
package/dist/server/internal.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { a as classifyMetadataRoute, i as METADATA_ROUTE_CONVENTIONS, o as getMetadataRouteAutoLink, r as canonicalize, s as getMetadataRouteServePath } from "../_chunks/canonicalize-P41GR6tY.js";
|
|
2
2
|
import { n as classifyUrlSegment } from "../_chunks/segment-classify-CDDRVKs7.js";
|
|
3
|
-
import { A as runWithRequestContext, D as getSearchParams, G as getTraceId, H as generateTraceId, I as getSetCookieHeaders, J as setSpanAttribute, K as replaceTraceId, L as getWaitUntil, M as setMutableCookieContext, N as setSegmentParams, O as getSegmentParams, P as getCookie, Q as requestContextAls, R as isDebug, T as getHeader, U as getOtelTraceId, X as earlyHintsSenderAls, Y as withSpan, _ as RedirectSignal, a as logProxyError, c as logRequestReceived, d as logSwrRefetchFailed, et as timingAls, f as logWaitUntilRejected, g as DenySignal, h as swallow, i as logMiddlewareShortCircuit, j as setMatchedSegmentPath, k as markResponseFlushed, l as logRouteError, m as setLogger, n as logCacheMiss, o as logRenderError, p as logWaitUntilUnsupported, q as runWithTraceId, r as logMiddlewareError, s as logRequestCompleted, t as getLogger, u as logSlowRequest, v as RenderError, w as applyRequestHeaderOverlay } from "../_chunks/logger-
|
|
4
|
-
import { i as coerce, t as executeAction } from "../_chunks/actions-
|
|
5
|
-
import { a as getManifestEntry, b as wasInvalidatedSince, c as lookupPrebuiltPayload, d as checkVersionSkew, i as storeOverlayEntry, l as setPrebuiltPayloadSource, n as lookupOverlay, o as hasPrebuiltPayloadSource, r as overlayKey, s as isParamIndependent, u as applyReloadHeaders, v as currentInvalidationEpoch, x as createSingleflight, y as lastInvalidationEpochFor } from "../_chunks/cache-api-
|
|
3
|
+
import { A as runWithRequestContext, D as getSearchParams, G as getTraceId, H as generateTraceId, I as getSetCookieHeaders, J as setSpanAttribute, K as replaceTraceId, L as getWaitUntil, M as setMutableCookieContext, N as setSegmentParams, O as getSegmentParams, P as getCookie, Q as requestContextAls, R as isDebug, T as getHeader, U as getOtelTraceId, X as earlyHintsSenderAls, Y as withSpan, _ as RedirectSignal, a as logProxyError, c as logRequestReceived, d as logSwrRefetchFailed, et as timingAls, f as logWaitUntilRejected, g as DenySignal, h as swallow, i as logMiddlewareShortCircuit, j as setMatchedSegmentPath, k as markResponseFlushed, l as logRouteError, m as setLogger, n as logCacheMiss, o as logRenderError, p as logWaitUntilUnsupported, q as runWithTraceId, r as logMiddlewareError, s as logRequestCompleted, t as getLogger, u as logSlowRequest, v as RenderError, w as applyRequestHeaderOverlay } from "../_chunks/logger-t3uxAmbX.js";
|
|
4
|
+
import { i as coerce, t as executeAction } from "../_chunks/actions-CDPfMp_I.js";
|
|
5
|
+
import { a as getManifestEntry, b as wasInvalidatedSince, c as lookupPrebuiltPayload, d as checkVersionSkew, i as storeOverlayEntry, l as setPrebuiltPayloadSource, n as lookupOverlay, o as hasPrebuiltPayloadSource, r as overlayKey, s as isParamIndependent, u as applyReloadHeaders, v as currentInvalidationEpoch, x as createSingleflight, y as lastInvalidationEpochFor } from "../_chunks/cache-api-DygSeKCB.js";
|
|
6
6
|
import "../client/error-boundary.js";
|
|
7
|
-
import { n as toBracketKey } from "../_chunks/resolve-schema-
|
|
7
|
+
import { n as toBracketKey } from "../_chunks/resolve-schema-Dz3fcFUo.js";
|
|
8
8
|
import "../_chunks/segment-context-ZDnXDkbz.js";
|
|
9
9
|
import { readFile } from "node:fs/promises";
|
|
10
10
|
import { createHash } from "node:crypto";
|
|
@@ -105,8 +105,10 @@ function wrapResponseWithStreamTiming(body, startTime) {
|
|
|
105
105
|
let bytes = 0;
|
|
106
106
|
let cancelled = false;
|
|
107
107
|
function emitLog() {
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
if (process.env.NODE_ENV !== "production") {
|
|
109
|
+
const closeMs = Math.round(performance.now() - startTime);
|
|
110
|
+
console.debug(`[timber] stream-lifecycle: firstChunk=${firstChunkMs}ms lastChunk=${lastChunkMs}ms close=${closeMs}ms maxGap=${maxGapMs}ms chunks=${chunks} bytes=${bytes}` + (cancelled ? " cancelled=true" : ""));
|
|
111
|
+
}
|
|
110
112
|
}
|
|
111
113
|
const reader = body.getReader();
|
|
112
114
|
return new ReadableStream({
|