@timber-js/app 0.2.0-alpha.119 → 0.2.0-alpha.120

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.
Files changed (74) hide show
  1. package/LICENSE +8 -0
  2. package/dist/_chunks/{actions-DLijOcMe.js → actions-Cw-7NfJJ.js} +6 -6
  3. package/dist/_chunks/{actions-DLijOcMe.js.map → actions-Cw-7NfJJ.js.map} +1 -1
  4. package/dist/_chunks/{build-output-helper-B226qcTe.js → build-output-helper-DhxiT18k.js} +1 -1
  5. package/dist/_chunks/{build-output-helper-B226qcTe.js.map → build-output-helper-DhxiT18k.js.map} +1 -1
  6. package/dist/_chunks/cli-schema-sync-XV0I47Gj.js +2 -0
  7. package/dist/_chunks/{cli-schema-sync-DFZmnmqG.js → cli-schema-sync-q2wB0DyJ.js} +3 -2
  8. package/dist/_chunks/{cli-schema-sync-DFZmnmqG.js.map → cli-schema-sync-q2wB0DyJ.js.map} +1 -1
  9. package/dist/_chunks/{codec-registry-TNqK8N99.js → codec-registry-V7ARyeLN.js} +1 -1
  10. package/dist/_chunks/{codec-registry-TNqK8N99.js.map → codec-registry-V7ARyeLN.js.map} +1 -1
  11. package/dist/_chunks/{define-BY_dwMyV.js → define-8zQ8Vm7x.js} +3 -3
  12. package/dist/_chunks/{define-BY_dwMyV.js.map → define-8zQ8Vm7x.js.map} +1 -1
  13. package/dist/_chunks/{define-BlFkzZFs.js → define-zQX6e1tN.js} +3 -3
  14. package/dist/_chunks/{define-BlFkzZFs.js.map → define-zQX6e1tN.js.map} +1 -1
  15. package/dist/_chunks/{handler-store-bIAstrxQ.js → handler-store-iqnt2ghN.js} +1 -1
  16. package/dist/_chunks/{handler-store-bIAstrxQ.js.map → handler-store-iqnt2ghN.js.map} +1 -1
  17. package/dist/_chunks/{merge-search-params-Cm1j99HC.js → merge-search-params-CwxJzBLS.js} +1 -1
  18. package/dist/_chunks/{merge-search-params-Cm1j99HC.js.map → merge-search-params-CwxJzBLS.js.map} +1 -1
  19. package/dist/_chunks/{navigation-root-CPKTmf-y.js → navigation-root-DKsJ5Di7.js} +2 -2
  20. package/dist/_chunks/{navigation-root-CPKTmf-y.js.map → navigation-root-DKsJ5Di7.js.map} +1 -1
  21. package/dist/_chunks/{registry-D6-TmNLM.js → registry-Dp_hJL4s.js} +1 -1
  22. package/dist/_chunks/{registry-D6-TmNLM.js.map → registry-Dp_hJL4s.js.map} +1 -1
  23. package/dist/_chunks/{resolve-schema-BxtenpoR.js → resolve-schema-23Mc8aLi.js} +2 -2
  24. package/dist/_chunks/{resolve-schema-BxtenpoR.js.map → resolve-schema-23Mc8aLi.js.map} +1 -1
  25. package/dist/_chunks/{router-ref-115GHAhP.js → router-ref-sektkr-t.js} +2 -2
  26. package/dist/_chunks/{router-ref-115GHAhP.js.map → router-ref-sektkr-t.js.map} +1 -1
  27. package/dist/_chunks/{schema-bridge-o0SwFtXW.js → schema-bridge-eL5vQDSA.js} +1 -1
  28. package/dist/_chunks/{schema-bridge-o0SwFtXW.js.map → schema-bridge-eL5vQDSA.js.map} +1 -1
  29. package/dist/_chunks/{segment-context-BnxoPSFQ.js → segment-context-Bg0pFbLT.js} +1 -1
  30. package/dist/_chunks/{segment-context-BnxoPSFQ.js.map → segment-context-Bg0pFbLT.js.map} +1 -1
  31. package/dist/_chunks/{ssr-data-BP5-JJTi.js → ssr-data-BO5OvEvg.js} +1 -1
  32. package/dist/_chunks/{ssr-data-BP5-JJTi.js.map → ssr-data-BO5OvEvg.js.map} +1 -1
  33. package/dist/_chunks/{stale-reload-DZ_GjtPz.js → stale-reload-BCPRG0Cv.js} +1 -1
  34. package/dist/_chunks/{stale-reload-DZ_GjtPz.js.map → stale-reload-BCPRG0Cv.js.map} +1 -1
  35. package/dist/_chunks/{use-query-states-C0tklghY.js → use-query-states-D9SBlAfp.js} +2 -2
  36. package/dist/_chunks/{use-query-states-C0tklghY.js.map → use-query-states-D9SBlAfp.js.map} +1 -1
  37. package/dist/_chunks/{use-segment-params-6W0l-wqA.js → use-segment-params-CskiK-59.js} +2 -2
  38. package/dist/_chunks/{use-segment-params-6W0l-wqA.js.map → use-segment-params-CskiK-59.js.map} +1 -1
  39. package/dist/_chunks/{validation-AfEFM5ze.js → validation-Bm3Je-09.js} +1 -1
  40. package/dist/_chunks/{validation-AfEFM5ze.js.map → validation-Bm3Je-09.js.map} +1 -1
  41. package/dist/adapters/cloudflare.js +1 -1
  42. package/dist/adapters/nitro.js +1 -1
  43. package/dist/cache/index.js +1 -1
  44. package/dist/cli-schema-sync.d.ts.map +1 -1
  45. package/dist/cli.js +1 -1
  46. package/dist/client/error-boundary.js +2 -2
  47. package/dist/client/index.js +9 -9
  48. package/dist/client/internal.js +7 -7
  49. package/dist/codec.d.ts +1 -1
  50. package/dist/codec.d.ts.map +1 -1
  51. package/dist/codec.js +2 -2
  52. package/dist/codec.js.map +1 -1
  53. package/dist/cookies/index.js +3 -3
  54. package/dist/index.d.ts +0 -3
  55. package/dist/index.d.ts.map +1 -1
  56. package/dist/index.js +2 -4
  57. package/dist/index.js.map +1 -1
  58. package/dist/params/define-schema.d.ts +2 -1
  59. package/dist/params/define-schema.d.ts.map +1 -1
  60. package/dist/params/index.js +33 -3
  61. package/dist/params/index.js.map +1 -0
  62. package/dist/search-params/index.js +3 -3
  63. package/dist/segment-params/index.js +1 -1
  64. package/dist/server/index.js +1 -1
  65. package/dist/server/internal.js +3 -3
  66. package/package.json +6 -7
  67. package/src/cli-schema-sync.ts +2 -1
  68. package/src/cli.ts +0 -0
  69. package/src/codec.ts +4 -4
  70. package/src/index.ts +1 -9
  71. package/src/params/define-schema.ts +2 -1
  72. package/dist/_chunks/cli-schema-sync-BhXdbmgS.js +0 -2
  73. package/dist/_chunks/define-schema-CfEb8LSg.js +0 -31
  74. package/dist/_chunks/define-schema-CfEb8LSg.js.map +0 -1
