attaform 0.17.2 → 0.18.0

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 (115) hide show
  1. package/README.md +77 -36
  2. package/dist/chunks/devtools.cjs +10 -37
  3. package/dist/chunks/devtools.cjs.map +1 -1
  4. package/dist/chunks/devtools.mjs +10 -37
  5. package/dist/chunks/devtools.mjs.map +1 -1
  6. package/dist/chunks/indexeddb.cjs +4 -4
  7. package/dist/chunks/indexeddb.cjs.map +1 -1
  8. package/dist/chunks/indexeddb.mjs +1 -1
  9. package/dist/chunks/local-storage.cjs +2 -2
  10. package/dist/chunks/local-storage.cjs.map +1 -1
  11. package/dist/chunks/local-storage.mjs +1 -1
  12. package/dist/chunks/session-storage.cjs +2 -2
  13. package/dist/chunks/session-storage.cjs.map +1 -1
  14. package/dist/chunks/session-storage.mjs +1 -1
  15. package/dist/index.cjs +42 -37
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +159 -196
  18. package/dist/index.d.mts +159 -196
  19. package/dist/index.d.ts +159 -196
  20. package/dist/index.mjs +5 -7
  21. package/dist/index.mjs.map +1 -1
  22. package/dist/nuxt.cjs +31 -40
  23. package/dist/nuxt.cjs.map +1 -1
  24. package/dist/nuxt.d.cts +8 -1
  25. package/dist/nuxt.d.mts +8 -1
  26. package/dist/nuxt.d.ts +8 -1
  27. package/dist/nuxt.mjs +32 -41
  28. package/dist/nuxt.mjs.map +1 -1
  29. package/dist/runtime/components/AttaformDevtoolsPanel.d.vue.ts +7 -0
  30. package/dist/runtime/components/AttaformDevtoolsPanel.vue +453 -0
  31. package/dist/runtime/components/AttaformDevtoolsPanel.vue.d.ts +7 -0
  32. package/dist/runtime/components/DevtoolsValueTree.d.vue.ts +37 -0
  33. package/dist/runtime/components/DevtoolsValueTree.vue +192 -0
  34. package/dist/runtime/components/DevtoolsValueTree.vue.d.ts +37 -0
  35. package/dist/runtime/plugins/attaform.cjs +17 -6
  36. package/dist/runtime/plugins/attaform.cjs.map +1 -1
  37. package/dist/runtime/plugins/attaform.mjs +15 -4
  38. package/dist/runtime/plugins/attaform.mjs.map +1 -1
  39. package/dist/shared/attaform.5UhpSVFI.cjs +63 -0
  40. package/dist/shared/attaform.5UhpSVFI.cjs.map +1 -0
  41. package/dist/shared/attaform.BDdFdjeX.mjs +57 -0
  42. package/dist/shared/attaform.BDdFdjeX.mjs.map +1 -0
  43. package/dist/shared/attaform.Bgu9l6OG.d.cts +1651 -0
  44. package/dist/shared/attaform.BmDBu4ql.d.ts +1651 -0
  45. package/dist/shared/{attaform.Dee2rU1P.cjs → attaform.BqK_L4gK.cjs} +310 -24
  46. package/dist/shared/attaform.BqK_L4gK.cjs.map +1 -0
  47. package/dist/shared/{attaform.C_5aB6EQ.d.ts → attaform.BsMdl-35.d.cts} +754 -146
  48. package/dist/shared/{attaform.C_5aB6EQ.d.mts → attaform.BsMdl-35.d.mts} +754 -146
  49. package/dist/shared/{attaform.C_5aB6EQ.d.cts → attaform.BsMdl-35.d.ts} +754 -146
  50. package/dist/shared/attaform.Bubm_slq.cjs.map +1 -1
  51. package/dist/shared/{attaform.C6lbmMUe.d.ts → attaform.C3x1hKJC.d.mts} +4 -4
  52. package/dist/shared/{attaform.CuE-bS1C.d.mts → attaform.CWs1Z3p7.d.ts} +57 -23
  53. package/dist/shared/attaform.CXpzmj38.mjs.map +1 -1
  54. package/dist/shared/{attaform.C5MH4lNh.d.mts → attaform.CjmJpfLH.d.ts} +4 -4
  55. package/dist/shared/{attaform.Drt6fivF.mjs → attaform.CtNUB9nf.mjs} +74 -76
  56. package/dist/shared/attaform.CtNUB9nf.mjs.map +1 -0
  57. package/dist/shared/{attaform.C0iFnTN0.d.ts → attaform.D-hDvb98.d.cts} +57 -23
  58. package/dist/shared/attaform.DAH3kvav.d.mts +1651 -0
  59. package/dist/shared/{attaform.BPRHR3Zs.cjs → attaform.DUHru0OF.cjs} +83 -85
  60. package/dist/shared/attaform.DUHru0OF.cjs.map +1 -0
  61. package/dist/shared/{attaform.BV40t5y2.cjs → attaform.Dlk1jMuv.cjs} +245 -108
  62. package/dist/shared/attaform.Dlk1jMuv.cjs.map +1 -0
  63. package/dist/shared/{attaform.B3ZaPIzS.mjs → attaform.DsC3rZHG.mjs} +1804 -219
  64. package/dist/shared/attaform.DsC3rZHG.mjs.map +1 -0
  65. package/dist/shared/{attaform.DtMN-MAm.d.cts → attaform.Dzi89x8N.d.cts} +4 -4
  66. package/dist/shared/{attaform.Cer8JO_P.cjs → attaform.II89Pcf4.cjs} +1860 -272
  67. package/dist/shared/attaform.II89Pcf4.cjs.map +1 -0
  68. package/dist/shared/{attaform.CIEQgJnM.mjs → attaform.Xhg0AYNa.mjs} +300 -26
  69. package/dist/shared/attaform.Xhg0AYNa.mjs.map +1 -0
  70. package/dist/shared/{attaform.CpERWz3u.mjs → attaform.Xt0A3QUd.mjs} +232 -95
  71. package/dist/shared/attaform.Xt0A3QUd.mjs.map +1 -0
  72. package/dist/shared/{attaform.CHorcsIU.d.cts → attaform.bH7WvNad.d.mts} +57 -23
  73. package/dist/vite.cjs +270 -2
  74. package/dist/vite.cjs.map +1 -1
  75. package/dist/vite.mjs +266 -2
  76. package/dist/vite.mjs.map +1 -1
  77. package/dist/zod-v3.cjs +11 -8
  78. package/dist/zod-v3.cjs.map +1 -1
  79. package/dist/zod-v3.d.cts +6 -6
  80. package/dist/zod-v3.d.mts +6 -6
  81. package/dist/zod-v3.d.ts +6 -6
  82. package/dist/zod-v3.mjs +3 -3
  83. package/dist/zod-v4.cjs +11 -8
  84. package/dist/zod-v4.cjs.map +1 -1
  85. package/dist/zod-v4.d.cts +5 -5
  86. package/dist/zod-v4.d.mts +5 -5
  87. package/dist/zod-v4.d.ts +5 -5
  88. package/dist/zod-v4.mjs +3 -3
  89. package/dist/zod.cjs +15 -16
  90. package/dist/zod.cjs.map +1 -1
  91. package/dist/zod.d.cts +127 -40
  92. package/dist/zod.d.mts +127 -40
  93. package/dist/zod.d.ts +127 -40
  94. package/dist/zod.mjs +7 -11
  95. package/dist/zod.mjs.map +1 -1
  96. package/package.json +19 -5
  97. package/dist/shared/attaform.B1jvxsOF.d.mts +0 -156
  98. package/dist/shared/attaform.B3ZaPIzS.mjs.map +0 -1
  99. package/dist/shared/attaform.BBM2muQ9.cjs +0 -101
  100. package/dist/shared/attaform.BBM2muQ9.cjs.map +0 -1
  101. package/dist/shared/attaform.BPRHR3Zs.cjs.map +0 -1
  102. package/dist/shared/attaform.BV40t5y2.cjs.map +0 -1
  103. package/dist/shared/attaform.C6qzEdIM.d.cts +0 -156
  104. package/dist/shared/attaform.C8LVFVVe.cjs +0 -32
  105. package/dist/shared/attaform.C8LVFVVe.cjs.map +0 -1
  106. package/dist/shared/attaform.CIEQgJnM.mjs.map +0 -1
  107. package/dist/shared/attaform.CTwNcpLE.d.ts +0 -156
  108. package/dist/shared/attaform.Cer8JO_P.cjs.map +0 -1
  109. package/dist/shared/attaform.CpERWz3u.mjs.map +0 -1
  110. package/dist/shared/attaform.Dee2rU1P.cjs.map +0 -1
  111. package/dist/shared/attaform.Drt6fivF.mjs.map +0 -1
  112. package/dist/shared/attaform.Vo-Kft0t.mjs +0 -29
  113. package/dist/shared/attaform.Vo-Kft0t.mjs.map +0 -1
  114. package/dist/shared/attaform.h1sq3BFu.mjs +0 -92
  115. package/dist/shared/attaform.h1sq3BFu.mjs.map +0 -1
