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

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 (67) hide show
  1. package/dist/_chunks/{actions-Cw-7NfJJ.js → actions-DLijOcMe.js} +6 -6
  2. package/dist/_chunks/{actions-Cw-7NfJJ.js.map → actions-DLijOcMe.js.map} +1 -1
  3. package/dist/_chunks/{build-output-helper-DhxiT18k.js → build-output-helper-B226qcTe.js} +1 -1
  4. package/dist/_chunks/{build-output-helper-DhxiT18k.js.map → build-output-helper-B226qcTe.js.map} +1 -1
  5. package/dist/_chunks/{codec-registry-V7ARyeLN.js → codec-registry-TNqK8N99.js} +1 -1
  6. package/dist/_chunks/{codec-registry-V7ARyeLN.js.map → codec-registry-TNqK8N99.js.map} +1 -1
  7. package/dist/_chunks/{define-8zQ8Vm7x.js → define-BY_dwMyV.js} +3 -3
  8. package/dist/_chunks/{define-8zQ8Vm7x.js.map → define-BY_dwMyV.js.map} +1 -1
  9. package/dist/_chunks/{define-zQX6e1tN.js → define-BlFkzZFs.js} +3 -3
  10. package/dist/_chunks/{define-zQX6e1tN.js.map → define-BlFkzZFs.js.map} +1 -1
  11. package/dist/_chunks/define-schema-CfEb8LSg.js +31 -0
  12. package/dist/_chunks/define-schema-CfEb8LSg.js.map +1 -0
  13. package/dist/_chunks/{handler-store-iqnt2ghN.js → handler-store-bIAstrxQ.js} +1 -1
  14. package/dist/_chunks/{handler-store-iqnt2ghN.js.map → handler-store-bIAstrxQ.js.map} +1 -1
  15. package/dist/_chunks/{merge-search-params-CwxJzBLS.js → merge-search-params-Cm1j99HC.js} +1 -1
  16. package/dist/_chunks/{merge-search-params-CwxJzBLS.js.map → merge-search-params-Cm1j99HC.js.map} +1 -1
  17. package/dist/_chunks/{navigation-root-DKsJ5Di7.js → navigation-root-CPKTmf-y.js} +2 -2
  18. package/dist/_chunks/{navigation-root-DKsJ5Di7.js.map → navigation-root-CPKTmf-y.js.map} +1 -1
  19. package/dist/_chunks/{registry-Dp_hJL4s.js → registry-D6-TmNLM.js} +1 -1
  20. package/dist/_chunks/{registry-Dp_hJL4s.js.map → registry-D6-TmNLM.js.map} +1 -1
  21. package/dist/_chunks/{resolve-schema-23Mc8aLi.js → resolve-schema-BxtenpoR.js} +2 -2
  22. package/dist/_chunks/{resolve-schema-23Mc8aLi.js.map → resolve-schema-BxtenpoR.js.map} +1 -1
  23. package/dist/_chunks/{router-ref-sektkr-t.js → router-ref-115GHAhP.js} +2 -2
  24. package/dist/_chunks/{router-ref-sektkr-t.js.map → router-ref-115GHAhP.js.map} +1 -1
  25. package/dist/_chunks/{schema-bridge-eL5vQDSA.js → schema-bridge-o0SwFtXW.js} +1 -1
  26. package/dist/_chunks/{schema-bridge-eL5vQDSA.js.map → schema-bridge-o0SwFtXW.js.map} +1 -1
  27. package/dist/_chunks/{segment-context-Bg0pFbLT.js → segment-context-BnxoPSFQ.js} +1 -1
  28. package/dist/_chunks/{segment-context-Bg0pFbLT.js.map → segment-context-BnxoPSFQ.js.map} +1 -1
  29. package/dist/_chunks/{ssr-data-BO5OvEvg.js → ssr-data-BP5-JJTi.js} +1 -1
  30. package/dist/_chunks/{ssr-data-BO5OvEvg.js.map → ssr-data-BP5-JJTi.js.map} +1 -1
  31. package/dist/_chunks/{stale-reload-BCPRG0Cv.js → stale-reload-DZ_GjtPz.js} +1 -1
  32. package/dist/_chunks/{stale-reload-BCPRG0Cv.js.map → stale-reload-DZ_GjtPz.js.map} +1 -1
  33. package/dist/_chunks/{use-query-states-D9SBlAfp.js → use-query-states-C0tklghY.js} +2 -2
  34. package/dist/_chunks/{use-query-states-D9SBlAfp.js.map → use-query-states-C0tklghY.js.map} +1 -1
  35. package/dist/_chunks/{use-segment-params-CskiK-59.js → use-segment-params-6W0l-wqA.js} +2 -2
  36. package/dist/_chunks/{use-segment-params-CskiK-59.js.map → use-segment-params-6W0l-wqA.js.map} +1 -1
  37. package/dist/_chunks/{validation-Bm3Je-09.js → validation-AfEFM5ze.js} +1 -1
  38. package/dist/_chunks/{validation-Bm3Je-09.js.map → validation-AfEFM5ze.js.map} +1 -1
  39. package/dist/adapters/cloudflare.js +1 -1
  40. package/dist/adapters/nitro.js +1 -1
  41. package/dist/cache/index.js +1 -1
  42. package/dist/client/error-boundary.js +2 -2
  43. package/dist/client/index.js +9 -9
  44. package/dist/client/internal.js +7 -7
  45. package/dist/codec.d.ts +19 -1
  46. package/dist/codec.d.ts.map +1 -1
  47. package/dist/codec.js +46 -2
  48. package/dist/codec.js.map +1 -0
  49. package/dist/cookies/index.js +3 -3
  50. package/dist/index.d.ts +2 -0
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.js +3 -1
  53. package/dist/index.js.map +1 -1
  54. package/dist/params/index.js +3 -32
  55. package/dist/search-params/index.js +3 -3
  56. package/dist/segment-params/index.js +1 -1
  57. package/dist/server/index.d.ts +1 -0
  58. package/dist/server/index.d.ts.map +1 -1
  59. package/dist/server/index.js +2 -2
  60. package/dist/server/internal.js +3 -3
  61. package/package.json +7 -6
  62. package/src/cli.ts +0 -0
  63. package/src/codec.ts +55 -3
  64. package/src/index.ts +5 -2
  65. package/src/server/index.ts +2 -3
  66. package/LICENSE +0 -8
  67. package/dist/params/index.js.map +0 -1