@@ -35,7 +35,8 @@ export interface SchemaConfig<S extends Record<string, SegmentParamCodec>> {
35
35
  *
36
36
  * ```ts
37
37
  * // app/schema.ts
38
- * import { defineSchema, codec } from '@timber-js/app';
38
+ * import { defineSchema } from '@timber-js/app/params';
39
+ * import { codec } from '@timber-js/app/codec';
39
40
  * import { z } from 'zod';
40
41
  *
41
42
  * export default defineSchema({
@@ -1 +1 @@
1
- {"version":3,"file":"define-schema.d.ts","sourceRoot":"","sources":["../../src/params/define-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAM5D;;;;;GAKG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAC1B,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GACpB,CAAC,GACD,CAAC,SAAS,gBAAgB,CAAC,MAAM,CAAC,CAAC,GACjC,CAAC,GACD,CAAC,SAAS;IAAE,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,CAAA;CAAE,GACvD,CAAC,GACD,MAAM,CAAC;AAEjB,6EAA6E;AAC7E,KAAK,iBAAiB,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAEpE,6CAA6C;AAC7C,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC;IACvE,aAAa,EAAE,CAAC,CAAC;CAClB;AAMD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,EACtE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,GACtB,YAAY,CAAC,CAAC,CAAC,CAEjB"}
1
+ {"version":3,"file":"define-schema.d.ts","sourceRoot":"","sources":["../../src/params/define-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAM5D;;;;;GAKG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAC1B,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GACpB,CAAC,GACD,CAAC,SAAS,gBAAgB,CAAC,MAAM,CAAC,CAAC,GACjC,CAAC,GACD,CAAC,SAAS;IAAE,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,CAAA;CAAE,GACvD,CAAC,GACD,MAAM,CAAC;AAEjB,6EAA6E;AAC7E,KAAK,iBAAiB,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAEpE,6CAA6C;AAC7C,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC;IACvE,aAAa,EAAE,CAAC,CAAC;CAClB;AAMD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,EACtE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,GACtB,YAAY,CAAC,CAAC,CAAC,CAEjB"}
@@ -1,4 +1,34 @@
1
- import { t as defineSchema } from "../_chunks/define-schema-CfEb8LSg.js";
2
- import { n as toBracketKey, t as resolveSchemaCodecs } from "../_chunks/resolve-schema-BxtenpoR.js";
3
- import { n as setLinkCodecs, t as getLinkCodec } from "../_chunks/codec-registry-TNqK8N99.js";
1
+ import { n as toBracketKey, t as resolveSchemaCodecs } from "../_chunks/resolve-schema-23Mc8aLi.js";
2
+ import { n as setLinkCodecs, t as getLinkCodec } from "../_chunks/codec-registry-V7ARyeLN.js";
3
+ //#region src/params/define-schema.ts
4
+ /**
5
+ * Define the global segment param schema.
6
+ *
7
+ * Each key uses the bracket syntax from the filesystem (`[id]`, `[...slug]`,
8
+ * `[[...slug]]`) mapped to a codec. This makes the relationship between
9
+ * filesystem segments and codecs visually obvious.
10
+ *
11
+ * A dynamic segment with no key here defaults to `string` at codegen time.
12
+ *
13
+ * ```ts
14
+ * // app/schema.ts
15
+ * import { defineSchema } from '@timber-js/app/params';
16
+ * import { codec } from '@timber-js/app/codec';
17
+ * import { z } from 'zod';
18
+ *
19
+ * export default defineSchema({
20
+ * segmentParams: {
21
+ * '[artistSlug]': codec.string,
22
+ * '[year]': codec.integer,
23
+ * '[id]': z.coerce.number().int(),
24
+ * },
25
+ * });
26
+ * ```
27
+ */
28
+ function defineSchema(config) {
29
+ return config;
30
+ }
31
+ //#endregion
4
32
  export { defineSchema, getLinkCodec, resolveSchemaCodecs, setLinkCodecs, toBracketKey };
33
+
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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 } from '../codec.js';\nimport type { StandardSchemaV1 } from '../schema-bridge.js';\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. */\ntype SegmentParamCodec = Codec<unknown> | StandardSchemaV1<unknown>;\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<S extends Record<string, SegmentParamCodec>>(\n config: SchemaConfig<S>\n): SchemaConfig<S> {\n return config;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAoEA,SAAgB,aACd,QACiB;AACjB,QAAO"}
@@ -1,6 +1,6 @@
1
- import { i as isStandardSchema, n as fromSchema, r as isCodec } from "../_chunks/schema-bridge-o0SwFtXW.js";
2
- import { n as registerSearchParams, t as getSearchParamsDefinition } from "../_chunks/registry-D6-TmNLM.js";
3
- import { n as defineSearchParams } from "../_chunks/define-BY_dwMyV.js";
1
+ import { n as registerSearchParams, t as getSearchParamsDefinition } from "../_chunks/registry-Dp_hJL4s.js";
2
+ import { i as isStandardSchema, n as fromSchema, r as isCodec } from "../_chunks/schema-bridge-eL5vQDSA.js";
3
+ import { n as defineSearchParams } from "../_chunks/define-8zQ8Vm7x.js";
4
4
  //#region src/search-params/wrappers.ts
5
5
  /**
6
6
  * Wrap a nullable codec with a default value. When the inner codec returns
@@ -1,2 +1,2 @@
1
- import { r as defineSegmentParams } from "../_chunks/define-BlFkzZFs.js";
1
+ import { r as defineSegmentParams } from "../_chunks/define-zQX6e1tN.js";
2
2
  export { defineSegmentParams };
@@ -1,6 +1,6 @@
1
1
  import { a as getSpanId, d as withSpan, o as getTraceId, p as formFlashAls, t as addSpanEvent, v as isDebug, y as isDevMode } from "../_chunks/tracing-DvKLzCFa.js";
2
2
  import { t as formatSize } from "../_chunks/format-CR6v1pWE.js";
3
- import { D as getCookieJar, a as revalidateTag, b as getSegmentParams, c as DenySignal, f as deny, h as waitUntil, i as revalidatePath, l as RedirectSignal, m as redirectExternal, o as coerce, p as redirect, s as parseFormData, u as RedirectType, v as getHeaders } from "../_chunks/actions-DLijOcMe.js";
3
+ import { D as getCookieJar, a as revalidateTag, b as getSegmentParams, c as DenySignal, f as deny, h as waitUntil, i as revalidatePath, l as RedirectSignal, m as redirectExternal, o as coerce, p as redirect, s as parseFormData, u as RedirectType, v as getHeaders } from "../_chunks/actions-Cw-7NfJJ.js";
4
4
  //#region src/server/sensitive-fields.ts
5
5
  /**
6
6
  * Sensitive field stripping — removes password/token/CVV-style fields
@@ -3,10 +3,10 @@ import { a as warnRedirectInSuspense, c as warnSuspenseWrappingChildren, i as wa
3
3
  import { n as classifyUrlSegment } from "../_chunks/segment-classify-CnfLLvir.js";
4
4
  import { i as getMetadataRouteServePath, n as classifyMetadataRoute, r as getMetadataRouteAutoLink, t as METADATA_ROUTE_CONVENTIONS } from "../_chunks/metadata-routes-Cjmvi3rQ.js";
5
5
  import { a as logProxyError, c as logRequestReceived, d as logSwrRefetchFailed, f as logWaitUntilRejected, h as swallow, i as logMiddlewareShortCircuit, l as logRouteError, m as setLogger, n as logCacheMiss, o as logRenderError, p as logWaitUntilUnsupported, r as logMiddlewareError, s as logRequestCompleted, t as getLogger, u as logSlowRequest } from "../_chunks/logger-DDmK5skc.js";
6
- import { C as setMatchedSegmentPath, E as getCookie, O as getSetCookieHeaders, S as runWithRequestContext, T as setSegmentParams, _ as getHeader, b as getSegmentParams, c as DenySignal, d as RenderError, g as applyRequestHeaderOverlay, l as RedirectSignal, n as executeAction, o as coerce, r as isRscActionRequest, t as buildNoJsResponse, w as setMutableCookieContext, x as markResponseFlushed, y as getSearchParams } from "../_chunks/actions-DLijOcMe.js";
6
+ import { C as setMatchedSegmentPath, E as getCookie, O as getSetCookieHeaders, S as runWithRequestContext, T as setSegmentParams, _ as getHeader, b as getSegmentParams, c as DenySignal, d as RenderError, g as applyRequestHeaderOverlay, l as RedirectSignal, n as executeAction, o as coerce, r as isRscActionRequest, t as buildNoJsResponse, w as setMutableCookieContext, x as markResponseFlushed, y as getSearchParams } from "../_chunks/actions-Cw-7NfJJ.js";
7
7
  import "../client/error-boundary.js";
8
- import { n as toBracketKey } from "../_chunks/resolve-schema-BxtenpoR.js";
9
- import "../_chunks/segment-context-BnxoPSFQ.js";
8
+ import { n as toBracketKey } from "../_chunks/resolve-schema-23Mc8aLi.js";
9
+ import "../_chunks/segment-context-Bg0pFbLT.js";
10
10
  import { readFile } from "node:fs/promises";
11
11
  import { createElement } from "react";
12
12
  //#region src/server/server-timing.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timber-js/app",
3
- "version": "0.2.0-alpha.119",
3
+ "version": "0.2.0-alpha.120",
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",
@@ -114,11 +114,6 @@
114
114
  "publishConfig": {
115
115
  "access": "public"
116
116
  },
117
- "scripts": {
118
- "build": "vite build --config vite.lib.config.ts && tsc --emitDeclarationOnly --project tsconfig.json --outDir dist",
119
- "typecheck": "tsgo --noEmit",
120
- "prepublishOnly": "pnpm run build"
121
- },
122
117
  "dependencies": {
123
118
  "@opentelemetry/api": "^1.9.1",
124
119
  "@opentelemetry/context-async-hooks": "^2.6.1",
@@ -162,5 +157,9 @@
162
157
  },
163
158
  "engines": {
164
159
  "node": ">=22.12.0"
160
+ },
161
+ "scripts": {
162
+ "build": "vite build --config vite.lib.config.ts && tsc --emitDeclarationOnly --project tsconfig.json --outDir dist",
163
+ "typecheck": "tsgo --noEmit"
165
164
  }
166
- }
165
+ }
@@ -71,7 +71,8 @@ export function findSchemaFile(appDir: string): string | undefined {
71
71
  */
72
72
  function generateNewSchema(segments: string[]): string {
73
73
  const lines: string[] = [];
74
- lines.push("import { defineSchema, codec } from '@timber-js/app';");
74
+ lines.push("import { defineSchema } from '@timber-js/app/params';");
75
+ lines.push("import { codec } from '@timber-js/app/codec';");
75
76
  lines.push('');
76
77
  lines.push('export default defineSchema({');
77
78
  lines.push(' segmentParams: {');
package/src/cli.ts CHANGED
File without changes
package/src/codec.ts CHANGED
@@ -40,11 +40,11 @@ export type JsonSerializable =
40
40
  // ─── Standard Schema bridge ──────────────────────────────────────────────
41
41
 
42
42
  export {
43
- fromSchema,
43
+ // fromSchema,
44
44
  fromArraySchema,
45
- validateSync,
46
- isStandardSchema,
47
- isCodec,
45
+ // validateSync,
46
+ // isStandardSchema,
47
+ // isCodec,
48
48
  } from './schema-bridge.js';
49
49
  export type { StandardSchemaV1, StandardSchemaResult } from './schema-bridge.js';
50
50
 
package/src/index.ts CHANGED
@@ -51,14 +51,6 @@ import {
51
51
 
52
52
  export type { TimberUserConfig } from './config-types.js';
53
53
 
54
- // Global segment param schema — re-exported from root for convenience.
55
- // See design/41-global-params.md.
56
- export { defineSchema } from './params/define-schema.js';
57
- export type { InferCodecType, SchemaConfig } from './params/define-schema.js';
58
-
59
- // Built-in codecs for segment params.
60
- export { codec } from './codec.js';
61
-
62
54
  // Metadata route handler types — re-exported so user-authored metadata
63
55
  // route files (sitemap.ts, robots.ts, manifest.ts, icon.tsx, etc.) can
64
56
  // import them from the package root without reaching into ./server.
@@ -117,7 +109,7 @@ export function defineConfig(config: TimberUserConfig): TimberUserConfig {
117
109
  */
118
110
  function resolveReactCompilerPlugin(
119
111
  config: true | { compilationMode?: string; target?: string },
120
- req: NodeRequire
112
+ req: NodeJS.Require
121
113
  ): PluginOption {
122
114
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
123
115
  let babel: any;
@@ -53,7 +53,8 @@ export interface SchemaConfig<S extends Record<string, SegmentParamCodec>> {
53
53
  *
54
54
  * ```ts
55
55
  * // app/schema.ts
56
- * import { defineSchema, codec } from '@timber-js/app';
56
+ * import { defineSchema } from '@timber-js/app/params';
57
+ * import { codec } from '@timber-js/app/codec';
57
58
  * import { z } from 'zod';
58
59
  *
59
60
  * export default defineSchema({
@@ -1,2 +0,0 @@
1
- import { i as runSchemaSync } from "./cli-schema-sync-DFZmnmqG.js";
2
- export { runSchemaSync };
@@ -1,31 +0,0 @@
1
- //#region src/params/define-schema.ts
2
- /**
3
- * Define the global segment param schema.
4
- *
5
- * Each key uses the bracket syntax from the filesystem (`[id]`, `[...slug]`,
6
- * `[[...slug]]`) mapped to a codec. This makes the relationship between
7
- * filesystem segments and codecs visually obvious.
8
- *
9
- * A dynamic segment with no key here defaults to `string` at codegen time.
10
- *
11
- * ```ts
12
- * // app/schema.ts
13
- * import { defineSchema, codec } from '@timber-js/app';
14
- * import { z } from 'zod';
15
- *
16
- * export default defineSchema({
17
- * segmentParams: {
18
- * '[artistSlug]': codec.string,
19
- * '[year]': codec.integer,
20
- * '[id]': z.coerce.number().int(),
21
- * },
22
- * });
23
- * ```
24
- */
25
- function defineSchema(config) {
26
- return config;
27
- }
28
- //#endregion
29
- export { defineSchema as t };
30
-
31
- //# sourceMappingURL=define-schema-CfEb8LSg.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"define-schema-CfEb8LSg.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 } from '../codec.js';\nimport type { StandardSchemaV1 } from '../schema-bridge.js';\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. */\ntype SegmentParamCodec = Codec<unknown> | StandardSchemaV1<unknown>;\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, codec } from '@timber-js/app';\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<S extends Record<string, SegmentParamCodec>>(\n config: SchemaConfig<S>\n): SchemaConfig<S> {\n return config;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAmEA,SAAgB,aACd,QACiB;AACjB,QAAO"}