@@ -1,21 +1,27 @@
1
1
  import { z } from 'zod';
2
- import { G as GenericForm, s as FlatPath, B as NestedType, U as UseFormConfiguration, b as AbstractSchema, D as DeepPartial, c as DefaultValuesShape, ag as ValidateOnConfig, d as UseFormReturnType } from './attaform.C_5aB6EQ.cjs';
2
+ import { G as GenericForm, t as FlatPath, O as NestedType, F as FormKey, U as UseFormConfiguration, a as AbstractSchema, D as DefaultValuesInput, ak as ValidateOnConfig, b as UseFormReturnType } from './attaform.BsMdl-35.mjs';
3
3
 
4
4
  /**
5
5
  * The shape `form.values.<key>` returns at runtime.
6
6
  *
7
7
  * Per leaf:
8
8
  *
9
- * 1. `z.preprocess(fn, inner)` — compiles to `ZodPipe<ZodTransform, inner>`.
10
- * The preprocess fn fires at the write boundary (synthesized into
11
- * `setValue`), so storage holds whatever `inner` stores. Recurse
12
- * `StorageShape` on `inner` so a defaulted leaf inside `inner` still
13
- * reads `T` (not `T | undefined`).
9
+ * 1. Schema-side input normalizers — `z.preprocess(fn, inner)` AND
10
+ * `z.coerce.X()`. Zod v4 represents these differently
11
+ * (`ZodPipe<ZodTransform, inner>` for preprocess; a primitive
12
+ * with `def.coerce === true` for coerce), but they share the
13
+ * same type-level marker: `_zod.input` is `unknown`. The
14
+ * normalizer runs at parse time, NOT at the write boundary, so
15
+ * storage holds the consumer's raw input and the type collapses
16
+ * to `unknown` to match. Reach the typed value via
17
+ * `handleSubmit`, `validate`, or `validateAsync` — they re-parse
18
+ * storage through the wrapper.
14
19
  *
15
20
  * 2. `inner.transform(fn)` — compiles to `ZodPipe<inner, ZodTransform>`.
16
21
  * Transforms fire at submit / validate, NOT at the write boundary,
17
22
  * so storage holds whatever `inner` stores. Recurse `StorageShape`
18
- * on `inner` for the same reason.
23
+ * on `inner` so a defaulted leaf inside `inner` still reads `T`
24
+ * (not `T | undefined`).
19
25
  *
20
26
  * A bare top-level `ZodTransform` (no `in` schema) reads
21
27
  * `_zod.input` directly — there's no inner to recurse into.
@@ -30,12 +36,12 @@ import { G as GenericForm, s as FlatPath, B as NestedType, U as UseFormConfigura
30
36
  * Nested objects delegate to Zod's own recursion on `_zod.output`,
31
37
  * which peels nested defaults inside structural containers.
32
38
  *
33
- * Recursion: the alias calls itself on the non-transform side of a
34
- * pipe so the inner shape gets the same per-key storage treatment as
35
- * the top level. Without it, an inner `.default(...)` inside a
36
- * transformed object would peel back to `T | undefined` (the broad
37
- * input contract). Recursion only fires for pipe leaves most leaves
38
- * skip it.
39
+ * Detection order: case 1 wins via the `_zod.input` IsUnknown check
40
+ * before the pipe/transform cascade fires, so wrapped variants like
41
+ * `z.coerce.number().optional()` (input = `unknown | undefined`
42
+ * collapses to `unknown`) and `z.preprocess(fn, z.object(...))` (input
43
+ * = `unknown`) both land on `unknown` without descending. The IsAny
44
+ * filter keeps `z.any()` from being mistaken for coerce.
39
45
  *
40
46
  * Implementation note: direct `_zod` property access mirrors Zod's
41
47
  * own `$InferObjectOutput` / `$InferObjectInput`, which read
@@ -61,7 +67,26 @@ type StorageShape<S> = S extends {
61
67
  } ? {
62
68
  [K in keyof Shape]-?: StorageLeaf<Shape[K]>;
63
69
  } : StorageLeaf<S>;
64
- type StorageLeaf<L> = L extends {
70
+ /**
71
+ * Detects a schema whose `_zod.input` is `unknown` — the marker both
72
+ * `z.preprocess(fn, _)` and `z.coerce.X()` share in Zod v4. Excludes
73
+ * `any` via the canonical `0 extends 1 & T` test so `z.any()` leaves
74
+ * fall through to the cascade below and keep their `any` typing.
75
+ */
76
+ type InputIsUnknown<L> = L extends {
77
+ _zod: {
78
+ input: infer In;
79
+ };
80
+ } ? 0 extends 1 & In ? false : unknown extends In ? true : false : false;
81
+ /**
82
+ * Implementation-detail per-leaf branching for `StorageShape`.
83
+ * Exported so the bundled `.d.ts` carries a single alias body —
84
+ * every leaf of a Zod object schema otherwise re-emits the full
85
+ * pipe / transform / default conditional ladder, which compounds
86
+ * badly with multiple complex schemas in the same scope. Consumers
87
+ * should reach for `StorageShape` instead.
88
+ */
89
+ type StorageLeaf<L> = InputIsUnknown<L> extends true ? unknown : L extends {
65
90
  _zod: {
66
91
  def: {
67
92
  type: 'pipe';
@@ -69,13 +94,7 @@ type StorageLeaf<L> = L extends {
69
94
  out: infer B;
70
95
  };
71
96
  };
72
- } ? A extends {
73
- _zod: {
74
- def: {
75
- type: 'transform';
76
- };
77
- };
78
- } ? StorageShape<B> : B extends {
97
+ } ? B extends {
79
98
  _zod: {
80
99
  def: {
81
100
  type: 'transform';
@@ -157,9 +176,24 @@ type PathOutput<Schema extends z.ZodType, Path extends string> = z.output<Schema
157
176
  *
158
177
  * For Zod v3, import from `attaform/zod-v3` instead.
159
178
  */
160
- declare function useForm<Schema extends z.ZodObject>(configuration: Omit<UseFormConfiguration<z.input<Schema> extends GenericForm ? z.input<Schema> : never, z.output<Schema> extends GenericForm ? z.output<Schema> : never, AbstractSchema<z.input<Schema> extends GenericForm ? z.input<Schema> : never, z.output<Schema> extends GenericForm ? z.output<Schema> : never>, DeepPartial<DefaultValuesShape<z.input<Schema> extends GenericForm ? z.input<Schema> : never>>>, 'schema' | 'validateOn' | 'debounceMs'> & {
179
+ /**
180
+ * `FormOf` / `OutOf` / `ReadOf` factor the three identical-shape
181
+ * conditionals out of `useForm`'s public signature. The bundled
182
+ * `.d.ts` then carries one alias per shape rather than re-inlining
183
+ * `z.input<Schema> extends GenericForm ? z.input<Schema> : never`
184
+ * four times — which is what produces TS2589 ("Type instantiation
185
+ * is excessively deep") on consumer call sites with complex schemas
186
+ * (discriminated unions, transform pipes, deep `.register()` chains).
187
+ * Each alias is computed once per `Schema` instantiation; downstream
188
+ * generics ride on the alias rather than re-evaluating the
189
+ * conditional from scratch.
190
+ */
191
+ type FormOf<Schema extends z.ZodObject> = z.input<Schema> extends GenericForm ? z.input<Schema> : never;
192
+ type OutOf<Schema extends z.ZodObject> = z.output<Schema> extends GenericForm ? z.output<Schema> : never;
193
+ type ReadOf<Schema extends z.ZodObject> = StorageShape<Schema> extends GenericForm ? StorageShape<Schema> : never;
194
+ declare function useForm<Schema extends z.ZodObject, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<FormOf<Schema>, OutOf<Schema>, AbstractSchema<FormOf<Schema>, OutOf<Schema>>, DefaultValuesInput<FormOf<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
161
195
  schema: Schema;
162
- } & ValidateOnConfig): UseFormReturnType<z.input<Schema> extends GenericForm ? z.input<Schema> : never, z.output<Schema> extends GenericForm ? z.output<Schema> : never, StorageShape<Schema> extends GenericForm ? StorageShape<Schema> : never>;
196
+ } & ValidateOnConfig): UseFormReturnType<FormOf<Schema>, OutOf<Schema>, ReadOf<Schema>, K>;
163
197
 
164
198
  export { useForm as u };
165
199
  export type { PathInput as P, StorageShape as S, PathOutput as a };
package/dist/vite.cjs CHANGED
@@ -4,6 +4,172 @@ const node_fs = require('node:fs');
4
4
  const node_url = require('node:url');
5
5
  const node_path = require('node:path');
6
6
  const vRegisterPreambleTransform = require('./shared/attaform.Bubm_slq.cjs');
7
+ const compilerSfc = require('@vue/compiler-sfc');
8
+ const MagicString = require('magic-string');
9
+
10
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
11
+
12
+ const MagicString__default = /*#__PURE__*/_interopDefaultCompat(MagicString);
13
+
14
+ const TARGET_PACKAGES = /* @__PURE__ */ new Set(["attaform", "attaform/zod", "attaform/zod-v3", "attaform/zod-v4"]);
15
+ const TARGET_FUNCTIONS = /* @__PURE__ */ new Set(["useForm", "injectForm"]);
16
+ function transformSsrAccessed(code, id) {
17
+ if (!id.endsWith(".vue")) return null;
18
+ const { descriptor } = compilerSfc.parse(code, { filename: id });
19
+ if (descriptor.scriptSetup === null || descriptor.template === null) return null;
20
+ const scriptSource = descriptor.scriptSetup.content;
21
+ const scriptOffset = descriptor.scriptSetup.loc.start.offset;
22
+ let scriptAst;
23
+ try {
24
+ scriptAst = compilerSfc.babelParse(scriptSource, {
25
+ sourceType: "module",
26
+ plugins: ["typescript"]
27
+ });
28
+ } catch {
29
+ return null;
30
+ }
31
+ const program = scriptAst.program ?? scriptAst;
32
+ const body = program.body ?? [];
33
+ const localImports = collectImports(body);
34
+ if (localImports.size === 0) return null;
35
+ const bindings = collectBindings(body, localImports);
36
+ if (bindings.size === 0) return null;
37
+ const referenced = collectTemplateReferences(descriptor.template.ast, bindings);
38
+ if (referenced.size === 0) return null;
39
+ const magic = new MagicString__default(code);
40
+ for (const name of referenced) {
41
+ const entry = bindings.get(name);
42
+ if (entry === void 0) continue;
43
+ injectMark(magic, entry.call, scriptOffset);
44
+ }
45
+ return {
46
+ code: magic.toString(),
47
+ map: magic.generateMap({ hires: true, source: id, includeContent: true })
48
+ };
49
+ }
50
+ function collectImports(body) {
51
+ const locals = /* @__PURE__ */ new Map();
52
+ for (const node of body) {
53
+ if (node.type !== "ImportDeclaration") continue;
54
+ const decl = node;
55
+ const source = decl.source.value;
56
+ if (!TARGET_PACKAGES.has(source)) continue;
57
+ for (const specifier of decl.specifiers) {
58
+ if (specifier.type !== "ImportSpecifier") continue;
59
+ const spec = specifier;
60
+ const imported = spec.imported;
61
+ const importedName = imported.type === "Identifier" ? imported.name : imported.value;
62
+ if (importedName === void 0 || !TARGET_FUNCTIONS.has(importedName)) continue;
63
+ locals.set(spec.local.name, importedName);
64
+ }
65
+ }
66
+ return locals;
67
+ }
68
+ function collectBindings(body, localImports) {
69
+ const bindings = /* @__PURE__ */ new Map();
70
+ for (const node of body) {
71
+ if (node.type !== "VariableDeclaration") continue;
72
+ const decl = node;
73
+ for (const declarator of decl.declarations) {
74
+ const id = declarator.id;
75
+ if (id.type !== "Identifier") continue;
76
+ const idNode = id;
77
+ const init = declarator.init;
78
+ if (init === null || init === void 0 || init.type !== "CallExpression") continue;
79
+ const call = init;
80
+ if (call.callee.type !== "Identifier") continue;
81
+ const callName = call.callee.name;
82
+ const tracked = localImports.get(callName);
83
+ if (tracked === void 0) continue;
84
+ bindings.set(idNode.name, { callee: tracked, call });
85
+ }
86
+ }
87
+ return bindings;
88
+ }
89
+ function collectTemplateReferences(root, bindings) {
90
+ const referenced = /* @__PURE__ */ new Set();
91
+ if (root === void 0) return referenced;
92
+ const candidates = new Set(bindings.keys());
93
+ if (candidates.size === 0) return referenced;
94
+ const visit = (node) => {
95
+ if ("children" in node && Array.isArray(node.children)) {
96
+ for (const child of node.children) visit(child);
97
+ }
98
+ if (node.type === 5) {
99
+ collectFromExpression(node.content, candidates, referenced);
100
+ } else if (node.type === 1 && Array.isArray(node.props)) {
101
+ for (const prop of node.props) {
102
+ if (prop.type === 7) {
103
+ if (prop.exp !== void 0 && prop.exp !== null) {
104
+ collectFromExpression(prop.exp, candidates, referenced);
105
+ }
106
+ if (prop.arg !== void 0 && prop.arg !== null) {
107
+ collectFromExpression(prop.arg, candidates, referenced);
108
+ }
109
+ }
110
+ }
111
+ }
112
+ };
113
+ visit(root);
114
+ return referenced;
115
+ }
116
+ function collectFromExpression(expr, candidates, out) {
117
+ if (expr === null || expr === void 0) return;
118
+ if (typeof expr !== "object") return;
119
+ const node = expr;
120
+ if (node.type === 4 && typeof node.content === "string") {
121
+ for (const name of candidates) {
122
+ if (matchesIdentifier(node.content, name)) out.add(name);
123
+ }
124
+ return;
125
+ }
126
+ if (node.type === 8 && Array.isArray(node.children)) {
127
+ for (const child of node.children) collectFromExpression(child, candidates, out);
128
+ }
129
+ }
130
+ function matchesIdentifier(source, name) {
131
+ const pattern = new RegExp(`(?<![\\w$])${escapeForRegExp(name)}(?![\\w$])`);
132
+ return pattern.test(source);
133
+ }
134
+ function escapeForRegExp(value) {
135
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
136
+ }
137
+ function injectMark(magic, call, scriptOffset) {
138
+ const args = call.arguments;
139
+ if (args.length === 0) {
140
+ const calleeEnd = call.callee.end;
141
+ if (calleeEnd === null || calleeEnd === void 0) return;
142
+ const openParenAbs = findChar(magic.original, "(", scriptOffset + calleeEnd) + 1;
143
+ magic.appendRight(openParenAbs, "{ __ssrAccessed: true }");
144
+ return;
145
+ }
146
+ const first = args[0];
147
+ if (first === void 0) return;
148
+ if (first.type === "ObjectExpression") {
149
+ const obj = first;
150
+ if (obj.start === null || obj.start === void 0) return;
151
+ const openBraceAbs = scriptOffset + obj.start + 1;
152
+ const insertion = obj.properties.length === 0 ? " __ssrAccessed: true " : " __ssrAccessed: true,";
153
+ magic.appendRight(openBraceAbs, insertion);
154
+ return;
155
+ }
156
+ if (first.type === "StringLiteral") {
157
+ const lit = first;
158
+ if (lit.start === null || lit.start === void 0) return;
159
+ if (lit.end === null || lit.end === void 0) return;
160
+ const startAbs = scriptOffset + lit.start;
161
+ const endAbs = scriptOffset + lit.end;
162
+ const original = magic.original.slice(startAbs, endAbs);
163
+ magic.overwrite(startAbs, endAbs, `{ key: ${original}, __ssrAccessed: true }`);
164
+ return;
165
+ }
166
+ }
167
+ function findChar(source, target, from) {
168
+ for (let i = from; i < source.length; i += 1) {
169
+ if (source[i] === target) return i;
170
+ }
171
+ return -1;
172
+ }
7
173
 
8
174
  const ZOD_UNIFIED_SPECIFIER = "attaform/zod";
9
175
  const ZOD_V3_SPECIFIER = "attaform/zod-v3";
@@ -79,11 +245,113 @@ function attaform(options = {}) {
79
245
  }
80
246
  aliasTarget = detection.major === 4 ? ZOD_V4_SPECIFIER : ZOD_V3_SPECIFIER;
81
247
  },
82
- resolveId(source) {
248
+ configureServer(server) {
249
+ server.middlewares.use(
250
+ "/_attaform_devtools",
251
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
252
+ async (req, res, next) => {
253
+ if (req.method !== "GET") {
254
+ next();
255
+ return;
256
+ }
257
+ if (req.url === "/icon.svg") {
258
+ const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect width="24" height="24" rx="5" fill="#6938ef"/><g fill="none" stroke="#ffffff" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round"><path d="M8 16 L12 8 L16 16"/><path d="M9.5 13 L14.5 13"/></g></svg>`;
259
+ res.setHeader("Content-Type", "image/svg+xml; charset=utf-8");
260
+ res.setHeader("Cache-Control", "public, max-age=3600");
261
+ res.end(svg);
262
+ return;
263
+ }
264
+ try {
265
+ const rawHtml = `<!DOCTYPE html>
266
+ <html lang="en">
267
+ <head>
268
+ <meta charset="UTF-8" />
269
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
270
+ <title>Attaform DevTools</title>
271
+ <style>
272
+ html, body { height: 100%; margin: 0; background: #0f172a; }
273
+ @media (prefers-color-scheme: light) {
274
+ html, body { background: #ffffff; }
275
+ }
276
+ #atf-loading {
277
+ padding: 1rem;
278
+ color: #94a3b8;
279
+ font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
280
+ font-size: 13px;
281
+ }
282
+ </style>
283
+ </head>
284
+ <body>
285
+ <div id="atf-app"><div id="atf-loading">Loading Attaform DevTools\u2026</div></div>
286
+ <script type="module">
287
+ import { createApp, h } from 'vue'
288
+ import AttaformDevtoolsPanel from 'attaform/devtools-panel'
289
+
290
+ // The panel runs inside Nuxt DevTools' overlay iframe, which itself
291
+ // is nested in the consumer's main page. \`window.parent\` only
292
+ // crosses one frame boundary \u2014 the overlay UI \u2014 which doesn't have
293
+ // the bridge attached. The bridge lives on the consumer's main
294
+ // page, which sits at the top of the frame hierarchy. Walk the
295
+ // chain checking each ancestor frame so the same code works whether
296
+ // the panel is opened in 0, 1, or 2+ iframe layers deep.
297
+ //
298
+ // Same-origin assumption holds (everything served from the dev
299
+ // server's origin) so cross-frame property access doesn't throw.
300
+ // If a future Nuxt DevTools build sandboxes the overlay iframe,
301
+ // the try/catch falls through to the empty-bridge path with a
302
+ // clear "not found" message.
303
+ function findBridge() {
304
+ let frame = window
305
+ for (let depth = 0; depth < 10; depth++) {
306
+ try {
307
+ const candidate = frame.__attaform_devtools__
308
+ if (candidate !== undefined) return candidate
309
+ } catch {
310
+ return undefined
311
+ }
312
+ if (frame.parent === frame) return undefined
313
+ frame = frame.parent
314
+ }
315
+ return undefined
316
+ }
317
+
318
+ const start = Date.now()
319
+ function bootstrap() {
320
+ const bridge = findBridge()
321
+ if (bridge !== undefined) {
322
+ const root = document.getElementById('atf-app')
323
+ root.innerHTML = ''
324
+ createApp({ render: () => h(AttaformDevtoolsPanel, { bridge }) }).mount(root)
325
+ return
326
+ }
327
+ if (Date.now() - start < 2000) {
328
+ setTimeout(bootstrap, 50)
329
+ return
330
+ }
331
+ document.getElementById('atf-loading').textContent =
332
+ 'Attaform devtools bridge not found. The host app may not have the Nuxt module installed.'
333
+ }
334
+ bootstrap()
335
+ <\/script>
336
+ </body>
337
+ </html>`;
338
+ const html = await server.transformIndexHtml("/_attaform_devtools", rawHtml);
339
+ res.setHeader("Content-Type", "text/html; charset=utf-8");
340
+ res.end(html);
341
+ } catch (err) {
342
+ next(err);
343
+ }
344
+ }
345
+ );
346
+ },
347
+ async resolveId(source, importer) {
83
348
  if (!resolveZodAlias) return null;
84
349
  if (aliasTarget === null) return null;
85
350
  if (source !== ZOD_UNIFIED_SPECIFIER) return null;
86
- return aliasTarget;
351
+ return this.resolve(aliasTarget, importer, { skipSelf: true });
352
+ },
353
+ transform(code, id) {
354
+ return transformSsrAccessed(code, id);
87
355
  }
88
356
  };
89
357
  }
