@timber-js/app 0.2.0-alpha.230 → 0.2.0-alpha.232
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/agent-skill.md +13 -0
- package/dist/_chunks/{actions-DHum77eH.js → actions-CYjRMpZI.js} +3 -2
- package/dist/_chunks/{actions-DHum77eH.js.map → actions-CYjRMpZI.js.map} +1 -1
- package/dist/_chunks/{cli-check-B-JZkpBD.js → cli-check-BAKOSTkg.js} +2 -2
- package/dist/_chunks/{cli-check-B-JZkpBD.js.map → cli-check-BAKOSTkg.js.map} +1 -1
- package/dist/_chunks/codec-registry-C8hOGmZo.js +13 -0
- package/dist/_chunks/codec-registry-C8hOGmZo.js.map +1 -0
- package/dist/_chunks/{codegen-B9oWkWGf.js → codegen-vaCyFyVN.js} +67 -17
- package/dist/_chunks/codegen-vaCyFyVN.js.map +1 -0
- package/dist/_chunks/{convention-lint-CrDKERHg.js → convention-lint-D54k6uUM.js} +2 -2
- package/dist/_chunks/{convention-lint-CrDKERHg.js.map → convention-lint-D54k6uUM.js.map} +1 -1
- package/dist/_chunks/href-BtspoNc9.js +164 -0
- package/dist/_chunks/href-BtspoNc9.js.map +1 -0
- package/dist/_chunks/href-validation-DNg-zV7u.js +102 -0
- package/dist/_chunks/href-validation-DNg-zV7u.js.map +1 -0
- package/dist/_chunks/merge-search-params-7o_5yX0L.js +111 -0
- package/dist/_chunks/merge-search-params-7o_5yX0L.js.map +1 -0
- package/dist/_chunks/{use-query-states-pkDV-jSg.js → use-query-states-D3MMl-KM.js} +12 -12
- package/dist/_chunks/use-query-states-D3MMl-KM.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +4 -122
- package/dist/client/index.js.map +1 -1
- package/dist/client/internal.js +1 -1
- package/dist/client/link.d.ts +4 -25
- package/dist/client/link.d.ts.map +1 -1
- package/dist/client/nuqs-adapter.d.ts.map +1 -1
- package/dist/client/use-query-states.d.ts +1 -1
- package/dist/client/use-query-states.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +57 -1
- package/dist/index.js.map +1 -1
- package/dist/params/codec-registry.d.ts +21 -11
- package/dist/params/codec-registry.d.ts.map +1 -1
- package/dist/params/index.d.ts +0 -1
- package/dist/params/index.d.ts.map +1 -1
- package/dist/params/index.js +1 -2
- package/dist/params/index.js.map +1 -1
- package/dist/plugins/node-flight-builds.d.ts +38 -0
- package/dist/plugins/node-flight-builds.d.ts.map +1 -0
- package/dist/plugins/shims.d.ts.map +1 -1
- package/dist/routes/href.d.ts +124 -0
- package/dist/routes/href.d.ts.map +1 -0
- package/dist/routes/index.d.ts +4 -0
- package/dist/routes/index.d.ts.map +1 -0
- package/dist/routes/index.js +8 -0
- package/dist/routes/index.js.map +1 -0
- package/dist/routing/codegen.d.ts.map +1 -1
- package/dist/routing/index.js +1 -1
- package/dist/routing/link-codegen.d.ts +39 -8
- package/dist/routing/link-codegen.d.ts.map +1 -1
- package/dist/search-params/define.d.ts +37 -17
- package/dist/search-params/define.d.ts.map +1 -1
- package/dist/search-params/index.d.ts +1 -0
- package/dist/search-params/index.d.ts.map +1 -1
- package/dist/search-params/index.js +3 -2
- package/dist/search-params/index.js.map +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/internal.js +4 -6
- package/dist/server/internal.js.map +1 -1
- package/dist/server/param-coercion.d.ts +0 -7
- package/dist/server/param-coercion.d.ts.map +1 -1
- package/dist/server/rsc-entry/index.d.ts.map +1 -1
- package/dist/shared/href.d.ts +88 -0
- package/dist/shared/href.d.ts.map +1 -0
- package/docs/api/31-api-client.mdx +1 -1
- package/docs/api/35-api-typescript.mdx +47 -15
- package/docs/learn/06-typed-params.mdx +33 -0
- package/docs/learn/07-typed-routes.mdx +75 -10
- package/package.json +6 -2
- package/src/client/browser-entry/index.ts +4 -4
- package/src/client/index.ts +3 -1
- package/src/client/link.tsx +5 -238
- package/src/client/nuqs-adapter.tsx +45 -2
- package/src/client/use-query-states.ts +27 -23
- package/src/index.ts +5 -0
- package/src/params/codec-registry.ts +24 -11
- package/src/params/index.ts +0 -1
- package/src/plugins/node-flight-builds.ts +94 -0
- package/src/plugins/shims.ts +10 -0
- package/src/routes/href.ts +171 -0
- package/src/routes/index.ts +10 -0
- package/src/routing/codegen.ts +8 -1
- package/src/routing/link-codegen.ts +103 -37
- package/src/search-params/define.ts +37 -17
- package/src/search-params/index.ts +10 -0
- package/src/server/param-coercion.ts +5 -23
- package/src/server/rsc-entry/index.ts +6 -3
- package/src/server/ssr-entry.ts +2 -2
- package/src/shared/href.ts +257 -0
- package/dist/_chunks/codec-registry-CPc6bjVl.js +0 -20
- package/dist/_chunks/codec-registry-CPc6bjVl.js.map +0 -1
- package/dist/_chunks/codegen-B9oWkWGf.js.map +0 -1
- package/dist/_chunks/href-validation-CEZy1V-k.js +0 -210
- package/dist/_chunks/href-validation-CEZy1V-k.js.map +0 -1
- package/dist/_chunks/use-query-states-pkDV-jSg.js.map +0 -1
|
@@ -1,26 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* The app/schema.ts segment-param codecs, resolved and keyed by bracket form
|
|
3
|
+
* (`'[id]'`, `'[...slug]'`, `'[[...path]]'`).
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
* segment param values back to URL-safe strings. Without this registry,
|
|
6
|
-
* Link falls back to `String(value)` — which works for simple types
|
|
7
|
-
* but breaks for custom codecs (e.g., Date → '2026-04-10').
|
|
5
|
+
* One store per module graph, read in both directions:
|
|
8
6
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* - **parse** — `server/param-coercion.ts` runs `codec.parse` over the raw
|
|
8
|
+
* matcher output before middleware and rendering (RSC).
|
|
9
|
+
* - **serialize** — `shared/href.ts` runs `codec.serialize` when it
|
|
10
|
+
* interpolates a pattern for `<Link>` or `href()` (RSC, SSR, browser).
|
|
11
|
+
*
|
|
12
|
+
* Every entry registers it at startup from `virtual:timber-schema`: the RSC
|
|
13
|
+
* entry, the SSR entry and the browser entry. RSC and SSR are separate Vite
|
|
14
|
+
* module graphs with separate instances of this module, so each must
|
|
15
|
+
* register its own. Until TIM-1621 the RSC entry wrote a second,
|
|
16
|
+
* parse-only store instead, so an `href()` evaluated in a server component
|
|
17
|
+
* silently skipped `codec.serialize` and fell back to `String(value)`.
|
|
11
18
|
*
|
|
12
19
|
* Design doc: design/41-global-params.md §"Link Component"
|
|
13
20
|
*/
|
|
14
21
|
import type { Codec } from '../codec.ts';
|
|
15
22
|
/**
|
|
16
|
-
* Register the resolved schema codecs
|
|
17
|
-
*
|
|
23
|
+
* Register the resolved schema codecs. Called once at startup by each entry.
|
|
24
|
+
* `null` means the app has no schema — every segment stays a raw string.
|
|
18
25
|
* @internal
|
|
19
26
|
*/
|
|
20
|
-
export declare function
|
|
27
|
+
export declare function setSchemaCodecs(codecs: Record<string, Codec<unknown>> | null): void;
|
|
21
28
|
/**
|
|
22
29
|
* Look up a codec by bracket key (e.g. '[id]', '[...slug]').
|
|
23
30
|
* Returns undefined if no schema is registered or the key has no codec.
|
|
31
|
+
* @internal
|
|
24
32
|
*/
|
|
25
|
-
export declare function
|
|
33
|
+
export declare function getSchemaCodec(bracketKey: string): Codec<unknown> | undefined;
|
|
34
|
+
/** True once a schema with segment codecs has been registered. @internal */
|
|
35
|
+
export declare function hasSchemaCodecs(): boolean;
|
|
26
36
|
//# sourceMappingURL=codec-registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec-registry.d.ts","sourceRoot":"","sources":["../../src/params/codec-registry.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"codec-registry.d.ts","sourceRoot":"","sources":["../../src/params/codec-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAIzC;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,IAAI,GAAG,IAAI,CAEnF;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,SAAS,CAE7E;AAED,4EAA4E;AAC5E,wBAAgB,eAAe,IAAI,OAAO,CAEzC"}
|
package/dist/params/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { defineSchema } from './define-schema.ts';
|
|
2
2
|
export type { InferCodecType, SchemaConfig, SegmentParamCodec, ValidDynamicSegmentKeys, ValidDynamicSegmentKeysRegistry, } from './define-schema.ts';
|
|
3
3
|
export { resolveSchemaCodecs, toBracketKey } from './resolve-schema.ts';
|
|
4
|
-
export { setLinkCodecs, getLinkCodec } from './codec-registry.ts';
|
|
5
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/params/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EACV,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,EACvB,+BAA+B,GAChC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/params/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EACV,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,EACvB,+BAA+B,GAChC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/params/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { n as toBracketKey, t as resolveSchemaCodecs } from "../_chunks/resolve-schema-B-aCuTu3.js";
|
|
2
|
-
import { n as setLinkCodecs, t as getLinkCodec } from "../_chunks/codec-registry-CPc6bjVl.js";
|
|
3
2
|
// src/params/define-schema.ts
|
|
4
3
|
/**
|
|
5
4
|
* Define the global segment param schema.
|
|
@@ -28,6 +27,6 @@ import { n as setLinkCodecs, t as getLinkCodec } from "../_chunks/codec-registry
|
|
|
28
27
|
function defineSchema(config) {
|
|
29
28
|
return config;
|
|
30
29
|
}
|
|
31
|
-
export { defineSchema,
|
|
30
|
+
export { defineSchema, resolveSchemaCodecs, toBracketKey };
|
|
32
31
|
|
|
33
32
|
//# sourceMappingURL=index.js.map
|
package/dist/params/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/params/define-schema.ts"],"sourcesContent":["/**\n * defineSchema — global segment param schema definition.\n *\n * Identity function at runtime; the type information is what matters.\n * The Vite plugin reads the schema at build time for codegen, and\n * the pipeline reads it at runtime for coercion.\n *\n * Design doc: design/41-global-params.md\n */\n\nimport type { Codec, CatchAllCodec, OptionalCatchAllCodec } from '../codec.ts';\nimport type { StandardSchemaV1 } from '../schema-bridge.ts';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/**\n * Infer the output type from a Codec, StandardSchemaV1, or nuqs parser.\n *\n * Used by codegen to reference schema types without hardcoding:\n * `InferCodecType<typeof schema.segmentParams['[year]']>`\n */\nexport type InferCodecType<V> =\n V extends Codec<infer T>\n ? T\n : V extends StandardSchemaV1<infer T>\n ? T\n : V extends { parseServerSide: (value: string) => infer T }\n ? T\n : string;\n\n/** Acceptable codec value for segment params: a Codec or Standard Schema. */\nexport type SegmentParamCodec = Codec<unknown> | StandardSchemaV1<unknown>;\n\n/** Codec constraint for catch-all segment keys (`[...name]`). */\nexport type CatchAllParamCodec = CatchAllCodec<unknown> | StandardSchemaV1<readonly unknown[]>;\n\n/** Codec constraint for optional catch-all segment keys (`[[...name]]`). */\nexport type OptionalCatchAllParamCodec =\n | OptionalCatchAllCodec<unknown>\n | StandardSchemaV1<readonly unknown[] | undefined>;\n\n/**\n * Resolves the required codec type for a given bracket key pattern.\n * - `[...name]` → requires a catch-all codec\n * - `[[...name]]` → requires an optional catch-all codec\n * - `[name]` → accepts any segment param codec\n */\nexport type CodecForKey<K extends string> = K extends `[[...${string}]]`\n ? OptionalCatchAllParamCodec\n : K extends `[...${string}]`\n ? CatchAllParamCodec\n : SegmentParamCodec;\n\n/**\n * Registry interface augmented by codegen with known filesystem bracket keys.\n * When empty (no codegen yet), ValidDynamicSegmentKeys falls back to string.\n */\n// eslint-disable-next-line typescript/no-empty-interface -- augmented by codegen\nexport interface ValidDynamicSegmentKeysRegistry {}\n\n/**\n * Union of valid bracket keys for defineSchema.\n * After codegen runs, this is the set of filesystem segment names.\n * Before codegen (fresh project), accepts any string.\n */\nexport type ValidDynamicSegmentKeys = keyof ValidDynamicSegmentKeysRegistry extends never\n ? string\n : keyof ValidDynamicSegmentKeysRegistry & string;\n\n/** Configuration object for defineSchema. */\nexport interface SchemaConfig<S extends Record<string, SegmentParamCodec>> {\n segmentParams: S;\n}\n\n// ---------------------------------------------------------------------------\n// Factory\n// ---------------------------------------------------------------------------\n\n/**\n * Define the global segment param schema.\n *\n * Each key uses the bracket syntax from the filesystem (`[id]`, `[...slug]`,\n * `[[...slug]]`) mapped to a codec. This makes the relationship between\n * filesystem segments and codecs visually obvious.\n *\n * A dynamic segment with no key here defaults to `string` at codegen time.\n *\n * ```ts\n * // app/schema.ts\n * import { defineSchema } from '@timber-js/app/params';\n * import { codec } from '@timber-js/app/codec';\n * import { z } from 'zod';\n *\n * export default defineSchema({\n * segmentParams: {\n * '[artistSlug]': codec.string,\n * '[year]': codec.integer,\n * '[id]': z.coerce.number().int(),\n * },\n * });\n * ```\n */\nexport function defineSchema<\n S extends {\n [K in keyof S]: K extends ValidDynamicSegmentKeys\n ? K extends string\n ? CodecForKey<K>\n : SegmentParamCodec\n : never;\n },\n>(config: { segmentParams: S }): { segmentParams: S } {\n return config;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/params/define-schema.ts"],"sourcesContent":["/**\n * defineSchema — global segment param schema definition.\n *\n * Identity function at runtime; the type information is what matters.\n * The Vite plugin reads the schema at build time for codegen, and\n * the pipeline reads it at runtime for coercion.\n *\n * Design doc: design/41-global-params.md\n */\n\nimport type { Codec, CatchAllCodec, OptionalCatchAllCodec } from '../codec.ts';\nimport type { StandardSchemaV1 } from '../schema-bridge.ts';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/**\n * Infer the output type from a Codec, StandardSchemaV1, or nuqs parser.\n *\n * Used by codegen to reference schema types without hardcoding:\n * `InferCodecType<typeof schema.segmentParams['[year]']>`\n */\nexport type InferCodecType<V> =\n V extends Codec<infer T>\n ? T\n : V extends StandardSchemaV1<infer T>\n ? T\n : V extends { parseServerSide: (value: string) => infer T }\n ? T\n : string;\n\n/** Acceptable codec value for segment params: a Codec or Standard Schema. */\nexport type SegmentParamCodec = Codec<unknown> | StandardSchemaV1<unknown>;\n\n/** Codec constraint for catch-all segment keys (`[...name]`). */\nexport type CatchAllParamCodec = CatchAllCodec<unknown> | StandardSchemaV1<readonly unknown[]>;\n\n/** Codec constraint for optional catch-all segment keys (`[[...name]]`). */\nexport type OptionalCatchAllParamCodec =\n | OptionalCatchAllCodec<unknown>\n | StandardSchemaV1<readonly unknown[] | undefined>;\n\n/**\n * Resolves the required codec type for a given bracket key pattern.\n * - `[...name]` → requires a catch-all codec\n * - `[[...name]]` → requires an optional catch-all codec\n * - `[name]` → accepts any segment param codec\n */\nexport type CodecForKey<K extends string> = K extends `[[...${string}]]`\n ? OptionalCatchAllParamCodec\n : K extends `[...${string}]`\n ? CatchAllParamCodec\n : SegmentParamCodec;\n\n/**\n * Registry interface augmented by codegen with known filesystem bracket keys.\n * When empty (no codegen yet), ValidDynamicSegmentKeys falls back to string.\n */\n// eslint-disable-next-line typescript/no-empty-interface -- augmented by codegen\nexport interface ValidDynamicSegmentKeysRegistry {}\n\n/**\n * Union of valid bracket keys for defineSchema.\n * After codegen runs, this is the set of filesystem segment names.\n * Before codegen (fresh project), accepts any string.\n */\nexport type ValidDynamicSegmentKeys = keyof ValidDynamicSegmentKeysRegistry extends never\n ? string\n : keyof ValidDynamicSegmentKeysRegistry & string;\n\n/** Configuration object for defineSchema. */\nexport interface SchemaConfig<S extends Record<string, SegmentParamCodec>> {\n segmentParams: S;\n}\n\n// ---------------------------------------------------------------------------\n// Factory\n// ---------------------------------------------------------------------------\n\n/**\n * Define the global segment param schema.\n *\n * Each key uses the bracket syntax from the filesystem (`[id]`, `[...slug]`,\n * `[[...slug]]`) mapped to a codec. This makes the relationship between\n * filesystem segments and codecs visually obvious.\n *\n * A dynamic segment with no key here defaults to `string` at codegen time.\n *\n * ```ts\n * // app/schema.ts\n * import { defineSchema } from '@timber-js/app/params';\n * import { codec } from '@timber-js/app/codec';\n * import { z } from 'zod';\n *\n * export default defineSchema({\n * segmentParams: {\n * '[artistSlug]': codec.string,\n * '[year]': codec.integer,\n * '[id]': z.coerce.number().int(),\n * },\n * });\n * ```\n */\nexport function defineSchema<\n S extends {\n [K in keyof S]: K extends ValidDynamicSegmentKeys\n ? K extends string\n ? CodecForKey<K>\n : SegmentParamCodec\n : never;\n },\n>(config: { segmentParams: S }): { segmentParams: S } {\n return config;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAwGA,SAAgB,aAQd,QAAoD;CACpD,OAAO;AACT"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* timber-node-flight-builds — in dev, the RSC and SSR environments load only
|
|
3
|
+
* the Node builds of React's Flight runtime, pre-bundled.
|
|
4
|
+
*
|
|
5
|
+
* On Node, timber renders Flight with `renderToPipeableStream` and decodes it
|
|
6
|
+
* with `createFromNodeStream` (TIM-1585), which only the `.node` builds of
|
|
7
|
+
* plugin-rsc's vendored `react-server-dom-webpack` export. plugin-rsc itself
|
|
8
|
+
* imports the `.edge` builds: its core (`core/rsc.js`) registers references
|
|
9
|
+
* through `vendor/react-server-dom/server.edge`, and the imports it injects
|
|
10
|
+
* into every 'use client' proxy and 'use server' module reach the edge server
|
|
11
|
+
* and client. Without this plugin each server environment loads both builds
|
|
12
|
+
* of each runtime — React's largest development files, evaluated twice — and
|
|
13
|
+
* the Node ones raw, through Vite's CommonJS transform, because plugin-rsc
|
|
14
|
+
* pre-bundles only the edge ones. Measured on a starter app, a cold
|
|
15
|
+
* `timber dev` spent ~0.7s of CPU (~20%) on this before its first response.
|
|
16
|
+
*
|
|
17
|
+
* Two changes, which only work together:
|
|
18
|
+
* - Every import of a vendored edge build (`…/react-server-dom/server.edge`,
|
|
19
|
+
* `client.edge`, `static.edge`) resolves to its `.node` sibling. Each Node
|
|
20
|
+
* build exports everything its edge build does, plus the Node-stream APIs,
|
|
21
|
+
* so every importer keeps working and shares one instance. In SSR,
|
|
22
|
+
* `react-dom/server` and `react-dom/static` resolve to their `.node` builds
|
|
23
|
+
* the same way.
|
|
24
|
+
* - The server environments' `optimizeDeps.include` lists the `.node` builds
|
|
25
|
+
* in place of the edge ones, so what loads is the pre-bundle. Keeping the
|
|
26
|
+
* edge entries would pre-bundle files nothing loads; dropping them without
|
|
27
|
+
* the redirect would load the edge builds raw.
|
|
28
|
+
*
|
|
29
|
+
* Dev only: the dev server runs both server environments in this Node process
|
|
30
|
+
* (timber-dev-server requires a runnable RSC environment). A build keeps both
|
|
31
|
+
* builds, because the runtime probe (`server/node-streams-platform.ts`), not
|
|
32
|
+
* the build, decides whether it runs on Node.
|
|
33
|
+
*
|
|
34
|
+
* See design/21-dev-server.md §"One Flight Build per Server Environment".
|
|
35
|
+
*/
|
|
36
|
+
import type { Plugin } from 'vite';
|
|
37
|
+
export declare function timberNodeFlightBuilds(): Plugin;
|
|
38
|
+
//# sourceMappingURL=node-flight-builds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-flight-builds.d.ts","sourceRoot":"","sources":["../../src/plugins/node-flight-builds.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAmCnC,wBAAgB,sBAAsB,IAAI,MAAM,CAsB/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shims.d.ts","sourceRoot":"","sources":["../../src/plugins/shims.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAGnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAsB1D;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"shims.d.ts","sourceRoot":"","sources":["../../src/plugins/shims.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAGnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAsB1D;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAuBlD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EA0BhD,CAAC;AA2CF;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CA6OvD"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `href()` — the typed URL builder over the generated `Routes` map.
|
|
3
|
+
*
|
|
4
|
+
* Every internal URL string — `router.push`, `redirect()`, an href passed
|
|
5
|
+
* as a prop, metadata — goes through this one function, so a renamed route
|
|
6
|
+
* directory breaks the build instead of silently breaking a link, and every
|
|
7
|
+
* segment value serializes through its app/schema.ts codec.
|
|
8
|
+
*
|
|
9
|
+
* Isomorphic by construction: no `'use client'`, no React, no ALS. The same
|
|
10
|
+
* call works in a server component, a client component, middleware, an
|
|
11
|
+
* action, or a plain module.
|
|
12
|
+
*
|
|
13
|
+
* Design doc: design/09-typescript.md §"Building URLs — href()".
|
|
14
|
+
*/
|
|
15
|
+
import type { Routes } from '../index.ts';
|
|
16
|
+
import { type SearchParamsArg } from '../shared/href.ts';
|
|
17
|
+
/** A URL pattern known to the generated route map (groups stripped). */
|
|
18
|
+
export type RoutePattern = keyof Routes;
|
|
19
|
+
/**
|
|
20
|
+
* Every URL `pattern` resolves to, as a template-literal type:
|
|
21
|
+
* `RouteHref<'/products/[id]'>` is `` `/products/${string}` ``.
|
|
22
|
+
*
|
|
23
|
+
* Use it to require a route-shaped string in a prop
|
|
24
|
+
* (`rowHref: RouteHref<'/artists/[artistSlug]'>`). It is a shape check, not
|
|
25
|
+
* a brand: a hand-built `` `/artists/${slug}` `` satisfies it too, which is
|
|
26
|
+
* how `<Link>` already treats literal hrefs. So does any route nested under
|
|
27
|
+
* it (`/artists/${string}` matches `/artists/a/songs/b`).
|
|
28
|
+
*
|
|
29
|
+
* Read from `Routes[P]['href']`, which codegen emits from the same function
|
|
30
|
+
* that builds `<Link>`'s resolved-template variants. Falls back to `string`
|
|
31
|
+
* only for a route map generated before that member existed.
|
|
32
|
+
*/
|
|
33
|
+
export type RouteHref<P extends keyof Routes> = Routes[P] extends {
|
|
34
|
+
href: infer H extends string;
|
|
35
|
+
} ? H : string;
|
|
36
|
+
/**
|
|
37
|
+
* `RouteHref<P>` with a query. The bare form stays in the union because an
|
|
38
|
+
* empty query (`buildSearchParams({})` → `''`) appends nothing — not a bare
|
|
39
|
+
* `?`.
|
|
40
|
+
*/
|
|
41
|
+
export type RouteHrefWithSearch<P extends keyof Routes> = RouteHref<P> | `${RouteHref<P>}?${string}`;
|
|
42
|
+
type SegmentParamsOf<P extends keyof Routes> = Routes[P] extends {
|
|
43
|
+
segmentParams: infer S;
|
|
44
|
+
} ? S : never;
|
|
45
|
+
/**
|
|
46
|
+
* The params the PATTERN lets a caller omit: only an optional catch-all,
|
|
47
|
+
* which is always the last segment (`/docs/[[...path]]`). Read from the
|
|
48
|
+
* pattern's syntax, not from the param types — a schema codec may return
|
|
49
|
+
* `T | undefined` for a required `[id]`, and the runtime still throws for
|
|
50
|
+
* a missing `[id]` before any codec runs.
|
|
51
|
+
*/
|
|
52
|
+
type OmittableKeys<P extends keyof Routes, T> = {
|
|
53
|
+
[K in keyof T]: P extends `${string}[[...${K & string}]]` ? K : never;
|
|
54
|
+
}[keyof T];
|
|
55
|
+
/**
|
|
56
|
+
* Codegen types an optional catch-all as a required key whose value may be
|
|
57
|
+
* `undefined` (`path: string[] | undefined`). Omittable keys become optional;
|
|
58
|
+
* every other key is required and cannot be `undefined` (the runtime throws
|
|
59
|
+
* on it, whatever the codec's type says).
|
|
60
|
+
*/
|
|
61
|
+
type ParamsShape<P extends keyof Routes, T> = {
|
|
62
|
+
[K in keyof T as K extends OmittableKeys<P, T> ? never : K]: Exclude<T[K], undefined>;
|
|
63
|
+
} & {
|
|
64
|
+
[K in keyof T as K extends OmittableKeys<P, T> ? K : never]?: T[K];
|
|
65
|
+
};
|
|
66
|
+
/** Flatten an intersection so diagnostics print one object type. */
|
|
67
|
+
type Flatten<T> = {
|
|
68
|
+
[K in keyof T]: T[K];
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* The segment params `href(pattern, …)` takes. `Record<string, never>` for a
|
|
72
|
+
* route with none, so `href('/venues', { x: 1 })` is an error rather than a
|
|
73
|
+
* silent no-op (`{}` would accept any object).
|
|
74
|
+
*/
|
|
75
|
+
export type HrefParams<P extends keyof Routes> = [keyof SegmentParamsOf<P>] extends [never] ? Record<string, never> : Flatten<ParamsShape<P, SegmentParamsOf<P>>>;
|
|
76
|
+
/** True when `T` is a union of more than one member. */
|
|
77
|
+
type IsUnion<T, U = T> = T extends unknown ? ([U] extends [T] ? false : true) : never;
|
|
78
|
+
/** True when no member of `P` has a required segment param. */
|
|
79
|
+
type EveryParamOptional<P extends keyof Routes> = (P extends unknown ? ({} extends HrefParams<P> ? true : false) : never) extends true ? true : false;
|
|
80
|
+
/**
|
|
81
|
+
* The arguments after `pattern`. Segment params are required unless every
|
|
82
|
+
* param is optional (none, or only an optional catch-all); the query is
|
|
83
|
+
* always optional.
|
|
84
|
+
*
|
|
85
|
+
* A UNION pattern (`'/products/[id]' | '/venues'`) has no single params
|
|
86
|
+
* shape: `keyof` a union of param objects is `never`, which would read as
|
|
87
|
+
* "no params" and let `href(pattern)` compile, then throw for the dynamic
|
|
88
|
+
* member. So a union takes no segment params at all, and only when none of
|
|
89
|
+
* its members requires one; otherwise the call needs an argument of type
|
|
90
|
+
* `never`, which nothing satisfies. Narrow the pattern before calling.
|
|
91
|
+
*
|
|
92
|
+
* The exception is `P` = all of `keyof Routes`: that is what TS infers when
|
|
93
|
+
* the pattern is NOT a known route, and the arity error would hide the
|
|
94
|
+
* useful one ("'/nope' is not assignable to keyof Routes"). That case takes
|
|
95
|
+
* the permissive shape so the pattern error is the one reported.
|
|
96
|
+
*/
|
|
97
|
+
export type HrefArgs<P extends keyof Routes, S extends SearchParamsArg | undefined = SearchParamsArg | undefined> = true extends IsUnion<P> ? EveryParamOptional<P> extends true ? [segmentParams?: undefined, searchParams?: S] : [keyof Routes] extends [P] ? [segmentParams?: undefined, searchParams?: S] : [narrow_the_pattern_union_to_one_route: never] : {} extends HrefParams<P> ? [segmentParams?: HrefParams<P>, searchParams?: S] : [segmentParams: HrefParams<P>, searchParams?: S];
|
|
98
|
+
/**
|
|
99
|
+
* Build the URL for a route pattern.
|
|
100
|
+
*
|
|
101
|
+
* ```ts
|
|
102
|
+
* href('/venues') // '/venues'
|
|
103
|
+
* href('/products/[id]', { id }) // `/products/${string}`
|
|
104
|
+
* href('/docs/[[...path]]') // '/docs'
|
|
105
|
+
* href('/artists/[artistSlug]', { artistSlug }, artistParams.buildSearchParams({ sort }))
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* - **Segment params** are typed from `Routes[pattern]['segmentParams']` —
|
|
109
|
+
* the app/schema.ts codec types when a schema exists — and serialized
|
|
110
|
+
* through those codecs, then percent-encoded per segment.
|
|
111
|
+
* - **Search params** (third argument) take the string
|
|
112
|
+
* `definition.buildSearchParams()` returns (codecs, `withUrlKey` aliases,
|
|
113
|
+
* default omission) or a plain record as the uncodec'd escape hatch. An
|
|
114
|
+
* empty query appends nothing.
|
|
115
|
+
* - The result is validated like every navigation sink: a value that would
|
|
116
|
+
* produce a protocol-relative URL (`/[...slug]` with `['', 'evil.com']` →
|
|
117
|
+
* `//evil.com`) throws instead of returning an open redirect.
|
|
118
|
+
*
|
|
119
|
+
* `href(ROUTE, …)` works with the `ROUTE` constant from a route's generated
|
|
120
|
+
* `./$segment` module whenever that directory is a page or route handler.
|
|
121
|
+
*/
|
|
122
|
+
export declare function href<P extends keyof Routes, S extends SearchParamsArg | undefined = undefined>(pattern: P, ...args: HrefArgs<P, S>): S extends SearchParamsArg ? RouteHrefWithSearch<P> : RouteHref<P>;
|
|
123
|
+
export {};
|
|
124
|
+
//# sourceMappingURL=href.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"href.d.ts","sourceRoot":"","sources":["../../src/routes/href.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAA8B,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAErF,wEAAwE;AACxE,MA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,CAAC,GAC7C,CAAC,qCAAqC,EAAE,KAAK,CAAC,GAClD,EAAE,SAAS,UAAU,CAAC,CAAC,CAAC,GACtB,CAAC,aAAa,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,EAAE,CAAC,CAAC,GACjD,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC;AAQzD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,MAAM,EAAE,CAAC,SAAS,eAAe,GAAG,SAAS,GAAG,SAAS,EAC5F,OAAO,EAAE,CAAC,EACV,GAAG,IAAI,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,GACtB,CAAC,SAAS,eAAe,GAAG,mBAAmB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACpG,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/routes/href.ts"],"sourcesContent":["/**\n * `href()` — the typed URL builder over the generated `Routes` map.\n *\n * Every internal URL string — `router.push`, `redirect()`, an href passed\n * as a prop, metadata — goes through this one function, so a renamed route\n * directory breaks the build instead of silently breaking a link, and every\n * segment value serializes through its app/schema.ts codec.\n *\n * Isomorphic by construction: no `'use client'`, no React, no ALS. The same\n * call works in a server component, a client component, middleware, an\n * action, or a plain module.\n *\n * Design doc: design/09-typescript.md §\"Building URLs — href()\".\n */\n\nimport type { Routes } from '../index.ts';\nimport { buildHref, type ParamValue, type SearchParamsArg } from '../shared/href.ts';\n\n/** A URL pattern known to the generated route map (groups stripped). */\nexport type RoutePattern = keyof Routes;\n\n/**\n * Every URL `pattern` resolves to, as a template-literal type:\n * `RouteHref<'/products/[id]'>` is `` `/products/${string}` ``.\n *\n * Use it to require a route-shaped string in a prop\n * (`rowHref: RouteHref<'/artists/[artistSlug]'>`). It is a shape check, not\n * a brand: a hand-built `` `/artists/${slug}` `` satisfies it too, which is\n * how `<Link>` already treats literal hrefs. So does any route nested under\n * it (`/artists/${string}` matches `/artists/a/songs/b`).\n *\n * Read from `Routes[P]['href']`, which codegen emits from the same function\n * that builds `<Link>`'s resolved-template variants. Falls back to `string`\n * only for a route map generated before that member existed.\n */\nexport type RouteHref<P extends keyof Routes> = Routes[P] extends {\n href: infer H extends string;\n}\n ? H\n : string;\n\n/**\n * `RouteHref<P>` with a query. The bare form stays in the union because an\n * empty query (`buildSearchParams({})` → `''`) appends nothing — not a bare\n * `?`.\n */\nexport type RouteHrefWithSearch<P extends keyof Routes> =\n | RouteHref<P>\n | `${RouteHref<P>}?${string}`;\n\ntype SegmentParamsOf<P extends keyof Routes> = Routes[P] extends { segmentParams: infer S }\n ? S\n : never;\n\n/**\n * The params the PATTERN lets a caller omit: only an optional catch-all,\n * which is always the last segment (`/docs/[[...path]]`). Read from the\n * pattern's syntax, not from the param types — a schema codec may return\n * `T | undefined` for a required `[id]`, and the runtime still throws for\n * a missing `[id]` before any codec runs.\n */\ntype OmittableKeys<P extends keyof Routes, T> = {\n [K in keyof T]: P extends `${string}[[...${K & string}]]` ? K : never;\n}[keyof T];\n\n/**\n * Codegen types an optional catch-all as a required key whose value may be\n * `undefined` (`path: string[] | undefined`). Omittable keys become optional;\n * every other key is required and cannot be `undefined` (the runtime throws\n * on it, whatever the codec's type says).\n */\ntype ParamsShape<P extends keyof Routes, T> = {\n [K in keyof T as K extends OmittableKeys<P, T> ? never : K]: Exclude<T[K], undefined>;\n} & {\n [K in keyof T as K extends OmittableKeys<P, T> ? K : never]?: T[K];\n};\n\n/** Flatten an intersection so diagnostics print one object type. */\ntype Flatten<T> = { [K in keyof T]: T[K] };\n\n/**\n * The segment params `href(pattern, …)` takes. `Record<string, never>` for a\n * route with none, so `href('/venues', { x: 1 })` is an error rather than a\n * silent no-op (`{}` would accept any object).\n */\nexport type HrefParams<P extends keyof Routes> = [keyof SegmentParamsOf<P>] extends [never]\n ? Record<string, never>\n : Flatten<ParamsShape<P, SegmentParamsOf<P>>>;\n\n/** True when `T` is a union of more than one member. */\ntype IsUnion<T, U = T> = T extends unknown ? ([U] extends [T] ? false : true) : never;\n\n/** True when no member of `P` has a required segment param. */\ntype EveryParamOptional<P extends keyof Routes> = (\n P extends unknown ? ({} extends HrefParams<P> ? true : false) : never\n) extends true\n ? true\n : false;\n\n/**\n * The arguments after `pattern`. Segment params are required unless every\n * param is optional (none, or only an optional catch-all); the query is\n * always optional.\n *\n * A UNION pattern (`'/products/[id]' | '/venues'`) has no single params\n * shape: `keyof` a union of param objects is `never`, which would read as\n * \"no params\" and let `href(pattern)` compile, then throw for the dynamic\n * member. So a union takes no segment params at all, and only when none of\n * its members requires one; otherwise the call needs an argument of type\n * `never`, which nothing satisfies. Narrow the pattern before calling.\n *\n * The exception is `P` = all of `keyof Routes`: that is what TS infers when\n * the pattern is NOT a known route, and the arity error would hide the\n * useful one (\"'/nope' is not assignable to keyof Routes\"). That case takes\n * the permissive shape so the pattern error is the one reported.\n */\nexport type HrefArgs<\n P extends keyof Routes,\n S extends SearchParamsArg | undefined = SearchParamsArg | undefined,\n> =\n true extends IsUnion<P>\n ? EveryParamOptional<P> extends true\n ? [segmentParams?: undefined, searchParams?: S]\n : [keyof Routes] extends [P]\n ? [segmentParams?: undefined, searchParams?: S]\n : [narrow_the_pattern_union_to_one_route: never]\n : {} extends HrefParams<P>\n ? [segmentParams?: HrefParams<P>, searchParams?: S]\n : [segmentParams: HrefParams<P>, searchParams?: S];\n\n// One signature, not an overload per query shape: with two, a call missing\n// its segment params was reported against whichever overload TS tried last\n// (\"Expected 3 arguments\"). `S` is inferred from the query argument alone,\n// so segment params are still checked against `HrefParams<P>` directly and\n// keep excess-property errors; a maybe-undefined query distributes to the\n// union of both return shapes.\n/**\n * Build the URL for a route pattern.\n *\n * ```ts\n * href('/venues') // '/venues'\n * href('/products/[id]', { id }) // `/products/${string}`\n * href('/docs/[[...path]]') // '/docs'\n * href('/artists/[artistSlug]', { artistSlug }, artistParams.buildSearchParams({ sort }))\n * ```\n *\n * - **Segment params** are typed from `Routes[pattern]['segmentParams']` —\n * the app/schema.ts codec types when a schema exists — and serialized\n * through those codecs, then percent-encoded per segment.\n * - **Search params** (third argument) take the string\n * `definition.buildSearchParams()` returns (codecs, `withUrlKey` aliases,\n * default omission) or a plain record as the uncodec'd escape hatch. An\n * empty query appends nothing.\n * - The result is validated like every navigation sink: a value that would\n * produce a protocol-relative URL (`/[...slug]` with `['', 'evil.com']` →\n * `//evil.com`) throws instead of returning an open redirect.\n *\n * `href(ROUTE, …)` works with the `ROUTE` constant from a route's generated\n * `./$segment` module whenever that directory is a page or route handler.\n */\nexport function href<P extends keyof Routes, S extends SearchParamsArg | undefined = undefined>(\n pattern: P,\n ...args: HrefArgs<P, S>\n): S extends SearchParamsArg ? RouteHrefWithSearch<P> : RouteHref<P>;\nexport function href(\n pattern: string,\n segmentParams?: Record<string, ParamValue>,\n searchParams?: SearchParamsArg\n): string {\n return buildHref(pattern, segmentParams, searchParams);\n}\n"],"mappings":";;AAoKA,SAAgB,KACd,SACA,eACA,cACQ;CACR,OAAO,UAAU,SAAS,eAAe,YAAY;AACvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../../src/routing/codegen.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../../src/routing/codegen.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;AAUzD,wCAAwC;AACxC,MAAM,WAAW,cAAc;IAC7B,qFAAqF;IACrF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,GAAE,cAAmB,GAAG,MAAM,CActF"}
|
package/dist/routing/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as INTERCEPTION_MARKERS, i as DEFAULT_PAGE_EXTENSIONS, n as classifyUrlSegment, t as classifySegment } from "../_chunks/segment-classify-Ho8jXWeC.js";
|
|
2
2
|
import { d as collectInterceptionRewrites, n as scanRoutes } from "../_chunks/scanner-BNQ4qnLX.js";
|
|
3
|
-
import { t as generateRouteMap } from "../_chunks/codegen-
|
|
3
|
+
import { t as generateRouteMap } from "../_chunks/codegen-vaCyFyVN.js";
|
|
4
4
|
import { n as collectDynamicSegmentsFromTree, r as validateSchemaAgainstRoutes, t as collectLeafRoutes } from "../_chunks/walkers-D_QHR_nf.js";
|
|
5
5
|
export { DEFAULT_PAGE_EXTENSIONS, INTERCEPTION_MARKERS, classifySegment, classifyUrlSegment, collectDynamicSegmentsFromTree, collectInterceptionRewrites, collectLeafRoutes, generateRouteMap, scanRoutes, validateSchemaAgainstRoutes };
|
|
@@ -37,16 +37,47 @@ import type { ParamEntry, RouteEntry } from './codegen-types.ts';
|
|
|
37
37
|
* Declared once so the three emission sites cannot drift apart.
|
|
38
38
|
*/
|
|
39
39
|
export declare const SEARCH_PARAMS_PROP_TYPE = "string | Record<string, unknown>";
|
|
40
|
-
/** Shared Link base-props type literal used in every emitted call signature. */
|
|
41
|
-
export declare const LINK_BASE_PROPS_TYPE = "Omit<import('react').AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> & { prefetch?: boolean; scroll?: boolean; preserveSearchParams?: true | string[]; onNavigate?: import('./client/link.js').OnNavigateHandler; children?: import('react').ReactNode }";
|
|
42
40
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
41
|
+
* Link base props in every emitted call signature: the real `LinkBaseProps`
|
|
42
|
+
* from `@timber-js/app/client`, by reference.
|
|
43
|
+
*
|
|
44
|
+
* Until TIM-1621 this was an inline copy of the type. It drifted —
|
|
45
|
+
* `replace` and `transitionTypes` were never added, so typed `<Link>`
|
|
46
|
+
* rejected both — and its `onNavigate` came from `./client/link.js`, a
|
|
47
|
+
* path relative to `.timber/` that never resolved, so that prop was
|
|
48
|
+
* silently `any`. A reference cannot drift.
|
|
49
|
+
*/
|
|
50
|
+
export declare const LINK_BASE_PROPS_TYPE = "import('@timber-js/app/client').LinkBaseProps";
|
|
51
|
+
/**
|
|
52
|
+
* Build the TypeScript type of every URL a route resolves to — a type
|
|
53
|
+
* EXPRESSION, ready to drop into a declaration:
|
|
54
|
+
*
|
|
55
|
+
* '/venues' → '/venues'
|
|
56
|
+
* '/products/[id]' → `/products/${string}`
|
|
57
|
+
* '/img-[id].png' → `/img-${string}.png`
|
|
58
|
+
* '/blog/[...slug]' → `/blog/${string}`
|
|
59
|
+
* '/docs/[[...path]]' → '/docs' | `/docs/${string}`
|
|
60
|
+
* '/[[...path]]' → '/' | `/${string}`
|
|
61
|
+
*
|
|
62
|
+
* An optional catch-all that is omitted drops its segment AND its slash
|
|
63
|
+
* (`interpolateParams('/docs/[[...path]]', {})` is `/docs`), and
|
|
64
|
+
* `/docs/${string}` does not match `/docs` — so a trailing optional
|
|
65
|
+
* catch-all needs the bare prefix as a second member. Before TIM-1621 this
|
|
66
|
+
* emitted only the template, and `<Link href="/docs">` matched no route.
|
|
67
|
+
*
|
|
68
|
+
* Emitted once per route as `Routes[P]['href']` — the type `href()`
|
|
69
|
+
* returns — and reused for `<Link>`'s resolved-template variants, so the
|
|
70
|
+
* two cannot disagree about what a route's URLs look like.
|
|
71
|
+
*/
|
|
72
|
+
export declare function buildResolvedPattern(route: RouteEntry): string;
|
|
73
|
+
/**
|
|
74
|
+
* `<Link>`'s query-bearing href type: each member of `buildResolvedPattern`
|
|
75
|
+
* that ends in a static part, with `?${string}` appended. `href(pattern,
|
|
76
|
+
* params, search)` can return such a value, and a `/venues?${string}` is
|
|
77
|
+
* not wide `string`, so without this it would match no Link overload.
|
|
78
|
+
* `null` when every member ends in `${string}` (which already matches a query).
|
|
48
79
|
*/
|
|
49
|
-
export declare function
|
|
80
|
+
export declare function buildResolvedPatternWithQuery(route: RouteEntry): string | null;
|
|
50
81
|
/**
|
|
51
82
|
* Format the segmentParams type for Link overloads.
|
|
52
83
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link-codegen.d.ts","sourceRoot":"","sources":["../../src/routing/link-codegen.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIjE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB,qCAAqC,CAAC;AAE1E
|
|
1
|
+
{"version":3,"file":"link-codegen.d.ts","sourceRoot":"","sources":["../../src/routing/link-codegen.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIjE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB,qCAAqC,CAAC;AAE1E;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,kDAAkD,CAAC;AAKpF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAI9D;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAO9E;AAgCD;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAWtF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,2BAA2B,IAAI,MAAM,EAAE,CA+DtD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAmF5F"}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import type { StandardSchemaV1 } from '../schema-bridge.ts';
|
|
13
13
|
import type { Codec } from '../codec.ts';
|
|
14
|
+
import type { Options as NuqsOptions } from 'nuqs';
|
|
14
15
|
/**
|
|
15
16
|
* A codec that converts between URL string values and typed values.
|
|
16
17
|
*
|
|
@@ -74,26 +75,45 @@ export type InferCodec<C> = C extends SearchParamCodec<infer T> ? T : never;
|
|
|
74
75
|
export type CodecMap<T extends Record<string, unknown>> = {
|
|
75
76
|
[K in keyof T]: SearchParamCodec<T[K]>;
|
|
76
77
|
};
|
|
77
|
-
/**
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Options for a `setParams` call: nuqs's own `Options`, passed through
|
|
80
|
+
* whole. Not a hand-copied subset — a whitelist silently dropped
|
|
81
|
+
* `limitUrlUpdates` (debounce/throttle) and `clearOnDefault`, and would drop
|
|
82
|
+
* whatever nuqs adds next (TIM-1623).
|
|
83
|
+
*
|
|
84
|
+
* `urlKeys` is not here: nuqs's `Options` does not carry it (it lives on
|
|
85
|
+
* the hook-only `UseQueryStatesOptions`), and timber owns it — the aliases
|
|
86
|
+
* come from the codecs (`withUrlKey`).
|
|
87
|
+
*
|
|
88
|
+
* The fields re-listed below are not a second declaration: each takes its
|
|
89
|
+
* type from nuqs (`NuqsOptions['shallow']`), and is re-listed only because
|
|
90
|
+
* nuqs's own JSDoc, which an editor shows on hover, is wrong for timber.
|
|
91
|
+
* See design/23-search-params.md §"Options pass through to nuqs".
|
|
92
|
+
*/
|
|
93
|
+
export interface SetParamsOptions extends NuqsOptions {
|
|
94
|
+
/**
|
|
95
|
+
* `false` (timber's default): the write is an RSC navigation, so the server
|
|
96
|
+
* renders the new params. `true`: the URL changes with no server request.
|
|
97
|
+
*/
|
|
98
|
+
shallow?: NuqsOptions['shallow'];
|
|
99
|
+
/** Scroll to the top after the write. Defaults to `true` in timber. */
|
|
100
|
+
scroll?: NuqsOptions['scroll'];
|
|
101
|
+
/**
|
|
102
|
+
* Forwarded to nuqs, but it does not track the server request in timber.
|
|
103
|
+
* timber runs navigations outside any transition, so `isPending` ends
|
|
104
|
+
* before the RSC fetch does. Use `usePendingNavigation()` for a loading
|
|
105
|
+
* state.
|
|
106
|
+
*/
|
|
107
|
+
startTransition?: NuqsOptions['startTransition'];
|
|
85
108
|
}
|
|
86
109
|
/** Setter function returned by useQueryStates. */
|
|
87
110
|
export type SetParams<T> = (values: Partial<T>, options?: SetParamsOptions) => void;
|
|
88
|
-
/**
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
/** 'push' (default) or 'replace' for history state. */
|
|
95
|
-
history?: 'push' | 'replace';
|
|
96
|
-
}
|
|
111
|
+
/**
|
|
112
|
+
* Options for the `useQueryStates` hook — the defaults for every setter call
|
|
113
|
+
* from that hook instance. Same shape as {@link SetParamsOptions}; a per-call
|
|
114
|
+
* option overrides the hook's.
|
|
115
|
+
*/
|
|
116
|
+
export type QueryStatesOptions = SetParamsOptions;
|
|
97
117
|
/**
|
|
98
118
|
* A fully typed, composable search params definition.
|
|
99
119
|
*
|
|
@@ -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;
|
|
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;AACzC,OAAO,KAAK,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,MAAM,CAAC;AAcnD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,CAAE,SAAQ,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC;IACtE;;;;;;;;;;OAUG;IACH,SAAS,CAAC,KAAK,EAAE,CAAC,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IAC9C,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;;;;;;;;;;OAgBG;IACH,eAAe,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,GAAG,CAAC,CAAC;CAC3D;AAED,8DAA8D;AAC9D,MAAM,WAAW,0BAA0B,CAAC,CAAC,CAAE,SAAQ,gBAAgB,CAAC,CAAC,CAAC;IACxE,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wCAAwC;AACxC,MAAM,MAAM,UAAU,CAAC,CA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CAAC,GAAG;IACpD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;CAClD,EAED,MAAM,EAAE,CAAC,GACR,sBAAsB,CAAC;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,OAAO,CAAC,GAAG,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC,CAAC;AAE3F;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAC3E,MAAM,EAAE,CAAC,GACR,sBAAsB,CAAC;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export type { SearchParamCodec, SearchParamCodecWithUrlKey, TotalSearchParamCodec, InferCodec, InferField, CodecMap, SearchParamsDefinition, SetParams, SetParamsOptions, QueryStatesOptions, StandardSchemaV1, } from './define.ts';
|
|
2
2
|
export { defineSearchParams } from './define.ts';
|
|
3
3
|
export { withDefault, withUrlKey } from './wrappers.ts';
|
|
4
|
+
export { debounce, throttle, defaultRateLimit } from 'nuqs/server';
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/search-params/index.ts"],"names":[],"mappings":"AAMA,YAAY,EACV,gBAAgB,EAChB,0BAA0B,EAC1B,qBAAqB,EACrB,UAAU,EACV,UAAU,EACV,QAAQ,EACR,sBAAsB,EACtB,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAMjD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/search-params/index.ts"],"names":[],"mappings":"AAMA,YAAY,EACV,gBAAgB,EAChB,0BAA0B,EAC1B,qBAAqB,EACrB,UAAU,EACV,UAAU,EACV,QAAQ,EACR,sBAAsB,EACtB,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAMjD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAUxD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { r as getSearchParamsFromAls } from "../_chunks/als-slots-kbQrHTzm.js";
|
|
2
2
|
import { i as isStandardSchema, n as fromSchema, r as isCodec } from "../_chunks/schema-bridge-DyRs3cqy.js";
|
|
3
|
-
import { i as parseTotal, n as useQueryStates, r as serializedEqual } from "../_chunks/use-query-states-
|
|
3
|
+
import { i as parseTotal, n as useQueryStates, r as serializedEqual } from "../_chunks/use-query-states-D3MMl-KM.js";
|
|
4
|
+
import { debounce, defaultRateLimit, throttle } from "nuqs/server";
|
|
4
5
|
// src/search-params/define.ts
|
|
5
6
|
/**
|
|
6
7
|
* defineSearchParams — factory for SearchParamsDefinition<T>.
|
|
@@ -285,6 +286,6 @@ function withUrlKey(codecOrSchema, urlKey) {
|
|
|
285
286
|
if (typeof codec.parseServerSide === "function") wrapped.parseServerSide = codec.parseServerSide.bind(codec);
|
|
286
287
|
return wrapped;
|
|
287
288
|
}
|
|
288
|
-
export { defineSearchParams, withDefault, withUrlKey };
|
|
289
|
+
export { debounce, defaultRateLimit, defineSearchParams, throttle, withDefault, withUrlKey };
|
|
289
290
|
|
|
290
291
|
//# sourceMappingURL=index.js.map
|