@@ -1,33 +1,4 @@
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, codec } from '@timber-js/app';
16
- * import { z } from 'zod';
17
- *
18
- * export default defineSchema({
19
- * segmentParams: {
20
- * '[artistSlug]': codec.string,
21
- * '[year]': codec.integer,
22
- * '[id]': z.coerce.number().int(),
23
- * },
24
- * });
25
- * ```
26
- */
27
- function defineSchema(config) {
28
- return config;
29
- }
30
- //#endregion
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";
31
4
  export { defineSchema, getLinkCodec, resolveSchemaCodecs, setLinkCodecs, toBracketKey };
32
-
33
- //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
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";
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";
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-zQX6e1tN.js";
1
+ import { r as defineSegmentParams } from "../_chunks/define-BlFkzZFs.js";
2
2
  export { defineSegmentParams };
@@ -10,6 +10,7 @@ export { deny, redirect, redirectExternal, RedirectType, waitUntil, type DenyOpt
10
10
  export type { RenderErrorDigest, WaitUntilAdapter } from './primitives';
11
11
  export { createActionClient, ActionError, validated } from './action-client';
12
12
  export type { ActionResult, ActionFn, ActionBuilder, ActionBuilderWithSchema, ActionContext, ActionMiddleware, ActionSchema, ValidationErrors, } from './action-client';
13
+ export { coerce, parseFormData } from './form-data';
13
14
  export { getFormFlash } from './form-flash';
14
15
  export type { FormFlashData } from './form-flash';
15
16
  export { revalidatePath, revalidateTag } from './actions';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAMA,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjD,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAKxF,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACjE,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAIzD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGxF,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,KAAK,WAAW,EAChB,KAAK,eAAe,GACrB,MAAM,cAAc,CAAC;AAItB,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAKxE,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC7E,YAAY,EACV,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAOzB,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAI1D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAI1E,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAMA,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjD,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAKxF,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACjE,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAIzD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGxF,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,KAAK,WAAW,EAChB,KAAK,eAAe,GACrB,MAAM,cAAc,CAAC;AAItB,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAKxE,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC7E,YAAY,EACV,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGpD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAI1D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAI1E,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC"}
@@ -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, p as redirect, s as parseFormData, u as RedirectType, v as getHeaders } from "../_chunks/actions-Cw-7NfJJ.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";
4
4
  //#region src/server/sensitive-fields.ts
5
5
  /**
6
6
  * Sensitive field stripping — removes password/token/CVV-style fields
@@ -445,6 +445,6 @@ function getFormFlash() {
445
445
  return formFlashAls.getStore() ?? null;
446
446
  }
447
447
  //#endregion
448
- export { ActionError, RedirectType, addSpanEvent, createActionClient, deny, getCookieJar, getFormFlash, getHeaders, getSegmentParams, getSpanId, getTraceId, redirect, redirectExternal, revalidatePath, revalidateTag, validated, waitUntil, withSpan };
448
+ export { ActionError, RedirectType, addSpanEvent, coerce, createActionClient, deny, getCookieJar, getFormFlash, getHeaders, getSegmentParams, getSpanId, getTraceId, parseFormData, redirect, redirectExternal, revalidatePath, revalidateTag, validated, waitUntil, withSpan };
449
449
 
450
450
  //# sourceMappingURL=index.js.map
@@ -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-Cw-7NfJJ.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";
7
7
  import "../client/error-boundary.js";
8
- import { n as toBracketKey } from "../_chunks/resolve-schema-23Mc8aLi.js";
9
- import "../_chunks/segment-context-Bg0pFbLT.js";
8
+ import { n as toBracketKey } from "../_chunks/resolve-schema-BxtenpoR.js";
9
+ import "../_chunks/segment-context-BnxoPSFQ.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.118",
3
+ "version": "0.2.0-alpha.119",
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,6 +114,11 @@
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
+ },
117
122
  "dependencies": {
118
123
  "@opentelemetry/api": "^1.9.1",
119
124
  "@opentelemetry/context-async-hooks": "^2.6.1",
@@ -157,9 +162,5 @@
157
162
  },
158
163
  "engines": {
159
164
  "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"
164
165
  }
165
- }
166
+ }
package/src/cli.ts CHANGED
File without changes
package/src/codec.ts CHANGED
@@ -39,7 +39,59 @@ export type JsonSerializable =
39
39
 
40
40
  // ─── Standard Schema bridge ──────────────────────────────────────────────
41
41
 
42
- // fromSchema is internal — defineSearchParams and defineCookie auto-detect
43
- // Standard Schema objects. Users should pass raw schemas directly.
44
- export { fromArraySchema, validateSync, isStandardSchema, isCodec } from './schema-bridge.js';
42
+ export {
43
+ fromSchema,
44
+ fromArraySchema,
45
+ validateSync,
46
+ isStandardSchema,
47
+ isCodec,
48
+ } from './schema-bridge.js';
45
49
  export type { StandardSchemaV1, StandardSchemaResult } from './schema-bridge.js';
50
+
51
+ // ─── Built-in segment param codecs ───────────────────────────────────────
52
+
53
+ export const codec = {
54
+ string: {
55
+ parse(value: string | string[] | undefined): string {
56
+ return Array.isArray(value) ? value.join('/') : (value ?? '');
57
+ },
58
+ serialize(value: string): string | null {
59
+ return value;
60
+ },
61
+ } satisfies Codec<string>,
62
+
63
+ integer: {
64
+ parse(value: string | string[] | undefined): number {
65
+ const str = Array.isArray(value) ? value[0] : value;
66
+ const n = Number(str);
67
+ if (!Number.isInteger(n)) throw new Error(`Expected integer, got '${str}'`);
68
+ return n;
69
+ },
70
+ serialize(value: number): string | null {
71
+ return String(value);
72
+ },
73
+ } satisfies Codec<number>,
74
+
75
+ slug: {
76
+ parse(value: string | string[] | undefined): string {
77
+ const str = Array.isArray(value) ? value[0] : value;
78
+ if (!str || !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(str)) {
79
+ throw new Error(`Invalid slug: '${str}'`);
80
+ }
81
+ return str;
82
+ },
83
+ serialize(value: string): string | null {
84
+ return value;
85
+ },
86
+ } satisfies Codec<string>,
87
+
88
+ stringArray: {
89
+ parse(value: string | string[] | undefined): string[] {
90
+ if (Array.isArray(value)) return value;
91
+ return value ? [value] : [];
92
+ },
93
+ serialize(value: string[]): string | null {
94
+ return value.join('/');
95
+ },
96
+ } satisfies Codec<string[]>,
97
+ } as const;
package/src/index.ts CHANGED
@@ -51,11 +51,14 @@ import {
51
51
 
52
52
  export type { TimberUserConfig } from './config-types.js';
53
53
 
54
- // Global segment param schema types — re-exported from root for convenience.
55
- // The value export `defineSchema` lives at '@timber-js/app/params' (canonical).
54
+ // Global segment param schema — re-exported from root for convenience.
56
55
  // See design/41-global-params.md.
56
+ export { defineSchema } from './params/define-schema.js';
57
57
  export type { InferCodecType, SchemaConfig } from './params/define-schema.js';
58
58
 
59
+ // Built-in codecs for segment params.
60
+ export { codec } from './codec.js';
61
+
59
62
  // Metadata route handler types — re-exported so user-authored metadata
60
63
  // route files (sitemap.ts, robots.ts, manifest.ts, icon.tsx, etc.) can
61
64
  // import them from the package root without reaching into ./server.
@@ -50,9 +50,8 @@ export type {
50
50
  ValidationErrors,
51
51
  } from './action-client';
52
52
 
53
- // FormData Preprocessing — internal only, not part of public API.
54
- // Schema libraries (Zod z.coerce.*, Valibot v.transform(), ArkType morphs)
55
- // handle form coercion. Kept for action-client/action-handler internals.
53
+ // FormData Preprocessing
54
+ export { coerce, parseFormData } from './form-data';
56
55
 
57
56
  // Form Flash (no-JS error round-trip)
58
57
  export { getFormFlash } from './form-flash';
package/LICENSE DELETED
@@ -1,8 +0,0 @@
1
- DONTFUCKINGUSE LICENSE
2
-
3
- Copyright (c) 2025 Daniel Saewitz
4
-
5
- This software may not be used, copied, modified, merged, published,
6
- distributed, sublicensed, or sold by anyone other than the copyright holder.
7
-
8
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
@@ -1 +0,0 @@
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, 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"}