attaform 0.20.2 → 0.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/dev-key-collision-warnings.cjs +58 -0
- package/dist/chunks/dev-key-collision-warnings.cjs.map +1 -0
- package/dist/chunks/dev-key-collision-warnings.mjs +55 -0
- package/dist/chunks/dev-key-collision-warnings.mjs.map +1 -0
- package/dist/chunks/devtools.cjs +1 -1
- package/dist/chunks/devtools.mjs +1 -1
- package/dist/chunks/fingerprint.cjs +186 -0
- package/dist/chunks/fingerprint.cjs.map +1 -0
- package/dist/chunks/fingerprint.mjs +184 -0
- package/dist/chunks/fingerprint.mjs.map +1 -0
- package/dist/chunks/fingerprint2.cjs +162 -0
- package/dist/chunks/fingerprint2.cjs.map +1 -0
- package/dist/chunks/fingerprint2.mjs +160 -0
- package/dist/chunks/fingerprint2.mjs.map +1 -0
- package/dist/chunks/indexeddb.cjs +1 -1
- package/dist/chunks/indexeddb.mjs +1 -1
- package/dist/chunks/local-storage.cjs +1 -1
- package/dist/chunks/local-storage.mjs +1 -1
- package/dist/chunks/multi-tab-sync.cjs +367 -0
- package/dist/chunks/multi-tab-sync.cjs.map +1 -0
- package/dist/chunks/multi-tab-sync.mjs +364 -0
- package/dist/chunks/multi-tab-sync.mjs.map +1 -0
- package/dist/chunks/session-storage.cjs +1 -1
- package/dist/chunks/session-storage.mjs +1 -1
- package/dist/chunks/wire-persistence.cjs +396 -0
- package/dist/chunks/wire-persistence.cjs.map +1 -0
- package/dist/chunks/wire-persistence.mjs +394 -0
- package/dist/chunks/wire-persistence.mjs.map +1 -0
- package/dist/esbuild.cjs +28 -0
- package/dist/esbuild.cjs.map +1 -0
- package/dist/esbuild.d.cts +56 -0
- package/dist/esbuild.d.mts +56 -0
- package/dist/esbuild.d.ts +56 -0
- package/dist/esbuild.mjs +26 -0
- package/dist/esbuild.mjs.map +1 -0
- package/dist/index.cjs +5 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +66 -70
- package/dist/index.d.mts +66 -70
- package/dist/index.d.ts +66 -70
- package/dist/index.mjs +5 -5
- package/dist/nuxt.d.cts +1 -1
- package/dist/nuxt.d.mts +1 -1
- package/dist/nuxt.d.ts +1 -1
- package/dist/rollup.cjs +24 -0
- package/dist/rollup.cjs.map +1 -0
- package/dist/rollup.d.cts +35 -0
- package/dist/rollup.d.mts +35 -0
- package/dist/rollup.d.ts +35 -0
- package/dist/rollup.mjs +22 -0
- package/dist/rollup.mjs.map +1 -0
- package/dist/rspack.cjs +10 -0
- package/dist/rspack.cjs.map +1 -0
- package/dist/rspack.d.cts +40 -0
- package/dist/rspack.d.mts +40 -0
- package/dist/rspack.d.ts +40 -0
- package/dist/rspack.mjs +8 -0
- package/dist/rspack.mjs.map +1 -0
- package/dist/runtime/plugins/attaform.cjs +2 -2
- package/dist/runtime/plugins/attaform.mjs +2 -2
- package/dist/shared/attaform.BJGA_UOS.mjs +37 -0
- package/dist/shared/attaform.BJGA_UOS.mjs.map +1 -0
- package/dist/shared/attaform.BRGIpZo4.cjs +26 -0
- package/dist/shared/attaform.BRGIpZo4.cjs.map +1 -0
- package/dist/shared/{attaform.DAKrGhxc.cjs → attaform.BSkvn43g.cjs} +101 -417
- package/dist/shared/attaform.BSkvn43g.cjs.map +1 -0
- package/dist/shared/{attaform.sWm8B15V.d.mts → attaform.BWfliRIK.d.cts} +172 -2
- package/dist/shared/{attaform.BGk8cfw2.mjs → attaform.Be8NZG9M.mjs} +178 -21
- package/dist/shared/attaform.Be8NZG9M.mjs.map +1 -0
- package/dist/shared/{attaform.D2SCCd4O.cjs → attaform.Bq5sX7TF.cjs} +2 -2
- package/dist/shared/{attaform.D2SCCd4O.cjs.map → attaform.Bq5sX7TF.cjs.map} +1 -1
- package/dist/shared/{attaform.ceGEAEMk.d.ts → attaform.Bv7dRDWK.d.ts} +172 -2
- package/dist/shared/attaform.C3Doa9Pt.mjs +24 -0
- package/dist/shared/attaform.C3Doa9Pt.mjs.map +1 -0
- package/dist/shared/{attaform.B_hph5AE.cjs → attaform.CICFZ1iS.cjs} +178 -20
- package/dist/shared/attaform.CICFZ1iS.cjs.map +1 -0
- package/dist/shared/attaform.CQN9R62B.cjs +39 -0
- package/dist/shared/attaform.CQN9R62B.cjs.map +1 -0
- package/dist/shared/{attaform.CwLjUqmQ.cjs → attaform.ClXwitZj.cjs} +735 -960
- package/dist/shared/attaform.ClXwitZj.cjs.map +1 -0
- package/dist/shared/{attaform.99cfHcIt.d.cts → attaform.D0dWZsJt.d.cts} +349 -77
- package/dist/shared/{attaform.99cfHcIt.d.mts → attaform.D0dWZsJt.d.mts} +349 -77
- package/dist/shared/{attaform.99cfHcIt.d.ts → attaform.D0dWZsJt.d.ts} +349 -77
- package/dist/shared/{attaform.z5j3LwJz.cjs → attaform.D32WwKk6.cjs} +216 -35
- package/dist/shared/attaform.D32WwKk6.cjs.map +1 -0
- package/dist/shared/{attaform.C5aYC_T8.mjs → attaform.DMEP_ENr.mjs} +39 -392
- package/dist/shared/attaform.DMEP_ENr.mjs.map +1 -0
- package/dist/shared/{attaform.tiWEVznj.mjs → attaform.DR6RmxWZ.mjs} +725 -962
- package/dist/shared/attaform.DR6RmxWZ.mjs.map +1 -0
- package/dist/shared/{attaform.Dt7dEcHk.mjs → attaform.DozgVlCE.mjs} +89 -405
- package/dist/shared/attaform.DozgVlCE.mjs.map +1 -0
- package/dist/shared/{attaform.DN5CvZrg.d.ts → attaform.Duecg2NO.d.mts} +2 -2
- package/dist/shared/attaform.DuzQYscR.d.cts +41 -0
- package/dist/shared/attaform.DuzQYscR.d.mts +41 -0
- package/dist/shared/attaform.DuzQYscR.d.ts +41 -0
- package/dist/shared/{attaform.BXinSW2T.d.mts → attaform.FudOcHaa.d.cts} +2 -2
- package/dist/shared/attaform.LEWUFqUw.cjs +54 -0
- package/dist/shared/attaform.LEWUFqUw.cjs.map +1 -0
- package/dist/shared/{attaform.CywE4y8x.d.cts → attaform.MtrpT6Ki.d.ts} +2 -2
- package/dist/shared/{attaform.DbRgDFa7.d.cts → attaform.NQ8mybyW.d.mts} +172 -2
- package/dist/shared/{attaform.Cd4AOfwu.cjs → attaform.S-pYLSo4.cjs} +68 -402
- package/dist/shared/attaform.S-pYLSo4.cjs.map +1 -0
- package/dist/shared/{attaform.CnrxbkB6.mjs → attaform.Y1ZGhM4k.mjs} +2 -2
- package/dist/shared/{attaform.CnrxbkB6.mjs.map → attaform.Y1ZGhM4k.mjs.map} +1 -1
- package/dist/shared/{attaform.QG5TG8lB.mjs → attaform.pmtahXKy.mjs} +216 -36
- package/dist/shared/attaform.pmtahXKy.mjs.map +1 -0
- package/dist/shared/attaform.sHkHv_98.mjs +51 -0
- package/dist/shared/attaform.sHkHv_98.mjs.map +1 -0
- package/dist/vite.cjs +9 -45
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.d.cts +36 -0
- package/dist/vite.d.mts +36 -0
- package/dist/vite.d.ts +36 -0
- package/dist/vite.mjs +8 -44
- package/dist/vite.mjs.map +1 -1
- package/dist/webpack.cjs +10 -0
- package/dist/webpack.cjs.map +1 -0
- package/dist/webpack.d.cts +37 -0
- package/dist/webpack.d.mts +37 -0
- package/dist/webpack.d.ts +37 -0
- package/dist/webpack.mjs +8 -0
- package/dist/webpack.mjs.map +1 -0
- package/dist/zod-v3.cjs +3 -3
- package/dist/zod-v3.d.cts +3 -3
- package/dist/zod-v3.d.mts +3 -3
- package/dist/zod-v3.d.ts +3 -3
- package/dist/zod-v3.mjs +3 -3
- package/dist/zod-v4.cjs +3 -3
- package/dist/zod-v4.d.cts +4 -4
- package/dist/zod-v4.d.mts +4 -4
- package/dist/zod-v4.d.ts +4 -4
- package/dist/zod-v4.mjs +3 -3
- package/dist/zod.cjs +8 -8
- package/dist/zod.cjs.map +1 -1
- package/dist/zod.d.cts +52 -10
- package/dist/zod.d.mts +52 -10
- package/dist/zod.d.ts +52 -10
- package/dist/zod.mjs +6 -6
- package/dist/zod.mjs.map +1 -1
- package/package.json +19 -5
- package/dist/shared/attaform.BGk8cfw2.mjs.map +0 -1
- package/dist/shared/attaform.B_hph5AE.cjs.map +0 -1
- package/dist/shared/attaform.C5aYC_T8.mjs.map +0 -1
- package/dist/shared/attaform.Cd4AOfwu.cjs.map +0 -1
- package/dist/shared/attaform.CwLjUqmQ.cjs.map +0 -1
- package/dist/shared/attaform.DAKrGhxc.cjs.map +0 -1
- package/dist/shared/attaform.Dt7dEcHk.mjs.map +0 -1
- package/dist/shared/attaform.QG5TG8lB.mjs.map +0 -1
- package/dist/shared/attaform.tiWEVznj.mjs.map +0 -1
- package/dist/shared/attaform.z5j3LwJz.cjs.map +0 -1
package/dist/zod.d.cts
CHANGED
|
@@ -1,12 +1,52 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { S as StorageShape } from './shared/attaform.
|
|
3
|
-
export { P as PathInput, a as PathOutput } from './shared/attaform.
|
|
2
|
+
import { S as StorageShape } from './shared/attaform.FudOcHaa.cjs';
|
|
3
|
+
export { P as PathInput, a as PathOutput } from './shared/attaform.FudOcHaa.cjs';
|
|
4
4
|
import { U as UnwrapZodObject, S as StorageShape$1 } from './shared/attaform.DSD85fHb.cjs';
|
|
5
|
-
import {
|
|
6
|
-
export {
|
|
7
|
-
export { A as AnyForm, a as AttaformErrorCode, C as CompiledStep, F as FormStatus, I as InjectWizardInput, L as LazyMarker, d as StepSlot, U as UseRegisterReturn, e as UseWizardReturnType, W as WizardAggregateError, f as WizardCtx, g as WizardCtxForm, h as WizardOnError, i as WizardOnSubmit, j as WizardOptions, k as WizardPersistFn, l as WizardRestoreFn, m as WizardRestoreState, n as WizardStatusesProxy, o as WizardSubmitContext, t as injectForm, u as injectWizard, w as lazy, x as useRegister, z as useWizard } from './shared/attaform.
|
|
5
|
+
import { v as FormKey, al as UseFormConfiguration, G as GenericForm, A as AbstractSchema, j as DefaultValuesInput, ao as ValidateOnConfig, am as UseFormReturnType, F as FieldMetaPayload } from './shared/attaform.D0dWZsJt.cjs';
|
|
6
|
+
export { ak as Unset, ax as isUnset, az as unset } from './shared/attaform.D0dWZsJt.cjs';
|
|
7
|
+
export { A as AnyForm, a as AttaformErrorCode, C as CompiledStep, F as FormStatus, I as InjectWizardInput, L as LazyMarker, d as StepSlot, U as UseRegisterReturn, e as UseWizardReturnType, W as WizardAggregateError, f as WizardCtx, g as WizardCtxForm, h as WizardOnError, i as WizardOnSubmit, j as WizardOptions, k as WizardPersistFn, l as WizardRestoreFn, m as WizardRestoreState, n as WizardStatusesProxy, o as WizardSubmitContext, t as injectForm, u as injectWizard, w as lazy, x as useRegister, z as useWizard } from './shared/attaform.BWfliRIK.cjs';
|
|
8
8
|
import 'vue';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Type-level Zod-major discriminator for the unified `attaform/zod`
|
|
12
|
+
* entry. The runtime dispatch (`use-form.ts`'s impl) already routes on
|
|
13
|
+
* the schema's shape via `isZodV4SchemaShape`; this is the type-level
|
|
14
|
+
* mirror so the overloads and projection helpers discriminate the same
|
|
15
|
+
* way.
|
|
16
|
+
*
|
|
17
|
+
* Why a structural marker instead of `z.ZodObject`: the unified entry's
|
|
18
|
+
* overloads constrain on `z.ZodObject`, but the published `.d.mts`
|
|
19
|
+
* resolves `z` against whichever single Zod major the consumer
|
|
20
|
+
* installed. In a v3-only install `z.ZodObject` is v3's `ZodObject`
|
|
21
|
+
* (and, lacking its required type arguments, degrades to an `any`-like
|
|
22
|
+
* error type under `skipLibCheck`), so a v3 schema satisfies the v4
|
|
23
|
+
* overload's constraint and binds it — collapsing the read slot to
|
|
24
|
+
* `never`. A Zod v4 schema carries the `_zod` internals brand; a v3
|
|
25
|
+
* schema never does.
|
|
26
|
+
* Intersecting a v4-only constraint or conditional branch with this
|
|
27
|
+
* marker keeps it unreachable for a v3 schema regardless of how `zod`
|
|
28
|
+
* resolves, so v3 schemas fall through to the v3 overload.
|
|
29
|
+
*
|
|
30
|
+
* Distinct from `core/zod-shape.ts`'s runtime `ZodV4Shape` (which reads
|
|
31
|
+
* the public `def` getter): at the type level the stable v4 brand is
|
|
32
|
+
* `_zod.def`, the same internals `StorageShape` (v4) already reads.
|
|
33
|
+
*
|
|
34
|
+
* Pairing requirement: a v4 overload/branch must constrain on
|
|
35
|
+
* `z.ZodObject<z.ZodRawShape> & ZodV4Internals`, NOT bare
|
|
36
|
+
* `z.ZodObject & ZodV4Internals`. In a v3-only install `z.ZodObject`
|
|
37
|
+
* with no type argument is `ZodObject<T, ...>` missing its required
|
|
38
|
+
* arguments — an error type that behaves like `any` under
|
|
39
|
+
* `skipLibCheck`, so `any & ZodV4Internals` collapses back to `any` and
|
|
40
|
+
* the marker stops excluding v3 schemas. Supplying `z.ZodRawShape`
|
|
41
|
+
* keeps it a concrete object type in both majors, so the intersection
|
|
42
|
+
* stays meaningful.
|
|
43
|
+
*/
|
|
44
|
+
type ZodV4Internals = {
|
|
45
|
+
_zod: {
|
|
46
|
+
def: unknown;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
10
50
|
/**
|
|
11
51
|
* Unified `useForm` for the `attaform/zod` entry. Runtime-dispatches
|
|
12
52
|
* on schema shape: a Zod v4 schema (`def.type` truthy) routes to the
|
|
@@ -62,10 +102,12 @@ type V3ReadOf$1<S extends z.ZodObject<z.ZodRawShape>> = StorageShape$1<UnwrapZod
|
|
|
62
102
|
* })
|
|
63
103
|
* ```
|
|
64
104
|
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
105
|
+
* The constraint intersects `ZodV4Internals` (the v4-only `_zod`
|
|
106
|
+
* brand) so a v3 schema can't bind this overload even when `z`
|
|
107
|
+
* resolves to v3 in a single-major consumer install; v3 schemas fall
|
|
108
|
+
* through to the v3 overload below. See `types-zod-major.ts`.
|
|
67
109
|
*/
|
|
68
|
-
declare function useForm<Schema extends z.ZodObject, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<V4FormOf$1<Schema>, V4OutOf$1<Schema>, AbstractSchema<V4FormOf$1<Schema>, V4OutOf$1<Schema>>, DefaultValuesInput<V4FormOf$1<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
110
|
+
declare function useForm<Schema extends z.ZodObject<z.ZodRawShape> & ZodV4Internals, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<V4FormOf$1<Schema>, V4OutOf$1<Schema>, AbstractSchema<V4FormOf$1<Schema>, V4OutOf$1<Schema>>, DefaultValuesInput<V4FormOf$1<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
69
111
|
schema: Schema;
|
|
70
112
|
} & ValidateOnConfig): UseFormReturnType<V4FormOf$1<Schema>, V4OutOf$1<Schema>, V4ReadOf$1<Schema>, K>;
|
|
71
113
|
/**
|
|
@@ -152,13 +194,13 @@ type UseFormConfigV3<Schema extends z.ZodObject<z.ZodRawShape>, K extends FormKe
|
|
|
152
194
|
* this helper stays deferred and TS can't prove return-type
|
|
153
195
|
* compatibility.
|
|
154
196
|
*/
|
|
155
|
-
type UseFormReturn<Schema, K extends FormKey = FormKey> = Schema extends z.ZodObject ? UseFormReturnType<V4FormOf<Schema>, V4OutOf<Schema>, V4ReadOf<Schema>, K> : Schema extends z.ZodObject<z.ZodRawShape> ? UseFormReturnType<V3FormOf<Schema>, V3OutOf<Schema>, V3ReadOf<Schema>, K> : never;
|
|
197
|
+
type UseFormReturn<Schema, K extends FormKey = FormKey> = Schema extends z.ZodObject<z.ZodRawShape> & ZodV4Internals ? UseFormReturnType<V4FormOf<Schema>, V4OutOf<Schema>, V4ReadOf<Schema>, K> : Schema extends z.ZodObject<z.ZodRawShape> ? UseFormReturnType<V3FormOf<Schema>, V3OutOf<Schema>, V3ReadOf<Schema>, K> : never;
|
|
156
198
|
/**
|
|
157
199
|
* The configuration parameter shape of `useForm` for a given Zod
|
|
158
200
|
* schema. Mirrors `UseFormReturn`'s dispatch — replaces
|
|
159
201
|
* `Parameters<typeof useForm<Schema, K>>[0]` in test code.
|
|
160
202
|
*/
|
|
161
|
-
type UseFormConfig<Schema, K extends FormKey = FormKey> = Schema extends z.ZodObject ? Omit<UseFormConfiguration<V4FormOf<Schema>, V4OutOf<Schema>, AbstractSchema<V4FormOf<Schema>, V4OutOf<Schema>>, DefaultValuesInput<V4FormOf<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
203
|
+
type UseFormConfig<Schema, K extends FormKey = FormKey> = Schema extends z.ZodObject<z.ZodRawShape> & ZodV4Internals ? Omit<UseFormConfiguration<V4FormOf<Schema>, V4OutOf<Schema>, AbstractSchema<V4FormOf<Schema>, V4OutOf<Schema>>, DefaultValuesInput<V4FormOf<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
162
204
|
schema: Schema;
|
|
163
205
|
} & ValidateOnConfig : Schema extends z.ZodObject<z.ZodRawShape> ? Omit<UseFormConfiguration<V3FormOf<Schema>, V3OutOf<Schema>, AbstractSchema<V3FormOf<Schema>, V3OutOf<Schema>>, DefaultValuesInput<V3FormOf<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
164
206
|
schema: Schema;
|
package/dist/zod.d.mts
CHANGED
|
@@ -1,12 +1,52 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { S as StorageShape } from './shared/attaform.
|
|
3
|
-
export { P as PathInput, a as PathOutput } from './shared/attaform.
|
|
2
|
+
import { S as StorageShape } from './shared/attaform.Duecg2NO.mjs';
|
|
3
|
+
export { P as PathInput, a as PathOutput } from './shared/attaform.Duecg2NO.mjs';
|
|
4
4
|
import { U as UnwrapZodObject, S as StorageShape$1 } from './shared/attaform.DSD85fHb.mjs';
|
|
5
|
-
import {
|
|
6
|
-
export {
|
|
7
|
-
export { A as AnyForm, a as AttaformErrorCode, C as CompiledStep, F as FormStatus, I as InjectWizardInput, L as LazyMarker, d as StepSlot, U as UseRegisterReturn, e as UseWizardReturnType, W as WizardAggregateError, f as WizardCtx, g as WizardCtxForm, h as WizardOnError, i as WizardOnSubmit, j as WizardOptions, k as WizardPersistFn, l as WizardRestoreFn, m as WizardRestoreState, n as WizardStatusesProxy, o as WizardSubmitContext, t as injectForm, u as injectWizard, w as lazy, x as useRegister, z as useWizard } from './shared/attaform.
|
|
5
|
+
import { v as FormKey, al as UseFormConfiguration, G as GenericForm, A as AbstractSchema, j as DefaultValuesInput, ao as ValidateOnConfig, am as UseFormReturnType, F as FieldMetaPayload } from './shared/attaform.D0dWZsJt.mjs';
|
|
6
|
+
export { ak as Unset, ax as isUnset, az as unset } from './shared/attaform.D0dWZsJt.mjs';
|
|
7
|
+
export { A as AnyForm, a as AttaformErrorCode, C as CompiledStep, F as FormStatus, I as InjectWizardInput, L as LazyMarker, d as StepSlot, U as UseRegisterReturn, e as UseWizardReturnType, W as WizardAggregateError, f as WizardCtx, g as WizardCtxForm, h as WizardOnError, i as WizardOnSubmit, j as WizardOptions, k as WizardPersistFn, l as WizardRestoreFn, m as WizardRestoreState, n as WizardStatusesProxy, o as WizardSubmitContext, t as injectForm, u as injectWizard, w as lazy, x as useRegister, z as useWizard } from './shared/attaform.NQ8mybyW.mjs';
|
|
8
8
|
import 'vue';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Type-level Zod-major discriminator for the unified `attaform/zod`
|
|
12
|
+
* entry. The runtime dispatch (`use-form.ts`'s impl) already routes on
|
|
13
|
+
* the schema's shape via `isZodV4SchemaShape`; this is the type-level
|
|
14
|
+
* mirror so the overloads and projection helpers discriminate the same
|
|
15
|
+
* way.
|
|
16
|
+
*
|
|
17
|
+
* Why a structural marker instead of `z.ZodObject`: the unified entry's
|
|
18
|
+
* overloads constrain on `z.ZodObject`, but the published `.d.mts`
|
|
19
|
+
* resolves `z` against whichever single Zod major the consumer
|
|
20
|
+
* installed. In a v3-only install `z.ZodObject` is v3's `ZodObject`
|
|
21
|
+
* (and, lacking its required type arguments, degrades to an `any`-like
|
|
22
|
+
* error type under `skipLibCheck`), so a v3 schema satisfies the v4
|
|
23
|
+
* overload's constraint and binds it — collapsing the read slot to
|
|
24
|
+
* `never`. A Zod v4 schema carries the `_zod` internals brand; a v3
|
|
25
|
+
* schema never does.
|
|
26
|
+
* Intersecting a v4-only constraint or conditional branch with this
|
|
27
|
+
* marker keeps it unreachable for a v3 schema regardless of how `zod`
|
|
28
|
+
* resolves, so v3 schemas fall through to the v3 overload.
|
|
29
|
+
*
|
|
30
|
+
* Distinct from `core/zod-shape.ts`'s runtime `ZodV4Shape` (which reads
|
|
31
|
+
* the public `def` getter): at the type level the stable v4 brand is
|
|
32
|
+
* `_zod.def`, the same internals `StorageShape` (v4) already reads.
|
|
33
|
+
*
|
|
34
|
+
* Pairing requirement: a v4 overload/branch must constrain on
|
|
35
|
+
* `z.ZodObject<z.ZodRawShape> & ZodV4Internals`, NOT bare
|
|
36
|
+
* `z.ZodObject & ZodV4Internals`. In a v3-only install `z.ZodObject`
|
|
37
|
+
* with no type argument is `ZodObject<T, ...>` missing its required
|
|
38
|
+
* arguments — an error type that behaves like `any` under
|
|
39
|
+
* `skipLibCheck`, so `any & ZodV4Internals` collapses back to `any` and
|
|
40
|
+
* the marker stops excluding v3 schemas. Supplying `z.ZodRawShape`
|
|
41
|
+
* keeps it a concrete object type in both majors, so the intersection
|
|
42
|
+
* stays meaningful.
|
|
43
|
+
*/
|
|
44
|
+
type ZodV4Internals = {
|
|
45
|
+
_zod: {
|
|
46
|
+
def: unknown;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
10
50
|
/**
|
|
11
51
|
* Unified `useForm` for the `attaform/zod` entry. Runtime-dispatches
|
|
12
52
|
* on schema shape: a Zod v4 schema (`def.type` truthy) routes to the
|
|
@@ -62,10 +102,12 @@ type V3ReadOf$1<S extends z.ZodObject<z.ZodRawShape>> = StorageShape$1<UnwrapZod
|
|
|
62
102
|
* })
|
|
63
103
|
* ```
|
|
64
104
|
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
105
|
+
* The constraint intersects `ZodV4Internals` (the v4-only `_zod`
|
|
106
|
+
* brand) so a v3 schema can't bind this overload even when `z`
|
|
107
|
+
* resolves to v3 in a single-major consumer install; v3 schemas fall
|
|
108
|
+
* through to the v3 overload below. See `types-zod-major.ts`.
|
|
67
109
|
*/
|
|
68
|
-
declare function useForm<Schema extends z.ZodObject, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<V4FormOf$1<Schema>, V4OutOf$1<Schema>, AbstractSchema<V4FormOf$1<Schema>, V4OutOf$1<Schema>>, DefaultValuesInput<V4FormOf$1<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
110
|
+
declare function useForm<Schema extends z.ZodObject<z.ZodRawShape> & ZodV4Internals, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<V4FormOf$1<Schema>, V4OutOf$1<Schema>, AbstractSchema<V4FormOf$1<Schema>, V4OutOf$1<Schema>>, DefaultValuesInput<V4FormOf$1<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
69
111
|
schema: Schema;
|
|
70
112
|
} & ValidateOnConfig): UseFormReturnType<V4FormOf$1<Schema>, V4OutOf$1<Schema>, V4ReadOf$1<Schema>, K>;
|
|
71
113
|
/**
|
|
@@ -152,13 +194,13 @@ type UseFormConfigV3<Schema extends z.ZodObject<z.ZodRawShape>, K extends FormKe
|
|
|
152
194
|
* this helper stays deferred and TS can't prove return-type
|
|
153
195
|
* compatibility.
|
|
154
196
|
*/
|
|
155
|
-
type UseFormReturn<Schema, K extends FormKey = FormKey> = Schema extends z.ZodObject ? UseFormReturnType<V4FormOf<Schema>, V4OutOf<Schema>, V4ReadOf<Schema>, K> : Schema extends z.ZodObject<z.ZodRawShape> ? UseFormReturnType<V3FormOf<Schema>, V3OutOf<Schema>, V3ReadOf<Schema>, K> : never;
|
|
197
|
+
type UseFormReturn<Schema, K extends FormKey = FormKey> = Schema extends z.ZodObject<z.ZodRawShape> & ZodV4Internals ? UseFormReturnType<V4FormOf<Schema>, V4OutOf<Schema>, V4ReadOf<Schema>, K> : Schema extends z.ZodObject<z.ZodRawShape> ? UseFormReturnType<V3FormOf<Schema>, V3OutOf<Schema>, V3ReadOf<Schema>, K> : never;
|
|
156
198
|
/**
|
|
157
199
|
* The configuration parameter shape of `useForm` for a given Zod
|
|
158
200
|
* schema. Mirrors `UseFormReturn`'s dispatch — replaces
|
|
159
201
|
* `Parameters<typeof useForm<Schema, K>>[0]` in test code.
|
|
160
202
|
*/
|
|
161
|
-
type UseFormConfig<Schema, K extends FormKey = FormKey> = Schema extends z.ZodObject ? Omit<UseFormConfiguration<V4FormOf<Schema>, V4OutOf<Schema>, AbstractSchema<V4FormOf<Schema>, V4OutOf<Schema>>, DefaultValuesInput<V4FormOf<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
203
|
+
type UseFormConfig<Schema, K extends FormKey = FormKey> = Schema extends z.ZodObject<z.ZodRawShape> & ZodV4Internals ? Omit<UseFormConfiguration<V4FormOf<Schema>, V4OutOf<Schema>, AbstractSchema<V4FormOf<Schema>, V4OutOf<Schema>>, DefaultValuesInput<V4FormOf<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
162
204
|
schema: Schema;
|
|
163
205
|
} & ValidateOnConfig : Schema extends z.ZodObject<z.ZodRawShape> ? Omit<UseFormConfiguration<V3FormOf<Schema>, V3OutOf<Schema>, AbstractSchema<V3FormOf<Schema>, V3OutOf<Schema>>, DefaultValuesInput<V3FormOf<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
164
206
|
schema: Schema;
|
package/dist/zod.d.ts
CHANGED
|
@@ -1,12 +1,52 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { S as StorageShape } from './shared/attaform.
|
|
3
|
-
export { P as PathInput, a as PathOutput } from './shared/attaform.
|
|
2
|
+
import { S as StorageShape } from './shared/attaform.MtrpT6Ki.js';
|
|
3
|
+
export { P as PathInput, a as PathOutput } from './shared/attaform.MtrpT6Ki.js';
|
|
4
4
|
import { U as UnwrapZodObject, S as StorageShape$1 } from './shared/attaform.DSD85fHb.js';
|
|
5
|
-
import {
|
|
6
|
-
export {
|
|
7
|
-
export { A as AnyForm, a as AttaformErrorCode, C as CompiledStep, F as FormStatus, I as InjectWizardInput, L as LazyMarker, d as StepSlot, U as UseRegisterReturn, e as UseWizardReturnType, W as WizardAggregateError, f as WizardCtx, g as WizardCtxForm, h as WizardOnError, i as WizardOnSubmit, j as WizardOptions, k as WizardPersistFn, l as WizardRestoreFn, m as WizardRestoreState, n as WizardStatusesProxy, o as WizardSubmitContext, t as injectForm, u as injectWizard, w as lazy, x as useRegister, z as useWizard } from './shared/attaform.
|
|
5
|
+
import { v as FormKey, al as UseFormConfiguration, G as GenericForm, A as AbstractSchema, j as DefaultValuesInput, ao as ValidateOnConfig, am as UseFormReturnType, F as FieldMetaPayload } from './shared/attaform.D0dWZsJt.js';
|
|
6
|
+
export { ak as Unset, ax as isUnset, az as unset } from './shared/attaform.D0dWZsJt.js';
|
|
7
|
+
export { A as AnyForm, a as AttaformErrorCode, C as CompiledStep, F as FormStatus, I as InjectWizardInput, L as LazyMarker, d as StepSlot, U as UseRegisterReturn, e as UseWizardReturnType, W as WizardAggregateError, f as WizardCtx, g as WizardCtxForm, h as WizardOnError, i as WizardOnSubmit, j as WizardOptions, k as WizardPersistFn, l as WizardRestoreFn, m as WizardRestoreState, n as WizardStatusesProxy, o as WizardSubmitContext, t as injectForm, u as injectWizard, w as lazy, x as useRegister, z as useWizard } from './shared/attaform.Bv7dRDWK.js';
|
|
8
8
|
import 'vue';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Type-level Zod-major discriminator for the unified `attaform/zod`
|
|
12
|
+
* entry. The runtime dispatch (`use-form.ts`'s impl) already routes on
|
|
13
|
+
* the schema's shape via `isZodV4SchemaShape`; this is the type-level
|
|
14
|
+
* mirror so the overloads and projection helpers discriminate the same
|
|
15
|
+
* way.
|
|
16
|
+
*
|
|
17
|
+
* Why a structural marker instead of `z.ZodObject`: the unified entry's
|
|
18
|
+
* overloads constrain on `z.ZodObject`, but the published `.d.mts`
|
|
19
|
+
* resolves `z` against whichever single Zod major the consumer
|
|
20
|
+
* installed. In a v3-only install `z.ZodObject` is v3's `ZodObject`
|
|
21
|
+
* (and, lacking its required type arguments, degrades to an `any`-like
|
|
22
|
+
* error type under `skipLibCheck`), so a v3 schema satisfies the v4
|
|
23
|
+
* overload's constraint and binds it — collapsing the read slot to
|
|
24
|
+
* `never`. A Zod v4 schema carries the `_zod` internals brand; a v3
|
|
25
|
+
* schema never does.
|
|
26
|
+
* Intersecting a v4-only constraint or conditional branch with this
|
|
27
|
+
* marker keeps it unreachable for a v3 schema regardless of how `zod`
|
|
28
|
+
* resolves, so v3 schemas fall through to the v3 overload.
|
|
29
|
+
*
|
|
30
|
+
* Distinct from `core/zod-shape.ts`'s runtime `ZodV4Shape` (which reads
|
|
31
|
+
* the public `def` getter): at the type level the stable v4 brand is
|
|
32
|
+
* `_zod.def`, the same internals `StorageShape` (v4) already reads.
|
|
33
|
+
*
|
|
34
|
+
* Pairing requirement: a v4 overload/branch must constrain on
|
|
35
|
+
* `z.ZodObject<z.ZodRawShape> & ZodV4Internals`, NOT bare
|
|
36
|
+
* `z.ZodObject & ZodV4Internals`. In a v3-only install `z.ZodObject`
|
|
37
|
+
* with no type argument is `ZodObject<T, ...>` missing its required
|
|
38
|
+
* arguments — an error type that behaves like `any` under
|
|
39
|
+
* `skipLibCheck`, so `any & ZodV4Internals` collapses back to `any` and
|
|
40
|
+
* the marker stops excluding v3 schemas. Supplying `z.ZodRawShape`
|
|
41
|
+
* keeps it a concrete object type in both majors, so the intersection
|
|
42
|
+
* stays meaningful.
|
|
43
|
+
*/
|
|
44
|
+
type ZodV4Internals = {
|
|
45
|
+
_zod: {
|
|
46
|
+
def: unknown;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
10
50
|
/**
|
|
11
51
|
* Unified `useForm` for the `attaform/zod` entry. Runtime-dispatches
|
|
12
52
|
* on schema shape: a Zod v4 schema (`def.type` truthy) routes to the
|
|
@@ -62,10 +102,12 @@ type V3ReadOf$1<S extends z.ZodObject<z.ZodRawShape>> = StorageShape$1<UnwrapZod
|
|
|
62
102
|
* })
|
|
63
103
|
* ```
|
|
64
104
|
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
105
|
+
* The constraint intersects `ZodV4Internals` (the v4-only `_zod`
|
|
106
|
+
* brand) so a v3 schema can't bind this overload even when `z`
|
|
107
|
+
* resolves to v3 in a single-major consumer install; v3 schemas fall
|
|
108
|
+
* through to the v3 overload below. See `types-zod-major.ts`.
|
|
67
109
|
*/
|
|
68
|
-
declare function useForm<Schema extends z.ZodObject, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<V4FormOf$1<Schema>, V4OutOf$1<Schema>, AbstractSchema<V4FormOf$1<Schema>, V4OutOf$1<Schema>>, DefaultValuesInput<V4FormOf$1<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
110
|
+
declare function useForm<Schema extends z.ZodObject<z.ZodRawShape> & ZodV4Internals, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<V4FormOf$1<Schema>, V4OutOf$1<Schema>, AbstractSchema<V4FormOf$1<Schema>, V4OutOf$1<Schema>>, DefaultValuesInput<V4FormOf$1<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
69
111
|
schema: Schema;
|
|
70
112
|
} & ValidateOnConfig): UseFormReturnType<V4FormOf$1<Schema>, V4OutOf$1<Schema>, V4ReadOf$1<Schema>, K>;
|
|
71
113
|
/**
|
|
@@ -152,13 +194,13 @@ type UseFormConfigV3<Schema extends z.ZodObject<z.ZodRawShape>, K extends FormKe
|
|
|
152
194
|
* this helper stays deferred and TS can't prove return-type
|
|
153
195
|
* compatibility.
|
|
154
196
|
*/
|
|
155
|
-
type UseFormReturn<Schema, K extends FormKey = FormKey> = Schema extends z.ZodObject ? UseFormReturnType<V4FormOf<Schema>, V4OutOf<Schema>, V4ReadOf<Schema>, K> : Schema extends z.ZodObject<z.ZodRawShape> ? UseFormReturnType<V3FormOf<Schema>, V3OutOf<Schema>, V3ReadOf<Schema>, K> : never;
|
|
197
|
+
type UseFormReturn<Schema, K extends FormKey = FormKey> = Schema extends z.ZodObject<z.ZodRawShape> & ZodV4Internals ? UseFormReturnType<V4FormOf<Schema>, V4OutOf<Schema>, V4ReadOf<Schema>, K> : Schema extends z.ZodObject<z.ZodRawShape> ? UseFormReturnType<V3FormOf<Schema>, V3OutOf<Schema>, V3ReadOf<Schema>, K> : never;
|
|
156
198
|
/**
|
|
157
199
|
* The configuration parameter shape of `useForm` for a given Zod
|
|
158
200
|
* schema. Mirrors `UseFormReturn`'s dispatch — replaces
|
|
159
201
|
* `Parameters<typeof useForm<Schema, K>>[0]` in test code.
|
|
160
202
|
*/
|
|
161
|
-
type UseFormConfig<Schema, K extends FormKey = FormKey> = Schema extends z.ZodObject ? Omit<UseFormConfiguration<V4FormOf<Schema>, V4OutOf<Schema>, AbstractSchema<V4FormOf<Schema>, V4OutOf<Schema>>, DefaultValuesInput<V4FormOf<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
203
|
+
type UseFormConfig<Schema, K extends FormKey = FormKey> = Schema extends z.ZodObject<z.ZodRawShape> & ZodV4Internals ? Omit<UseFormConfiguration<V4FormOf<Schema>, V4OutOf<Schema>, AbstractSchema<V4FormOf<Schema>, V4OutOf<Schema>>, DefaultValuesInput<V4FormOf<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
162
204
|
schema: Schema;
|
|
163
205
|
} & ValidateOnConfig : Schema extends z.ZodObject<z.ZodRawShape> ? Omit<UseFormConfiguration<V3FormOf<Schema>, V3OutOf<Schema>, AbstractSchema<V3FormOf<Schema>, V3OutOf<Schema>>, DefaultValuesInput<V3FormOf<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
164
206
|
schema: Schema;
|
package/dist/zod.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { d as InvalidUseFormConfigError } from './shared/attaform.
|
|
2
|
-
export {
|
|
3
|
-
import { u as useForm$2 } from './shared/attaform.
|
|
4
|
-
import {
|
|
5
|
-
import { f as fieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform.
|
|
6
|
-
export { A as AttaformErrorCode,
|
|
1
|
+
import { d as InvalidUseFormConfigError } from './shared/attaform.pmtahXKy.mjs';
|
|
2
|
+
export { J as useRegister } from './shared/attaform.pmtahXKy.mjs';
|
|
3
|
+
import { u as useForm$2 } from './shared/attaform.DozgVlCE.mjs';
|
|
4
|
+
import { w as useForm$1 } from './shared/attaform.DMEP_ENr.mjs';
|
|
5
|
+
import { f as fieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform.Be8NZG9M.mjs';
|
|
6
|
+
export { A as AttaformErrorCode, k as injectForm, l as injectWizard, n as isUnset, o as lazy, z as unset, C as useWizard } from './shared/attaform.DR6RmxWZ.mjs';
|
|
7
7
|
|
|
8
8
|
function isZodV4SchemaShape(value) {
|
|
9
9
|
if (typeof value !== "object" || value === null) return false;
|
package/dist/zod.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.mjs","sources":["../src/runtime/core/zod-shape.ts","../src/runtime/adapters/unified/use-form.ts","../src/runtime/adapters/unified/field-meta.ts"],"sourcesContent":["/**\n * Shape detectors for Zod schemas. Used by the unified `attaform/zod`\n * entry's runtime dispatch (`runtime/adapters/unified/use-form.ts`)\n * to route to the v3 or v4 adapter based on the schema's runtime\n * shape. Mirrors the discrimination already used by the v4\n * introspection helper (`adapters/zod-v4/introspect.ts`'s\n * `assertZodVersion`, which reads `def.type`) and the v3 wrapper's\n * legitimate-input branch (`composables/use-form.ts`'s `isZodType`,\n * which reads `_def`).\n *\n * Why this discriminator and not `_zod` / `_def`:\n * - Zod v4 retained `_def` for backward compat — reading `_def` alone\n * misclassifies v4 schemas as v3.\n * - Zod v4's stable shape is `def.type: string` (lowercase tag like\n * `'object'`); Zod v3's is `_def.typeName: string` (capitalised tag\n * like `'ZodObject'`). Both are checked structurally so consumers\n * who alias one Zod major to a non-standard import path still work.\n */\n\ninterface ZodV4Shape {\n def: { type: unknown }\n}\n\ninterface ZodV3Shape {\n _def: { typeName: unknown }\n}\n\n/**\n * Returns true when `value` looks like a Zod schema of either major\n * version. Convenience wrapper around the v3 / v4 detectors.\n */\nexport function isZodSchemaShape(value: unknown): boolean {\n return isZodV4SchemaShape(value) || isZodV3SchemaShape(value)\n}\n\n/**\n * Returns true when `value` looks like a Zod v4 schema (has\n * `def.type: string`). Used by the unified entry's runtime-dispatch\n * to route to the v4 adapter.\n */\nexport function isZodV4SchemaShape(value: unknown): value is ZodV4Shape {\n if (typeof value !== 'object' || value === null) return false\n const def = (value as { def?: unknown }).def\n if (typeof def !== 'object' || def === null) return false\n return typeof (def as { type?: unknown }).type === 'string'\n}\n\n/**\n * Returns true when `value` looks like a Zod v3 schema (has\n * `_def.typeName: string`). Kept distinct from `isZodV4SchemaShape`\n * because some v4 schemas also expose `_def` for backward compat —\n * the v4 detector wins first in `isZodSchemaShape`.\n */\nexport function isZodV3SchemaShape(value: unknown): value is ZodV3Shape {\n if (typeof value !== 'object' || value === null) return false\n const def = (value as { _def?: unknown })._def\n if (typeof def !== 'object' || def === null) return false\n return typeof (def as { typeName?: unknown }).typeName === 'string'\n}\n","/**\n * Unified `useForm` for the `attaform/zod` entry. Runtime-dispatches\n * on schema shape: a Zod v4 schema (`def.type` truthy) routes to the\n * v4 adapter; a Zod v3 schema (or any other `AbstractSchema`) routes\n * to the v3 wrapper, which already accepts both Zod v3 input and\n * `AbstractSchema` directly via its built-in shape branch.\n *\n * Type-level dispatch happens via TWO typed overloads — v4 first, v3\n * second — plus an untyped impl. Each overload mirrors the matching\n * direct adapter's signature exactly, so a v4-schema call site pays\n * the same per-call depth cost as importing from `attaform/zod-v4`\n * directly. Overload resolution at concrete call sites commits to one\n * overload immediately on argument shape — no type-level dispatch tax.\n *\n * Tests and other call sites that need the equivalent of\n * `typeof useForm<X>` should reach for the `UseFormReturn<X>` /\n * `UseFormConfig<X>` helpers in `types-api.ts` — instantiation\n * expressions on overloaded functions follow brittle resolution rules,\n * and the helper types give a deterministic projection.\n *\n * This module is the FALLBACK path. Vite consumers see the\n * `attaform/vite` plugin's `resolveId` hook rewrite `attaform/zod`\n * imports to either `attaform/zod-v3` or `attaform/zod-v4` at build\n * time — in that case this dispatch never runs and the consumer\n * bundle ships only the matching adapter. Other bundlers (and\n * non-bundled ESM consumption) hit this dispatch instead, paying a\n * modest size cost for the convenience of a single hello-world import.\n *\n * Power users who want a guaranteed lean bundle on non-Vite tooling\n * can import directly from `attaform/zod-v3` or `attaform/zod-v4` —\n * those subpaths are never rewritten and never load the other\n * adapter.\n */\nimport type { z } from 'zod'\nimport type { z as zV3 } from 'zod-v3'\nimport { InvalidUseFormConfigError } from '../../core/errors'\nimport { isZodV4SchemaShape } from '../../core/zod-shape'\nimport { useForm as useFormV3 } from '../../composables/use-form'\nimport { useForm as useFormV4 } from '../zod-v4'\nimport type { StorageShape as StorageShapeV4 } from '../zod-v4/types-storage-shape'\nimport type { StorageShape as StorageShapeV3 } from '../zod-v3/types-storage-shape'\nimport type { UnwrapZodObject } from '../zod-v3/types-zod-adapter'\nimport type {\n AbstractSchema,\n FormKey,\n ValidateOnConfig,\n UseFormReturnType,\n UseFormConfiguration,\n} from '../../types/types-api'\nimport type { DefaultValuesInput, GenericForm } from '../../types/types-core'\n\n// ───────────────────────────────────────────────────────────────────\n// Per-major projection helpers. Each overload's constraint scopes the\n// Schema to one Zod major, so the projection is a direct read — no\n// dispatch in the type body. Mirrors the direct adapter shapes so the\n// unified entry pays the same per-call depth cost as a direct import.\n// ───────────────────────────────────────────────────────────────────\n\ntype V4FormOf<S extends z.ZodObject> = z.input<S> extends GenericForm ? z.input<S> : never\ntype V4OutOf<S extends z.ZodObject> = z.output<S> extends GenericForm ? z.output<S> : never\ntype V4ReadOf<S extends z.ZodObject> =\n StorageShapeV4<S> extends GenericForm ? StorageShapeV4<S> : never\n\ntype V3FormOf<S extends zV3.ZodObject<zV3.ZodRawShape>> =\n zV3.input<UnwrapZodObject<S>> extends GenericForm ? zV3.input<UnwrapZodObject<S>> : never\ntype V3OutOf<S extends zV3.ZodObject<zV3.ZodRawShape>> =\n zV3.output<UnwrapZodObject<S>> extends GenericForm ? zV3.output<UnwrapZodObject<S>> : never\ntype V3ReadOf<S extends zV3.ZodObject<zV3.ZodRawShape>> =\n StorageShapeV3<UnwrapZodObject<S>> extends GenericForm\n ? StorageShapeV3<UnwrapZodObject<S>>\n : never\n\n/**\n * Create a form bound to a Zod v4 schema.\n *\n * ```ts\n * import { useForm } from 'attaform/zod'\n * import { z } from 'zod'\n *\n * const form = useForm({\n * schema: z.object({\n * username: z.string().min(2, 'At least 2 characters'),\n * password: z.string().min(8, 'At least 8 characters'),\n * }),\n * })\n * ```\n *\n * v4 schemas match this overload first via their structural `def`\n * field. v3 schemas fall through to the v3 overload below.\n */\nexport function useForm<Schema extends z.ZodObject, K extends FormKey = FormKey>(\n configuration: Omit<\n UseFormConfiguration<\n V4FormOf<Schema>,\n V4OutOf<Schema>,\n AbstractSchema<V4FormOf<Schema>, V4OutOf<Schema>>,\n DefaultValuesInput<V4FormOf<Schema>>,\n K\n >,\n 'schema' | 'validateOn' | 'debounceMs'\n > & { schema: Schema } & ValidateOnConfig\n): UseFormReturnType<V4FormOf<Schema>, V4OutOf<Schema>, V4ReadOf<Schema>, K>\n/**\n * Create a form bound to a Zod v3 schema.\n *\n * ```ts\n * import { useForm } from 'attaform/zod'\n * import { z } from 'zod-v3'\n *\n * const form = useForm({\n * schema: z.object({\n * username: z.string().min(2, 'At least 2 characters'),\n * password: z.string().min(8, 'At least 8 characters'),\n * }),\n * })\n * ```\n *\n * v3 schemas match this overload; v4 schemas hit the v4 overload\n * above first and never reach here.\n */\nexport function useForm<Schema extends zV3.ZodObject<zV3.ZodRawShape>, K extends FormKey = FormKey>(\n configuration: Omit<\n UseFormConfiguration<\n V3FormOf<Schema>,\n V3OutOf<Schema>,\n AbstractSchema<V3FormOf<Schema>, V3OutOf<Schema>>,\n DefaultValuesInput<V3FormOf<Schema>>,\n K\n >,\n 'schema' | 'validateOn' | 'debounceMs'\n > & { schema: Schema } & ValidateOnConfig\n): UseFormReturnType<V3FormOf<Schema>, V3OutOf<Schema>, V3ReadOf<Schema>, K>\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function useForm(configuration: any): any {\n if (\n configuration === undefined ||\n configuration === null ||\n (configuration as { schema?: unknown }).schema === undefined\n ) {\n throw new InvalidUseFormConfigError()\n }\n const { schema } = configuration as { schema: unknown }\n if (isZodV4SchemaShape(schema)) {\n return useFormV4(configuration as Parameters<typeof useFormV4>[0])\n }\n return useFormV3(configuration as Parameters<typeof useFormV3>[0])\n}\n","/**\n * Field-metadata write/read API for the unified `attaform/zod` entry.\n *\n * Storage is shared with both adapters via `field-meta-store` — a\n * payload written here is visible to whichever adapter the unified\n * `useForm` dispatches to at runtime, regardless of Zod major. No\n * `zod` runtime import; the type-only `import type` is erased at\n * build, so `attaform/zod` carries no `z.registry` reference even\n * when consumed by a Zod 3 project without the Vite plugin alias.\n *\n * The native v4 chain `schema.register(fieldMeta, payload)` continues\n * to work — Zod 4's `.register()` only calls `.add(this, payload)`\n * structurally, satisfied by the shared store.\n */\nimport type { z } from 'zod'\nimport type { FieldMetaPayload } from '../../core/field-meta'\nimport { fieldMetaStore, getFieldMetaForSchema } from '../../core/field-meta-store'\n\n// Zod v4's `$ZodRegistry` class isn't surfaced under the `z` namespace\n// of the classic external entry, but `z.registry()` returns one — so\n// `ReturnType<typeof z.registry<T>>` resolves to the registry type\n// without needing a direct import. The `import type` keeps the\n// reference type-only; nothing about `z.registry` lands in the bundle.\ntype ZodFieldMetaRegistry = ReturnType<typeof z.registry<FieldMetaPayload>>\n\n/**\n * The shared registry every Attaform-aware Zod schema can register\n * field metadata against, regardless of major. Same instance the v3\n * and v4 adapter entries expose — write in one place, read from\n * any.\n *\n * Cast to Zod 4's `$ZodRegistry<FieldMetaPayload>` so the native\n * `schema.register(fieldMeta, payload)` chain type-checks for v4\n * users; the runtime call only needs `.add` structurally, which the\n * shared store provides.\n */\nexport const fieldMeta = fieldMetaStore as unknown as ZodFieldMetaRegistry\n\n/**\n * Attach `payload` to `schema` in the shared registry and return a\n * clone of `schema` so each call gets its own identity (the registry\n * keys on schema reference, so cloning prevents last-write-wins\n * collisions for sub-schemas reused at multiple paths).\n *\n * Works on both Zod 3 and Zod 4 schemas — branches on the runtime\n * shape of the schema:\n * - Zod 4 schemas expose a public `.clone()` method; we call it.\n * - Zod 3 schemas don't, so we reconstruct via\n * `new schema.constructor(schema._def)`.\n *\n * Both forms produce a fresh schema with the same effective\n * structure, so the registry slot is unique to this call site.\n */\nexport function withMeta<S>(schema: S, payload: FieldMetaPayload): S {\n const target = schema as object\n const existing = getFieldMetaForSchema(target) ?? {}\n const cloned = cloneSchema(schema)\n fieldMetaStore.add(cloned as object, { ...existing, ...payload })\n return cloned\n}\n\nfunction cloneSchema<S>(schema: S): S {\n const candidate = schema as { clone?: unknown; constructor: unknown; _def: unknown }\n if (typeof candidate.clone === 'function') {\n return (candidate.clone as () => S)()\n }\n // Zod 3 path: reconstruct via constructor + _def (no public\n // `.clone()` on v3).\n const Ctor = candidate.constructor as new (def: unknown) => S\n return new Ctor(candidate._def)\n}\n"],"names":["useFormV4","useFormV3"],"mappings":";;;;;;;AAwCO,SAAS,mBAAmB,KAAA,EAAqC;AACtE,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,KAAU,MAAM,OAAO,KAAA;AACxD,EAAA,MAAM,MAAO,KAAA,CAA4B,GAAA;AACzC,EAAA,IAAI,OAAO,GAAA,KAAQ,QAAA,IAAY,GAAA,KAAQ,MAAM,OAAO,KAAA;AACpD,EAAA,OAAO,OAAQ,IAA2B,IAAA,KAAS,QAAA;AACrD;;ACwFO,SAAS,QAAQ,aAAA,EAAyB;AAC/C,EAAA,IACE,kBAAkB,MAAA,IAClB,aAAA,KAAkB,IAAA,IACjB,aAAA,CAAuC,WAAW,MAAA,EACnD;AACA,IAAA,MAAM,IAAI,yBAAA,EAA0B;AAAA,EACtC;AACA,EAAA,MAAM,EAAE,QAAO,GAAI,aAAA;AACnB,EAAA,IAAI,kBAAA,CAAmB,MAAM,CAAA,EAAG;AAC9B,IAAA,OAAOA,UAAU,aAAgD,CAAA;AAAA,EACnE;AACA,EAAA,OAAOC,UAAU,aAAgD,CAAA;AACnE;;AC9GO,MAAM,SAAA,GAAY;AAiBlB,SAAS,QAAA,CAAY,QAAW,OAAA,EAA8B;AACnE,EAAA,MAAM,MAAA,GAAS,MAAA;AACf,EAAA,MAAM,QAAA,GAAW,qBAAA,CAAsB,MAAM,CAAA,IAAK,EAAC;AACnD,EAAA,MAAM,MAAA,GAAS,YAAY,MAAM,CAAA;AACjC,EAAA,cAAA,CAAe,IAAI,MAAA,EAAkB,EAAE,GAAG,QAAA,EAAU,GAAG,SAAS,CAAA;AAChE,EAAA,OAAO,MAAA;AACT;AAEA,SAAS,YAAe,MAAA,EAAc;AACpC,EAAA,MAAM,SAAA,GAAY,MAAA;AAClB,EAAA,IAAI,OAAO,SAAA,CAAU,KAAA,KAAU,UAAA,EAAY;AACzC,IAAA,OAAQ,UAAU,KAAA,EAAkB;AAAA,EACtC;AAGA,EAAA,MAAM,OAAO,SAAA,CAAU,WAAA;AACvB,EAAA,OAAO,IAAI,IAAA,CAAK,SAAA,CAAU,IAAI,CAAA;AAChC;;;;"}
|
|
1
|
+
{"version":3,"file":"zod.mjs","sources":["../src/runtime/core/zod-shape.ts","../src/runtime/adapters/unified/use-form.ts","../src/runtime/adapters/unified/field-meta.ts"],"sourcesContent":["/**\n * Shape detectors for Zod schemas. Used by the unified `attaform/zod`\n * entry's runtime dispatch (`runtime/adapters/unified/use-form.ts`)\n * to route to the v3 or v4 adapter based on the schema's runtime\n * shape. Mirrors the discrimination already used by the v4\n * introspection helper (`adapters/zod-v4/introspect.ts`'s\n * `assertZodVersion`, which reads `def.type`) and the v3 wrapper's\n * legitimate-input branch (`composables/use-form.ts`'s `isZodType`,\n * which reads `_def`).\n *\n * Why this discriminator and not `_zod` / `_def`:\n * - Zod v4 retained `_def` for backward compat — reading `_def` alone\n * misclassifies v4 schemas as v3.\n * - Zod v4's stable shape is `def.type: string` (lowercase tag like\n * `'object'`); Zod v3's is `_def.typeName: string` (capitalised tag\n * like `'ZodObject'`). Both are checked structurally so consumers\n * who alias one Zod major to a non-standard import path still work.\n */\n\ninterface ZodV4Shape {\n def: { type: unknown }\n}\n\ninterface ZodV3Shape {\n _def: { typeName: unknown }\n}\n\n/**\n * Returns true when `value` looks like a Zod schema of either major\n * version. Convenience wrapper around the v3 / v4 detectors.\n */\nexport function isZodSchemaShape(value: unknown): boolean {\n return isZodV4SchemaShape(value) || isZodV3SchemaShape(value)\n}\n\n/**\n * Returns true when `value` looks like a Zod v4 schema (has\n * `def.type: string`). Used by the unified entry's runtime-dispatch\n * to route to the v4 adapter.\n */\nexport function isZodV4SchemaShape(value: unknown): value is ZodV4Shape {\n if (typeof value !== 'object' || value === null) return false\n const def = (value as { def?: unknown }).def\n if (typeof def !== 'object' || def === null) return false\n return typeof (def as { type?: unknown }).type === 'string'\n}\n\n/**\n * Returns true when `value` looks like a Zod v3 schema (has\n * `_def.typeName: string`). Kept distinct from `isZodV4SchemaShape`\n * because some v4 schemas also expose `_def` for backward compat —\n * the v4 detector wins first in `isZodSchemaShape`.\n */\nexport function isZodV3SchemaShape(value: unknown): value is ZodV3Shape {\n if (typeof value !== 'object' || value === null) return false\n const def = (value as { _def?: unknown })._def\n if (typeof def !== 'object' || def === null) return false\n return typeof (def as { typeName?: unknown }).typeName === 'string'\n}\n","/**\n * Unified `useForm` for the `attaform/zod` entry. Runtime-dispatches\n * on schema shape: a Zod v4 schema (`def.type` truthy) routes to the\n * v4 adapter; a Zod v3 schema (or any other `AbstractSchema`) routes\n * to the v3 wrapper, which already accepts both Zod v3 input and\n * `AbstractSchema` directly via its built-in shape branch.\n *\n * Type-level dispatch happens via TWO typed overloads — v4 first, v3\n * second — plus an untyped impl. Each overload mirrors the matching\n * direct adapter's signature exactly, so a v4-schema call site pays\n * the same per-call depth cost as importing from `attaform/zod-v4`\n * directly. Overload resolution at concrete call sites commits to one\n * overload immediately on argument shape — no type-level dispatch tax.\n *\n * Tests and other call sites that need the equivalent of\n * `typeof useForm<X>` should reach for the `UseFormReturn<X>` /\n * `UseFormConfig<X>` helpers in `types-api.ts` — instantiation\n * expressions on overloaded functions follow brittle resolution rules,\n * and the helper types give a deterministic projection.\n *\n * This module is the FALLBACK path. Vite consumers see the\n * `attaform/vite` plugin's `resolveId` hook rewrite `attaform/zod`\n * imports to either `attaform/zod-v3` or `attaform/zod-v4` at build\n * time — in that case this dispatch never runs and the consumer\n * bundle ships only the matching adapter. Other bundlers (and\n * non-bundled ESM consumption) hit this dispatch instead, paying a\n * modest size cost for the convenience of a single hello-world import.\n *\n * Power users who want a guaranteed lean bundle on non-Vite tooling\n * can import directly from `attaform/zod-v3` or `attaform/zod-v4` —\n * those subpaths are never rewritten and never load the other\n * adapter.\n */\nimport type { z } from 'zod'\nimport type { z as zV3 } from 'zod-v3'\nimport { InvalidUseFormConfigError } from '../../core/errors'\nimport { isZodV4SchemaShape } from '../../core/zod-shape'\nimport type { ZodV4Internals } from './types-zod-major'\nimport { useForm as useFormV3 } from '../../composables/use-form'\nimport { useForm as useFormV4 } from '../zod-v4'\nimport type { StorageShape as StorageShapeV4 } from '../zod-v4/types-storage-shape'\nimport type { StorageShape as StorageShapeV3 } from '../zod-v3/types-storage-shape'\nimport type { UnwrapZodObject } from '../zod-v3/types-zod-adapter'\nimport type {\n AbstractSchema,\n FormKey,\n ValidateOnConfig,\n UseFormReturnType,\n UseFormConfiguration,\n} from '../../types/types-api'\nimport type { DefaultValuesInput, GenericForm } from '../../types/types-core'\n\n// ───────────────────────────────────────────────────────────────────\n// Per-major projection helpers. Each overload's constraint scopes the\n// Schema to one Zod major, so the projection is a direct read — no\n// dispatch in the type body. Mirrors the direct adapter shapes so the\n// unified entry pays the same per-call depth cost as a direct import.\n// ───────────────────────────────────────────────────────────────────\n\ntype V4FormOf<S extends z.ZodObject> = z.input<S> extends GenericForm ? z.input<S> : never\ntype V4OutOf<S extends z.ZodObject> = z.output<S> extends GenericForm ? z.output<S> : never\ntype V4ReadOf<S extends z.ZodObject> =\n StorageShapeV4<S> extends GenericForm ? StorageShapeV4<S> : never\n\ntype V3FormOf<S extends zV3.ZodObject<zV3.ZodRawShape>> =\n zV3.input<UnwrapZodObject<S>> extends GenericForm ? zV3.input<UnwrapZodObject<S>> : never\ntype V3OutOf<S extends zV3.ZodObject<zV3.ZodRawShape>> =\n zV3.output<UnwrapZodObject<S>> extends GenericForm ? zV3.output<UnwrapZodObject<S>> : never\ntype V3ReadOf<S extends zV3.ZodObject<zV3.ZodRawShape>> =\n StorageShapeV3<UnwrapZodObject<S>> extends GenericForm\n ? StorageShapeV3<UnwrapZodObject<S>>\n : never\n\n/**\n * Create a form bound to a Zod v4 schema.\n *\n * ```ts\n * import { useForm } from 'attaform/zod'\n * import { z } from 'zod'\n *\n * const form = useForm({\n * schema: z.object({\n * username: z.string().min(2, 'At least 2 characters'),\n * password: z.string().min(8, 'At least 8 characters'),\n * }),\n * })\n * ```\n *\n * The constraint intersects `ZodV4Internals` (the v4-only `_zod`\n * brand) so a v3 schema can't bind this overload even when `z`\n * resolves to v3 in a single-major consumer install; v3 schemas fall\n * through to the v3 overload below. See `types-zod-major.ts`.\n */\nexport function useForm<\n Schema extends z.ZodObject<z.ZodRawShape> & ZodV4Internals,\n K extends FormKey = FormKey,\n>(\n configuration: Omit<\n UseFormConfiguration<\n V4FormOf<Schema>,\n V4OutOf<Schema>,\n AbstractSchema<V4FormOf<Schema>, V4OutOf<Schema>>,\n DefaultValuesInput<V4FormOf<Schema>>,\n K\n >,\n 'schema' | 'validateOn' | 'debounceMs'\n > & { schema: Schema } & ValidateOnConfig\n): UseFormReturnType<V4FormOf<Schema>, V4OutOf<Schema>, V4ReadOf<Schema>, K>\n/**\n * Create a form bound to a Zod v3 schema.\n *\n * ```ts\n * import { useForm } from 'attaform/zod'\n * import { z } from 'zod-v3'\n *\n * const form = useForm({\n * schema: z.object({\n * username: z.string().min(2, 'At least 2 characters'),\n * password: z.string().min(8, 'At least 8 characters'),\n * }),\n * })\n * ```\n *\n * v3 schemas match this overload; v4 schemas hit the v4 overload\n * above first and never reach here.\n */\nexport function useForm<Schema extends zV3.ZodObject<zV3.ZodRawShape>, K extends FormKey = FormKey>(\n configuration: Omit<\n UseFormConfiguration<\n V3FormOf<Schema>,\n V3OutOf<Schema>,\n AbstractSchema<V3FormOf<Schema>, V3OutOf<Schema>>,\n DefaultValuesInput<V3FormOf<Schema>>,\n K\n >,\n 'schema' | 'validateOn' | 'debounceMs'\n > & { schema: Schema } & ValidateOnConfig\n): UseFormReturnType<V3FormOf<Schema>, V3OutOf<Schema>, V3ReadOf<Schema>, K>\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function useForm(configuration: any): any {\n if (\n configuration === undefined ||\n configuration === null ||\n (configuration as { schema?: unknown }).schema === undefined\n ) {\n throw new InvalidUseFormConfigError()\n }\n const { schema } = configuration as { schema: unknown }\n if (isZodV4SchemaShape(schema)) {\n return useFormV4(configuration as Parameters<typeof useFormV4>[0])\n }\n return useFormV3(configuration as Parameters<typeof useFormV3>[0])\n}\n","/**\n * Field-metadata write/read API for the unified `attaform/zod` entry.\n *\n * Storage is shared with both adapters via `field-meta-store` — a\n * payload written here is visible to whichever adapter the unified\n * `useForm` dispatches to at runtime, regardless of Zod major. No\n * `zod` runtime import; the type-only `import type` is erased at\n * build, so `attaform/zod` carries no `z.registry` reference even\n * when consumed by a Zod 3 project without the Vite plugin alias.\n *\n * The native v4 chain `schema.register(fieldMeta, payload)` continues\n * to work — Zod 4's `.register()` only calls `.add(this, payload)`\n * structurally, satisfied by the shared store.\n */\nimport type { z } from 'zod'\nimport type { FieldMetaPayload } from '../../core/field-meta'\nimport { fieldMetaStore, getFieldMetaForSchema } from '../../core/field-meta-store'\n\n// Zod v4's `$ZodRegistry` class isn't surfaced under the `z` namespace\n// of the classic external entry, but `z.registry()` returns one — so\n// `ReturnType<typeof z.registry<T>>` resolves to the registry type\n// without needing a direct import. The `import type` keeps the\n// reference type-only; nothing about `z.registry` lands in the bundle.\ntype ZodFieldMetaRegistry = ReturnType<typeof z.registry<FieldMetaPayload>>\n\n/**\n * The shared registry every Attaform-aware Zod schema can register\n * field metadata against, regardless of major. Same instance the v3\n * and v4 adapter entries expose — write in one place, read from\n * any.\n *\n * Cast to Zod 4's `$ZodRegistry<FieldMetaPayload>` so the native\n * `schema.register(fieldMeta, payload)` chain type-checks for v4\n * users; the runtime call only needs `.add` structurally, which the\n * shared store provides.\n */\nexport const fieldMeta = fieldMetaStore as unknown as ZodFieldMetaRegistry\n\n/**\n * Attach `payload` to `schema` in the shared registry and return a\n * clone of `schema` so each call gets its own identity (the registry\n * keys on schema reference, so cloning prevents last-write-wins\n * collisions for sub-schemas reused at multiple paths).\n *\n * Works on both Zod 3 and Zod 4 schemas — branches on the runtime\n * shape of the schema:\n * - Zod 4 schemas expose a public `.clone()` method; we call it.\n * - Zod 3 schemas don't, so we reconstruct via\n * `new schema.constructor(schema._def)`.\n *\n * Both forms produce a fresh schema with the same effective\n * structure, so the registry slot is unique to this call site.\n */\nexport function withMeta<S>(schema: S, payload: FieldMetaPayload): S {\n const target = schema as object\n const existing = getFieldMetaForSchema(target) ?? {}\n const cloned = cloneSchema(schema)\n fieldMetaStore.add(cloned as object, { ...existing, ...payload })\n return cloned\n}\n\nfunction cloneSchema<S>(schema: S): S {\n const candidate = schema as { clone?: unknown; constructor: unknown; _def: unknown }\n if (typeof candidate.clone === 'function') {\n return (candidate.clone as () => S)()\n }\n // Zod 3 path: reconstruct via constructor + _def (no public\n // `.clone()` on v3).\n const Ctor = candidate.constructor as new (def: unknown) => S\n return new Ctor(candidate._def)\n}\n"],"names":["useFormV4","useFormV3"],"mappings":";;;;;;;AAwCO,SAAS,mBAAmB,KAAA,EAAqC;AACtE,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,KAAU,MAAM,OAAO,KAAA;AACxD,EAAA,MAAM,MAAO,KAAA,CAA4B,GAAA;AACzC,EAAA,IAAI,OAAO,GAAA,KAAQ,QAAA,IAAY,GAAA,KAAQ,MAAM,OAAO,KAAA;AACpD,EAAA,OAAO,OAAQ,IAA2B,IAAA,KAAS,QAAA;AACrD;;AC8FO,SAAS,QAAQ,aAAA,EAAyB;AAC/C,EAAA,IACE,kBAAkB,MAAA,IAClB,aAAA,KAAkB,IAAA,IACjB,aAAA,CAAuC,WAAW,MAAA,EACnD;AACA,IAAA,MAAM,IAAI,yBAAA,EAA0B;AAAA,EACtC;AACA,EAAA,MAAM,EAAE,QAAO,GAAI,aAAA;AACnB,EAAA,IAAI,kBAAA,CAAmB,MAAM,CAAA,EAAG;AAC9B,IAAA,OAAOA,UAAU,aAAgD,CAAA;AAAA,EACnE;AACA,EAAA,OAAOC,UAAU,aAAgD,CAAA;AACnE;;ACpHO,MAAM,SAAA,GAAY;AAiBlB,SAAS,QAAA,CAAY,QAAW,OAAA,EAA8B;AACnE,EAAA,MAAM,MAAA,GAAS,MAAA;AACf,EAAA,MAAM,QAAA,GAAW,qBAAA,CAAsB,MAAM,CAAA,IAAK,EAAC;AACnD,EAAA,MAAM,MAAA,GAAS,YAAY,MAAM,CAAA;AACjC,EAAA,cAAA,CAAe,IAAI,MAAA,EAAkB,EAAE,GAAG,QAAA,EAAU,GAAG,SAAS,CAAA;AAChE,EAAA,OAAO,MAAA;AACT;AAEA,SAAS,YAAe,MAAA,EAAc;AACpC,EAAA,MAAM,SAAA,GAAY,MAAA;AAClB,EAAA,IAAI,OAAO,SAAA,CAAU,KAAA,KAAU,UAAA,EAAY;AACzC,IAAA,OAAQ,UAAU,KAAA,EAAkB;AAAA,EACtC;AAGA,EAAA,MAAM,OAAO,SAAA,CAAU,WAAA;AACvB,EAAA,OAAO,IAAI,IAAA,CAAK,SAAA,CAAU,IAAI,CAAA;AAChC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "attaform",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.1",
|
|
4
4
|
"main": "./dist/index.mjs",
|
|
5
5
|
"types": "./dist/index.d.mts",
|
|
6
6
|
"files": [
|
|
@@ -41,6 +41,22 @@
|
|
|
41
41
|
"types": "./dist/vite.d.mts",
|
|
42
42
|
"import": "./dist/vite.mjs"
|
|
43
43
|
},
|
|
44
|
+
"./rollup": {
|
|
45
|
+
"types": "./dist/rollup.d.mts",
|
|
46
|
+
"import": "./dist/rollup.mjs"
|
|
47
|
+
},
|
|
48
|
+
"./esbuild": {
|
|
49
|
+
"types": "./dist/esbuild.d.mts",
|
|
50
|
+
"import": "./dist/esbuild.mjs"
|
|
51
|
+
},
|
|
52
|
+
"./webpack": {
|
|
53
|
+
"types": "./dist/webpack.d.mts",
|
|
54
|
+
"import": "./dist/webpack.mjs"
|
|
55
|
+
},
|
|
56
|
+
"./rspack": {
|
|
57
|
+
"types": "./dist/rspack.d.mts",
|
|
58
|
+
"import": "./dist/rspack.mjs"
|
|
59
|
+
},
|
|
44
60
|
"./devtools-panel": {
|
|
45
61
|
"default": "./dist/runtime/components/AttaformDevtoolsPanel.vue"
|
|
46
62
|
},
|
|
@@ -100,7 +116,6 @@
|
|
|
100
116
|
"@rollup/plugin-alias": "^6.0.0",
|
|
101
117
|
"@size-limit/preset-small-lib": "^12.1.0",
|
|
102
118
|
"@types/jsdom": "^28.0.1",
|
|
103
|
-
"@types/lodash-es": "^4.17.12",
|
|
104
119
|
"@types/node": "^25.6.0",
|
|
105
120
|
"@typescript-eslint/eslint-plugin": "^8.59.0",
|
|
106
121
|
"@typescript-eslint/parser": "^8.59.0",
|
|
@@ -127,7 +142,6 @@
|
|
|
127
142
|
"immer": "^11.1.4",
|
|
128
143
|
"jsdom": "^29.0.2",
|
|
129
144
|
"lint-staged": "^17.0.4",
|
|
130
|
-
"lodash-es": "^4.18.1",
|
|
131
145
|
"nuxt": "^4.4.2",
|
|
132
146
|
"prettier": "^3.8.3",
|
|
133
147
|
"rollup-plugin-dts": "^6.4.1",
|
|
@@ -149,7 +163,6 @@
|
|
|
149
163
|
"@vue/compiler-core": ">=3.5.0",
|
|
150
164
|
"@vue/compiler-sfc": ">=3.5.0",
|
|
151
165
|
"@vue/devtools-api": "^6.6.0 || ^7.0.0",
|
|
152
|
-
"lodash-es": ">= 4.0.0",
|
|
153
166
|
"nuxt": ">=3.0.0",
|
|
154
167
|
"vite": ">=5.0.0",
|
|
155
168
|
"vue": ">=3.5.0",
|
|
@@ -181,7 +194,7 @@
|
|
|
181
194
|
"lint:fix": "eslint --cache --concurrency=auto --fix . && pnpm format",
|
|
182
195
|
"format": "prettier --write '**/*.{ts,js,vue,css,scss,md,json,yml,yaml}'",
|
|
183
196
|
"format:check": "prettier --check '**/*.{ts,js,vue,css,scss,md,json,yml,yaml}'",
|
|
184
|
-
"check": "pnpm lint && pnpm typecheck && pnpm check:site && pnpm test && pnpm check:size && pnpm check:bench && pnpm check:coverage",
|
|
197
|
+
"check": "pnpm lint && pnpm typecheck && pnpm check:site && pnpm test && pnpm check:size && pnpm check:eager && pnpm check:bench && pnpm check:coverage",
|
|
185
198
|
"fix": "pnpm lint:fix",
|
|
186
199
|
"typecheck": "tsc --noEmit",
|
|
187
200
|
"prepack:watch": "chokidar 'src/**/*' -c 'pnpm prepack' --initial",
|
|
@@ -191,6 +204,7 @@
|
|
|
191
204
|
"test:watch": "node scripts/run-with-webstorage-flag.mjs vitest watch",
|
|
192
205
|
"bench": "node scripts/run-with-webstorage-flag.mjs vitest bench --run",
|
|
193
206
|
"check:size": "pnpm prepack && size-limit",
|
|
207
|
+
"check:eager": "node scripts/check-eager-size.mjs",
|
|
194
208
|
"check:coverage": "node scripts/run-with-webstorage-flag.mjs vitest run --coverage",
|
|
195
209
|
"check:bench": "node scripts/check-bench.mjs",
|
|
196
210
|
"check:bundled-types": "node scripts/check-bundled-types.mjs",
|