package/dist/vite.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"vite.cjs","sources":["../src/vite.ts"],"sourcesContent":["/**\n * `attaform/vite` — Vite plugin that wires the compile-time node\n * transforms with @vitejs/plugin-vue AND rewrites `attaform/zod`\n * imports to either `attaform/zod-v3` or `attaform/zod-v4` at build\n * time, based on the consumer's installed Zod major. The result is\n * one Zod adapter shipped per bundle, with no manual subpath choice.\n *\n * Usage (bare Vue 3 consumers):\n *\n * // vite.config.ts\n * import vue from '@vitejs/plugin-vue'\n * import { attaform } from 'attaform/vite'\n *\n * export default defineConfig({\n * plugins: [vue(), attaform()],\n * })\n *\n * The transforms inject `:value`, `:checked`, and `:selected` bindings\n * into elements that use the `v-register` directive — load-bearing for\n * SSR initial-render correctness. Omitting this plugin under CSR is\n * tolerable (one-frame flash on mount); omitting it under SSR produces\n * visibly wrong initial HTML.\n *\n * The `resolveZodAlias` option (default `true`) controls the build-time\n * `attaform/zod` rewrite. Set to `false` if your project intentionally\n * mixes Zod versions or has a non-standard Zod resolution; the unified\n * `attaform/zod` entry's runtime dispatch covers that case at the cost\n * of bundling both adapters.\n *\n * Implementation note: this plugin mutates @vitejs/plugin-vue's options\n * via the documented but somewhat informal `api.options` surface used\n * by VueUse, Vite PWA, and other Vue ecosystem plugins. If you're\n * using a custom Vue plugin wrapper, fall back to `attaform/transforms`\n * and wire them yourself.\n */\nimport { readFileSync } from 'node:fs'\nimport { fileURLToPath, pathToFileURL } from 'node:url'\nimport { join } from 'node:path'\nimport type { Plugin } from 'vite'\nimport { inputTextAreaNodeTransform } from './runtime/lib/core/transforms/input-text-area-transform'\nimport { selectNodeTransform } from './runtime/lib/core/transforms/select-transform'\nimport { vRegisterHintTransform } from './runtime/lib/core/transforms/v-register-hint-transform'\nimport { vRegisterPreambleTransform } from './runtime/lib/core/transforms/v-register-preamble-transform'\n\n/** Options for `attaform()`. */\nexport interface AttaformVitePluginOptions {\n /**\n * Rewrite `attaform/zod` imports at build time to either\n * `attaform/zod-v3` or `attaform/zod-v4`, based on the consumer's\n * installed Zod major. Default `true` — produces a leaner bundle\n * for the common case of one Zod version per project.\n *\n * Set to `false` to fall through to the unified entry's runtime\n * dispatch. Useful when:\n * - your project intentionally has both `zod` and `zod-v3`\n * installed (e.g. via a pnpm alias) and the schema-shape\n * dispatch is the right behavior;\n * - your monorepo's Zod resolution is non-standard and the\n * plugin's detection (`import.meta.resolve('zod/package.json')`)\n * would land on the wrong copy.\n */\n resolveZodAlias?: boolean\n}\n\ninterface VitePluginVueApi {\n options?: {\n template?: {\n compilerOptions?: {\n nodeTransforms?: unknown[]\n }\n }\n }\n}\n\nconst ZOD_UNIFIED_SPECIFIER = 'attaform/zod'\nconst ZOD_V3_SPECIFIER = 'attaform/zod-v3'\nconst ZOD_V4_SPECIFIER = 'attaform/zod-v4'\n\n/**\n * Read the consumer's installed Zod major by resolving\n * `zod/package.json` from their project root. ESM resolution\n * (`import.meta.resolve`) is sync and stable on Node 20.6+, follows\n * pnpm symlinks, and works with attaform's ESM-only `exports` map.\n *\n * Returns:\n * - `{ major: 3 | 4 }` when zod is resolvable AND its `version`\n * field parses to a known major;\n * - `{ major: 'missing' }` when zod can't be resolved at all;\n * - `{ major: 'unknown' }` for any other failure (corrupted\n * package.json, unexpected version string, monorepo edge case).\n */\nfunction detectZodMajor(\n consumerRootDir: string\n): { major: 3 } | { major: 4 } | { major: 'missing' } | { major: 'unknown' } {\n const consumerURL = pathToFileURL(join(consumerRootDir, 'package.json')).href\n let resolved: string\n try {\n resolved = import.meta.resolve('zod/package.json', consumerURL)\n } catch {\n return { major: 'missing' }\n }\n try {\n const pkg = JSON.parse(readFileSync(fileURLToPath(resolved), 'utf8')) as { version?: unknown }\n const version = pkg.version\n if (typeof version !== 'string') return { major: 'unknown' }\n const major = Number.parseInt(version.split('.')[0] ?? '', 10)\n if (major === 3) return { major: 3 }\n if (major === 4) return { major: 4 }\n return { major: 'unknown' }\n } catch {\n return { major: 'unknown' }\n }\n}\n\n/**\n * Vite plugin that wires the form library's compile-time template\n * transforms into `@vitejs/plugin-vue` and rewrites the unified\n * `attaform/zod` import to the matching adapter subpath. Required\n * for SSR and for hydration accuracy under bare Vue 3.\n *\n * ```ts\n * // vite.config.ts\n * import vue from '@vitejs/plugin-vue'\n * import { attaform } from 'attaform/vite'\n *\n * export default defineConfig({\n * plugins: [vue(), attaform()],\n * })\n * ```\n *\n * Place the call after `vue()` in the plugins array. Nuxt projects\n * don't need this — `attaform/nuxt` handles it.\n */\nexport function attaform(options: AttaformVitePluginOptions = {}): Plugin {\n const resolveZodAlias = options.resolveZodAlias !== false\n // Resolution is computed once per plugin instance from the resolved\n // Vite root in `configResolved`, then cached for every `resolveId`\n // call (the hook fires many times during dev/build).\n let aliasTarget: string | null = null\n let warnedAboutDetection = false\n\n return {\n name: 'attaform',\n enforce: 'pre',\n configResolved(resolved) {\n const vuePlugin = resolved.plugins.find((p) => p.name === 'vite:vue')\n // Two distinct failure modes — separate error messages so the\n // consumer's fix is unambiguous:\n // 1. plugin not in the plugins array → install + register vue()\n // 2. plugin found but version-incompatible (no `api.options`) →\n // version mismatch with @vitejs/plugin-vue\n if (vuePlugin === undefined) {\n throw new Error(\n '[attaform/vite] @vitejs/plugin-vue is not installed (or not registered before attaform()). ' +\n 'Install @vitejs/plugin-vue and place `attaform()` after `vue()` in your plugins array.'\n )\n }\n const api = (vuePlugin as unknown as { api?: VitePluginVueApi }).api\n if (api?.options === undefined) {\n throw new Error(\n '[attaform/vite] Found @vitejs/plugin-vue but it does not expose `api.options`. ' +\n 'This usually means a version-incompatible @vitejs/plugin-vue (or a wrapper plugin re-exporting it). ' +\n 'Pin @vitejs/plugin-vue to a version compatible with the documented `api.options.template.compilerOptions.nodeTransforms` surface.'\n )\n }\n api.options.template ??= {}\n api.options.template.compilerOptions ??= {}\n const existing = api.options.template.compilerOptions.nodeTransforms ?? []\n // Idempotent install: if a previous attaform() invocation\n // (vite + nuxt module + manual `plugins: [attaform()]`) has\n // already pushed our transforms, skip — re-pushing would double\n // every binding the AST emits, breaking the IIFE-wrapping\n // invariants downstream transforms depend on. We detect the\n // sentinel via reference equality; user-supplied transforms with\n // the same name don't collide.\n if (!existing.includes(vRegisterPreambleTransform as unknown)) {\n // vRegisterPreambleTransform MUST come before vRegisterHintTransform\n // — the preamble's pre-order captures each `v-register` expression\n // in its raw (un-wrapped) form, and the hint then mutates the same\n // directive's `exp` to wrap it. Reversing the order would have the\n // preamble pick up an already-wrapped IIFE, double-wrapping it\n // when injected at the root.\n api.options.template.compilerOptions.nodeTransforms = [\n ...existing,\n selectNodeTransform,\n inputTextAreaNodeTransform,\n vRegisterPreambleTransform,\n vRegisterHintTransform,\n ]\n }\n\n // Build-time alias resolution. Skip cleanly when the user opted\n // out so consumers with non-standard Zod setups don't see a\n // \"zod is not installed\" error from this plugin.\n if (!resolveZodAlias) return\n const detection = detectZodMajor(resolved.root)\n if (detection.major === 'missing') {\n throw new Error(\n '[attaform/vite] zod is not installed. attaform requires zod as a peer dependency. ' +\n 'Install `zod@^3` or `zod@^4`, OR pass `attaform({ resolveZodAlias: false })` ' +\n 'to keep the runtime-dispatch unified entry (and silence this check).'\n )\n }\n if (detection.major === 'unknown') {\n // Detection landed on a zod resolution but couldn't classify\n // the version — log once and fall through to runtime dispatch.\n // The build still works; the consumer just ships both adapters.\n if (!warnedAboutDetection) {\n warnedAboutDetection = true\n console.warn(\n '[attaform/vite] Could not classify the installed Zod major (corrupted package.json, ' +\n 'monorepo edge case, or an unexpected version string). Falling through to runtime ' +\n 'dispatch — both Zod adapters will ship in the bundle. ' +\n 'Pass `attaform({ resolveZodAlias: false })` to silence this warning.'\n )\n }\n return\n }\n aliasTarget = detection.major === 4 ? ZOD_V4_SPECIFIER : ZOD_V3_SPECIFIER\n },\n resolveId(source) {\n // Intercept ONLY the exact unified specifier. Explicit subpaths\n // (`attaform/zod-v3`, `attaform/zod-v4`) and the root entry\n // (`attaform`) pass through unchanged — that's the documented\n // escape hatch for power users.\n if (!resolveZodAlias) return null\n if (aliasTarget === null) return null\n if (source !== ZOD_UNIFIED_SPECIFIER) return null\n return aliasTarget\n },\n }\n}\n"],"names":["pathToFileURL","join","readFileSync","fileURLToPath","vRegisterPreambleTransform","selectNodeTransform","inputTextAreaNodeTransform","vRegisterHintTransform"],"mappings":";;;;;;;AA0EA,MAAM,qBAAA,GAAwB,cAAA;AAC9B,MAAM,gBAAA,GAAmB,iBAAA;AACzB,MAAM,gBAAA,GAAmB,iBAAA;AAezB,SAAS,eACP,eAAA,EAC2E;AAC3E,EAAA,MAAM,cAAcA,sBAAA,CAAcC,cAAA,CAAK,eAAA,EAAiB,cAAc,CAAC,CAAA,CAAE,IAAA;AACzE,EAAA,IAAI,QAAA;AACJ,EAAA,IAAI;AACF,IAAA,QAAA,GAAW,SAAY,CAAQ,kBAAA,EAAoB,WAAW,CAAA;AAAA,EAChE,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,EAAE,OAAO,SAAA,EAAU;AAAA,EAC5B;AACA,EAAA,IAAI;AACF,IAAA,MAAM,GAAA,GAAM,KAAK,KAAA,CAAMC,oBAAA,CAAaC,uBAAc,QAAQ,CAAA,EAAG,MAAM,CAAC,CAAA;AACpE,IAAA,MAAM,UAAU,GAAA,CAAI,OAAA;AACpB,IAAA,IAAI,OAAO,OAAA,KAAY,QAAA,EAAU,OAAO,EAAE,OAAO,SAAA,EAAU;AAC3D,IA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sources":["../src/runtime/lib/core/transforms/ssr-accessed-transform.ts","../src/vite.ts"],"sourcesContent":["/**\n * SFC-level transform — injects `__ssrAccessed: true` into the\n * options bag of `useForm(...)` and `injectForm(...)` calls whose\n * binding the surrounding template references. Runs once per Vue\n * file during Vite's `transform(code, id)` hook (see `src/vite.ts`)\n * and is also pulled into Nuxt builds via `attaform/nuxt`.\n *\n * The injection lets the runtime registry enqueue the form on the\n * SSR prefetch queue BEFORE `onServerPrefetch` fires. Async\n * `defaultValues` factories then run inside the prefetch phase and\n * the resolved payload bakes into hydration transfer state — the\n * client never re-fetches.\n *\n * Coverage details and the form-handle / cross-module fallback list\n * live in the implementation plan and in `docs/multistep/ssr.md`.\n */\nimport { parse as parseSfc, babelParse } from '@vue/compiler-sfc'\nimport MagicString from 'magic-string'\nimport type { RootNode, TemplateChildNode } from '@vue/compiler-core'\n\ninterface BabelNode {\n readonly type: string\n readonly start?: number | null\n readonly end?: number | null\n}\ninterface ImportSpecifierNode extends BabelNode {\n readonly type: 'ImportSpecifier'\n readonly imported: {\n readonly type: 'Identifier' | 'StringLiteral'\n readonly name?: string\n readonly value?: string\n }\n readonly local: { readonly name: string }\n}\ninterface ImportDeclarationNode extends BabelNode {\n readonly type: 'ImportDeclaration'\n readonly source: { readonly value: string }\n readonly specifiers: readonly { readonly type: string }[]\n}\ninterface IdentifierNode extends BabelNode {\n readonly type: 'Identifier'\n readonly name: string\n}\ninterface CallExpressionNode extends BabelNode {\n readonly type: 'CallExpression'\n readonly callee: BabelNode\n readonly arguments: readonly BabelNode[]\n}\ninterface ObjectExpressionNode extends BabelNode {\n readonly type: 'ObjectExpression'\n readonly properties: readonly unknown[]\n}\ninterface VariableDeclarationNode extends BabelNode {\n readonly type: 'VariableDeclaration'\n readonly declarations: readonly {\n readonly id: BabelNode\n readonly init: BabelNode | null\n }[]\n}\ninterface StringLiteralNode extends BabelNode {\n readonly type: 'StringLiteral'\n readonly value: string\n}\n\nconst TARGET_PACKAGES = new Set(['attaform', 'attaform/zod', 'attaform/zod-v3', 'attaform/zod-v4'])\nconst TARGET_FUNCTIONS = new Set(['useForm', 'injectForm'])\n\ninterface BindingEntry {\n readonly callee: 'useForm' | 'injectForm'\n readonly call: CallExpressionNode\n}\n\nexport interface SsrAccessedTransformResult {\n code: string\n map: ReturnType<MagicString['generateMap']>\n}\n\n/**\n * Apply the transform to a single SFC source string. Returns `null`\n * when the file is unaffected (non-SFC id, no `<script setup>`, no\n * `<template>`, or no eligible binding references).\n */\nexport function transformSsrAccessed(code: string, id: string): SsrAccessedTransformResult | null {\n if (!id.endsWith('.vue')) return null\n\n const { descriptor } = parseSfc(code, { filename: id })\n if (descriptor.scriptSetup === null || descriptor.template === null) return null\n\n const scriptSource = descriptor.scriptSetup.content\n const scriptOffset = descriptor.scriptSetup.loc.start.offset\n\n let scriptAst: BabelNode\n try {\n scriptAst = babelParse(scriptSource, {\n sourceType: 'module',\n plugins: ['typescript'],\n })\n } catch {\n // A script-setup section that the consumer's tooling can't parse\n // means the SFC will fail to compile anyway — bail and let the\n // downstream Vue compile path emit the real diagnostic.\n return null\n }\n\n const program = (scriptAst as { program?: BabelNode }).program ?? scriptAst\n const body = (program as { body?: BabelNode[] }).body ?? []\n\n const localImports = collectImports(body)\n if (localImports.size === 0) return null\n\n const bindings = collectBindings(body, localImports)\n if (bindings.size === 0) return null\n\n const referenced = collectTemplateReferences(descriptor.template.ast, bindings)\n if (referenced.size === 0) return null\n\n const magic = new MagicString(code)\n for (const name of referenced) {\n const entry = bindings.get(name)\n if (entry === undefined) continue\n injectMark(magic, entry.call, scriptOffset)\n }\n\n return {\n code: magic.toString(),\n map: magic.generateMap({ hires: true, source: id, includeContent: true }),\n }\n}\n\n/**\n * Walk top-level imports, recording the local names of `useForm` /\n * `injectForm` specifiers sourced from attaform-family packages.\n * Handles renamed imports (`import { useForm as makeForm }`) and\n * skips namespace + default imports (the runtime API surfaces both\n * functions as named exports).\n */\nfunction collectImports(body: readonly BabelNode[]): Map<string, 'useForm' | 'injectForm'> {\n const locals = new Map<string, 'useForm' | 'injectForm'>()\n for (const node of body) {\n if (node.type !== 'ImportDeclaration') continue\n const decl = node as ImportDeclarationNode\n const source = decl.source.value\n if (!TARGET_PACKAGES.has(source)) continue\n for (const specifier of decl.specifiers) {\n if (specifier.type !== 'ImportSpecifier') continue\n const spec = specifier as ImportSpecifierNode\n const imported = spec.imported\n const importedName = imported.type === 'Identifier' ? imported.name : imported.value\n if (importedName === undefined || !TARGET_FUNCTIONS.has(importedName)) continue\n locals.set(spec.local.name, importedName as 'useForm' | 'injectForm')\n }\n }\n return locals\n}\n\n/**\n * Walk top-level `const`/`let`/`var` declarations and record bindings\n * whose initializer is a direct call to one of the tracked imports.\n * Destructured returns (`const { register } = useForm(...)`) carry\n * no handle name and are skipped per the form-handle discipline.\n */\nfunction collectBindings(\n body: readonly BabelNode[],\n localImports: Map<string, 'useForm' | 'injectForm'>\n): Map<string, BindingEntry> {\n const bindings = new Map<string, BindingEntry>()\n for (const node of body) {\n if (node.type !== 'VariableDeclaration') continue\n const decl = node as VariableDeclarationNode\n for (const declarator of decl.declarations) {\n const id = declarator.id\n if (id.type !== 'Identifier') continue\n const idNode = id as IdentifierNode\n const init = declarator.init\n if (init === null || init === undefined || init.type !== 'CallExpression') continue\n const call = init as CallExpressionNode\n if (call.callee.type !== 'Identifier') continue\n const callName = (call.callee as IdentifierNode).name\n const tracked = localImports.get(callName)\n if (tracked === undefined) continue\n bindings.set(idNode.name, { callee: tracked, call })\n }\n }\n return bindings\n}\n\n/**\n * Walk the template AST collecting binding names referenced from any\n * expression slot — interpolations, directive expressions, attribute\n * bindings. Word-boundary matching against the expression source is\n * MVP-grade; the same lookup feeds the inject pass that follows.\n */\nfunction collectTemplateReferences(\n root: RootNode | undefined,\n bindings: Map<string, BindingEntry>\n): Set<string> {\n const referenced = new Set<string>()\n if (root === undefined) return referenced\n const candidates = new Set(bindings.keys())\n if (candidates.size === 0) return referenced\n\n const visit = (node: TemplateChildNode | RootNode): void => {\n if ('children' in node && Array.isArray(node.children)) {\n for (const child of node.children as TemplateChildNode[]) visit(child)\n }\n if (node.type === 5 /* INTERPOLATION */) {\n collectFromExpression(node.content, candidates, referenced)\n } else if (node.type === 1 /* ELEMENT */ && Array.isArray(node.props)) {\n for (const prop of node.props) {\n if (prop.type === 7 /* DIRECTIVE */) {\n if (prop.exp !== undefined && prop.exp !== null) {\n collectFromExpression(prop.exp, candidates, referenced)\n }\n if (prop.arg !== undefined && prop.arg !== null) {\n collectFromExpression(prop.arg, candidates, referenced)\n }\n }\n }\n }\n }\n visit(root)\n return referenced\n}\n\ninterface ExpressionLike {\n readonly type: number\n readonly content?: unknown\n readonly children?: readonly unknown[]\n}\n\nfunction collectFromExpression(\n expr: ExpressionLike | unknown,\n candidates: Set<string>,\n out: Set<string>\n): void {\n if (expr === null || expr === undefined) return\n if (typeof expr !== 'object') return\n const node = expr as ExpressionLike\n if (node.type === 4 /* SIMPLE_EXPRESSION */ && typeof node.content === 'string') {\n for (const name of candidates) {\n if (matchesIdentifier(node.content, name)) out.add(name)\n }\n return\n }\n if (node.type === 8 /* COMPOUND_EXPRESSION */ && Array.isArray(node.children)) {\n for (const child of node.children) collectFromExpression(child, candidates, out)\n }\n}\n\nfunction matchesIdentifier(source: string, name: string): boolean {\n // Word-boundary check against the expression's source. Covers\n // `form.values.email`, `form?.values`, `form()`, etc. without\n // false-matching `formData` or quoted-string occurrences in\n // unrelated subexpressions. False positives skew toward marking\n // forms that the template uses incidentally — acceptable because\n // marking enqueues SSR prefetch on a form the SFC already knows\n // about, not on any random form.\n const pattern = new RegExp(`(?<![\\\\w$])${escapeForRegExp(name)}(?![\\\\w$])`)\n return pattern.test(source)\n}\n\nfunction escapeForRegExp(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\n/**\n * Inject `__ssrAccessed: true` into the call's options literal.\n * Three shapes, in order of frequency:\n * - existing object literal arg → prepend the property after `{`\n * - string-shortcut for injectForm → upgrade to `{ key: ..., __ssrAccessed: true }`\n * - no args → insert a fresh `{ __ssrAccessed: true }`\n * Other shapes (spread, computed identifier, function call) bail —\n * the consumer's `form.activate()` escape hatch covers them.\n */\nfunction injectMark(magic: MagicString, call: CallExpressionNode, scriptOffset: number): void {\n const args = call.arguments\n if (args.length === 0) {\n const calleeEnd = call.callee.end\n if (calleeEnd === null || calleeEnd === undefined) return\n // Find the absolute offset right after the `(` opening paren.\n const openParenAbs = findChar(magic.original, '(', scriptOffset + calleeEnd) + 1\n magic.appendRight(openParenAbs, '{ __ssrAccessed: true }')\n return\n }\n const first = args[0]\n if (first === undefined) return\n if (first.type === 'ObjectExpression') {\n const obj = first as ObjectExpressionNode\n if (obj.start === null || obj.start === undefined) return\n const openBraceAbs = scriptOffset + obj.start + 1\n const insertion =\n obj.properties.length === 0 ? ' __ssrAccessed: true ' : ' __ssrAccessed: true,'\n magic.appendRight(openBraceAbs, insertion)\n return\n }\n if (first.type === 'StringLiteral') {\n const lit = first as StringLiteralNode\n if (lit.start === null || lit.start === undefined) return\n if (lit.end === null || lit.end === undefined) return\n const startAbs = scriptOffset + lit.start\n const endAbs = scriptOffset + lit.end\n const original = magic.original.slice(startAbs, endAbs)\n magic.overwrite(startAbs, endAbs, `{ key: ${original}, __ssrAccessed: true }`)\n return\n }\n // Unsupported arg shape (spread, identifier, etc.) — caller falls\n // back to explicit `form.activate()`.\n}\n\nfunction findChar(source: string, target: string, from: number): number {\n for (let i = from; i < source.length; i += 1) {\n if (source[i] === target) return i\n }\n return -1\n}\n","/**\n * `attaform/vite` — Vite plugin that wires the compile-time node\n * transforms with @vitejs/plugin-vue AND rewrites `attaform/zod`\n * imports to either `attaform/zod-v3` or `attaform/zod-v4` at build\n * time, based on the consumer's installed Zod major. The result is\n * one Zod adapter shipped per bundle, with no manual subpath choice.\n *\n * Usage (bare Vue 3 consumers):\n *\n * // vite.config.ts\n * import vue from '@vitejs/plugin-vue'\n * import { attaform } from 'attaform/vite'\n *\n * export default defineConfig({\n * plugins: [vue(), attaform()],\n * })\n *\n * The transforms inject `:value`, `:checked`, and `:selected` bindings\n * into elements that use the `v-register` directive — load-bearing for\n * SSR initial-render correctness. Omitting this plugin under CSR is\n * tolerable (one-frame flash on mount); omitting it under SSR produces\n * visibly wrong initial HTML.\n *\n * The `resolveZodAlias` option (default `true`) controls the build-time\n * `attaform/zod` rewrite. Set to `false` if your project intentionally\n * mixes Zod versions or has a non-standard Zod resolution; the unified\n * `attaform/zod` entry's runtime dispatch covers that case at the cost\n * of bundling both adapters.\n *\n * Implementation note: this plugin mutates @vitejs/plugin-vue's options\n * via the documented but somewhat informal `api.options` surface used\n * by VueUse, Vite PWA, and other Vue ecosystem plugins. If you're\n * using a custom Vue plugin wrapper, fall back to `attaform/transforms`\n * and wire them yourself.\n */\nimport { readFileSync } from 'node:fs'\nimport { fileURLToPath, pathToFileURL } from 'node:url'\nimport { join } from 'node:path'\nimport type { Plugin } from 'vite'\nimport { inputTextAreaNodeTransform } from './runtime/lib/core/transforms/input-text-area-transform'\nimport { selectNodeTransform } from './runtime/lib/core/transforms/select-transform'\nimport { vRegisterHintTransform } from './runtime/lib/core/transforms/v-register-hint-transform'\nimport { vRegisterPreambleTransform } from './runtime/lib/core/transforms/v-register-preamble-transform'\nimport { transformSsrAccessed } from './runtime/lib/core/transforms/ssr-accessed-transform'\n\n/** Options for `attaform()`. */\nexport interface AttaformVitePluginOptions {\n /**\n * Rewrite `attaform/zod` imports at build time to either\n * `attaform/zod-v3` or `attaform/zod-v4`, based on the consumer's\n * installed Zod major. Default `true` — produces a leaner bundle\n * for the common case of one Zod version per project.\n *\n * Set to `false` to fall through to the unified entry's runtime\n * dispatch. Useful when:\n * - your project intentionally has both `zod` and `zod-v3`\n * installed (e.g. via a pnpm alias) and the schema-shape\n * dispatch is the right behavior;\n * - your monorepo's Zod resolution is non-standard and the\n * plugin's detection (`import.meta.resolve('zod/package.json')`)\n * would land on the wrong copy.\n */\n resolveZodAlias?: boolean\n}\n\ninterface VitePluginVueApi {\n options?: {\n template?: {\n compilerOptions?: {\n nodeTransforms?: unknown[]\n }\n }\n }\n}\n\nconst ZOD_UNIFIED_SPECIFIER = 'attaform/zod'\nconst ZOD_V3_SPECIFIER = 'attaform/zod-v3'\nconst ZOD_V4_SPECIFIER = 'attaform/zod-v4'\n\n/**\n * Read the consumer's installed Zod major by resolving\n * `zod/package.json` from their project root. ESM resolution\n * (`import.meta.resolve`) is sync and stable on Node 20.6+, follows\n * pnpm symlinks, and works with attaform's ESM-only `exports` map.\n *\n * Returns:\n * - `{ major: 3 | 4 }` when zod is resolvable AND its `version`\n * field parses to a known major;\n * - `{ major: 'missing' }` when zod can't be resolved at all;\n * - `{ major: 'unknown' }` for any other failure (corrupted\n * package.json, unexpected version string, monorepo edge case).\n */\nfunction detectZodMajor(\n consumerRootDir: string\n): { major: 3 } | { major: 4 } | { major: 'missing' } | { major: 'unknown' } {\n const consumerURL = pathToFileURL(join(consumerRootDir, 'package.json')).href\n let resolved: string\n try {\n resolved = import.meta.resolve('zod/package.json', consumerURL)\n } catch {\n return { major: 'missing' }\n }\n try {\n const pkg = JSON.parse(readFileSync(fileURLToPath(resolved), 'utf8')) as { version?: unknown }\n const version = pkg.version\n if (typeof version !== 'string') return { major: 'unknown' }\n const major = Number.parseInt(version.split('.')[0] ?? '', 10)\n if (major === 3) return { major: 3 }\n if (major === 4) return { major: 4 }\n return { major: 'unknown' }\n } catch {\n return { major: 'unknown' }\n }\n}\n\n/**\n * Vite plugin that wires the form library's compile-time template\n * transforms into `@vitejs/plugin-vue` and rewrites the unified\n * `attaform/zod` import to the matching adapter subpath. Required\n * for SSR and for hydration accuracy under bare Vue 3.\n *\n * ```ts\n * // vite.config.ts\n * import vue from '@vitejs/plugin-vue'\n * import { attaform } from 'attaform/vite'\n *\n * export default defineConfig({\n * plugins: [vue(), attaform()],\n * })\n * ```\n *\n * Place the call after `vue()` in the plugins array. Nuxt projects\n * don't need this — `attaform/nuxt` handles it.\n */\nexport function attaform(options: AttaformVitePluginOptions = {}): Plugin {\n const resolveZodAlias = options.resolveZodAlias !== false\n // Resolution is computed once per plugin instance from the resolved\n // Vite root in `configResolved`, then cached for every `resolveId`\n // call (the hook fires many times during dev/build).\n let aliasTarget: string | null = null\n let warnedAboutDetection = false\n\n return {\n name: 'attaform',\n enforce: 'pre',\n configResolved(resolved) {\n const vuePlugin = resolved.plugins.find((p) => p.name === 'vite:vue')\n // Two distinct failure modes — separate error messages so the\n // consumer's fix is unambiguous:\n // 1. plugin not in the plugins array → install + register vue()\n // 2. plugin found but version-incompatible (no `api.options`) →\n // version mismatch with @vitejs/plugin-vue\n if (vuePlugin === undefined) {\n throw new Error(\n '[attaform/vite] @vitejs/plugin-vue is not installed (or not registered before attaform()). ' +\n 'Install @vitejs/plugin-vue and place `attaform()` after `vue()` in your plugins array.'\n )\n }\n const api = (vuePlugin as unknown as { api?: VitePluginVueApi }).api\n if (api?.options === undefined) {\n throw new Error(\n '[attaform/vite] Found @vitejs/plugin-vue but it does not expose `api.options`. ' +\n 'This usually means a version-incompatible @vitejs/plugin-vue (or a wrapper plugin re-exporting it). ' +\n 'Pin @vitejs/plugin-vue to a version compatible with the documented `api.options.template.compilerOptions.nodeTransforms` surface.'\n )\n }\n api.options.template ??= {}\n api.options.template.compilerOptions ??= {}\n const existing = api.options.template.compilerOptions.nodeTransforms ?? []\n // Idempotent install: if a previous attaform() invocation\n // (vite + nuxt module + manual `plugins: [attaform()]`) has\n // already pushed our transforms, skip — re-pushing would double\n // every binding the AST emits, breaking the IIFE-wrapping\n // invariants downstream transforms depend on. We detect the\n // sentinel via reference equality; user-supplied transforms with\n // the same name don't collide.\n if (!existing.includes(vRegisterPreambleTransform as unknown)) {\n // vRegisterPreambleTransform MUST come before vRegisterHintTransform\n // — the preamble's pre-order captures each `v-register` expression\n // in its raw (un-wrapped) form, and the hint then mutates the same\n // directive's `exp` to wrap it. Reversing the order would have the\n // preamble pick up an already-wrapped IIFE, double-wrapping it\n // when injected at the root.\n api.options.template.compilerOptions.nodeTransforms = [\n ...existing,\n selectNodeTransform,\n inputTextAreaNodeTransform,\n vRegisterPreambleTransform,\n vRegisterHintTransform,\n ]\n }\n\n // Build-time alias resolution. Skip cleanly when the user opted\n // out so consumers with non-standard Zod setups don't see a\n // \"zod is not installed\" error from this plugin.\n if (!resolveZodAlias) return\n const detection = detectZodMajor(resolved.root)\n if (detection.major === 'missing') {\n throw new Error(\n '[attaform/vite] zod is not installed. attaform requires zod as a peer dependency. ' +\n 'Install `zod@^3` or `zod@^4`, OR pass `attaform({ resolveZodAlias: false })` ' +\n 'to keep the runtime-dispatch unified entry (and silence this check).'\n )\n }\n if (detection.major === 'unknown') {\n // Detection landed on a zod resolution but couldn't classify\n // the version — log once and fall through to runtime dispatch.\n // The build still works; the consumer just ships both adapters.\n if (!warnedAboutDetection) {\n warnedAboutDetection = true\n console.warn(\n '[attaform/vite] Could not classify the installed Zod major (corrupted package.json, ' +\n 'monorepo edge case, or an unexpected version string). Falling through to runtime ' +\n 'dispatch — both Zod adapters will ship in the bundle. ' +\n 'Pass `attaform({ resolveZodAlias: false })` to silence this warning.'\n )\n }\n return\n }\n aliasTarget = detection.major === 4 ? ZOD_V4_SPECIFIER : ZOD_V3_SPECIFIER\n },\n configureServer(server) {\n // Dev-only middleware that serves the Nuxt DevTools overlay panel's\n // iframe HTML at `/_attaform_devtools`. The middleware lives at the\n // Vite layer so the route is intercepted BEFORE vue-router sees it —\n // crucial for consumers using `app.vue`-only (no `pages/` directory).\n // Earlier prototypes injected a Nuxt page via `extendPages`, which\n // implicitly activates Nuxt's pages mode and broke app.vue-only\n // setups by stranding `/` without a NuxtPage host.\n //\n // The HTML pulls Vue + the panel component via bare specifiers;\n // `transformIndexHtml` rewrites them through Vite's resolver so the\n // browser-side `<script type=\"module\">` runs cleanly. Production\n // builds skip the middleware entirely — `configureServer` only\n // fires for the dev server.\n server.middlewares.use(\n '/_attaform_devtools',\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n async (req, res, next) => {\n if (req.method !== 'GET') {\n next()\n return\n }\n // Brand mark served at `/_attaform_devtools/icon.svg` and\n // referenced by the module's `addCustomTab({ icon })`. Data:\n // URIs render unreliably across Nuxt DevTools versions; a real\n // URL is the robust path.\n if (req.url === '/icon.svg') {\n const svg =\n `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">` +\n `<rect width=\"24\" height=\"24\" rx=\"5\" fill=\"#6938ef\"/>` +\n `<g fill=\"none\" stroke=\"#ffffff\" stroke-width=\"2.25\" stroke-linecap=\"round\" stroke-linejoin=\"round\">` +\n `<path d=\"M8 16 L12 8 L16 16\"/>` +\n `<path d=\"M9.5 13 L14.5 13\"/>` +\n `</g></svg>`\n res.setHeader('Content-Type', 'image/svg+xml; charset=utf-8')\n res.setHeader('Cache-Control', 'public, max-age=3600')\n res.end(svg)\n return\n }\n try {\n const rawHtml = `<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <title>Attaform DevTools</title>\n <style>\n html, body { height: 100%; margin: 0; background: #0f172a; }\n @media (prefers-color-scheme: light) {\n html, body { background: #ffffff; }\n }\n #atf-loading {\n padding: 1rem;\n color: #94a3b8;\n font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;\n font-size: 13px;\n }\n </style>\n </head>\n <body>\n <div id=\"atf-app\"><div id=\"atf-loading\">Loading Attaform DevTools…</div></div>\n <script type=\"module\">\n import { createApp, h } from 'vue'\n import AttaformDevtoolsPanel from 'attaform/devtools-panel'\n\n // The panel runs inside Nuxt DevTools' overlay iframe, which itself\n // is nested in the consumer's main page. \\`window.parent\\` only\n // crosses one frame boundary — the overlay UI — which doesn't have\n // the bridge attached. The bridge lives on the consumer's main\n // page, which sits at the top of the frame hierarchy. Walk the\n // chain checking each ancestor frame so the same code works whether\n // the panel is opened in 0, 1, or 2+ iframe layers deep.\n //\n // Same-origin assumption holds (everything served from the dev\n // server's origin) so cross-frame property access doesn't throw.\n // If a future Nuxt DevTools build sandboxes the overlay iframe,\n // the try/catch falls through to the empty-bridge path with a\n // clear \"not found\" message.\n function findBridge() {\n let frame = window\n for (let depth = 0; depth < 10; depth++) {\n try {\n const candidate = frame.__attaform_devtools__\n if (candidate !== undefined) return candidate\n } catch {\n return undefined\n }\n if (frame.parent === frame) return undefined\n frame = frame.parent\n }\n return undefined\n }\n\n const start = Date.now()\n function bootstrap() {\n const bridge = findBridge()\n if (bridge !== undefined) {\n const root = document.getElementById('atf-app')\n root.innerHTML = ''\n createApp({ render: () => h(AttaformDevtoolsPanel, { bridge }) }).mount(root)\n return\n }\n if (Date.now() - start < 2000) {\n setTimeout(bootstrap, 50)\n return\n }\n document.getElementById('atf-loading').textContent =\n 'Attaform devtools bridge not found. The host app may not have the Nuxt module installed.'\n }\n bootstrap()\n </script>\n </body>\n</html>`\n const html = await server.transformIndexHtml('/_attaform_devtools', rawHtml)\n res.setHeader('Content-Type', 'text/html; charset=utf-8')\n res.end(html)\n } catch (err) {\n next(err)\n }\n }\n )\n },\n async resolveId(source, importer) {\n // Intercept ONLY the exact unified specifier. Explicit subpaths\n // (`attaform/zod-v3`, `attaform/zod-v4`) and the root entry\n // (`attaform`) pass through unchanged — that's the documented\n // escape hatch for power users.\n if (!resolveZodAlias) return null\n if (aliasTarget === null) return null\n if (source !== ZOD_UNIFIED_SPECIFIER) return null\n // Returning the bare specifier directly would freeze it as the\n // resolved id — Vite then ships `/@id/attaform/zod-v4` to the\n // browser and 404s because no plugin loads that virtual URL.\n // Re-run the new specifier through the resolver chain so the\n // matching subpath export lands as a real file path.\n // `skipSelf: true` is defensive — our filter rejects the rewritten\n // target anyway, but keeps the hook reentrant under future edits.\n return this.resolve(aliasTarget, importer, { skipSelf: true })\n },\n transform(code, id) {\n // SFC pre-pass: when a `<script setup>` binds `useForm` or\n // `injectForm` and the surrounding `<template>` references that\n // binding, inject `__ssrAccessed: true` into the call's options\n // bag. The runtime registry uses the flag to enqueue the form\n // on the SSR prefetch queue before `onServerPrefetch` fires.\n // Runs ahead of `@vitejs/plugin-vue` thanks to `enforce: 'pre'`\n // so its rewrites are part of the source the Vue plugin sees.\n return transformSsrAccessed(code, id)\n },\n }\n}\n"],"names":["parseSfc","babelParse","MagicString","pathToFileURL","join","readFileSync","fileURLToPath","vRegisterPreambleTransform","selectNodeTransform","inputTextAreaNodeTransform","vRegisterHintTransform"],"mappings":";;;;;;;;;;;;;AAgEA,MAAM,eAAA,uBAAsB,GAAA,CAAI,CAAC,YAAY,cAAA,EAAgB,iBAAA,EAAmB,iBAAiB,CAAC,CAAA;AAClG,MAAM,mCAAmB,IAAI,GAAA,CAAI,CAAC,SAAA,EAAW,YAAY,CAAC,CAAA;AAiBnD,SAAS,oBAAA,CAAqB,MAAc,EAAA,EAA+C;AAChG,EAAA,IAAI,CAAC,EAAA,CAAG,QAAA,CAAS,MAAM,GAAG,OAAO,IAAA;AAEjC,EAAA,MAAM,EAAE,YAAW,GAAIA,iBAAA,CAAS,MAAM,EAAE,QAAA,EAAU,IAAI,CAAA;AACtD,EAAA,IAAI,WAAW,WAAA,KAAgB,IAAA,IAAQ,UAAA,CAAW,QAAA,KAAa,MAAM,OAAO,IAAA;AAE5E,EAAA,MAAM,YAAA,GAAe,WAAW,WAAA,CAAY,OAAA;AAC5C,EAAA,MAAM,YAAA,GAAe,UAAA,CAAW,WAAA,CAAY,GAAA,CAAI,KAAA,CAAM,MAAA;AAEtD,EAAA,IAAI,SAAA;AACJ,EAAA,IAAI;AACF,IAAA,SAAA,GAAYC,uBAAW,YAAA,EAAc;AAAA,MACnC,UAAA,EAAY,QAAA;AAAA,MACZ,OAAA,EAAS,CAAC,YAAY;AAAA,KACvB,CAAA;AAAA,EACH,CAAA,CAAA,MAAQ;AAIN,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,MAAM,OAAA,GAAW,UAAsC,OAAA,IAAW,SAAA;AAClE,EAAA,MAAM,IAAA,GAAQ,OAA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