attaform 0.17.2 → 0.18.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/README.md +77 -36
- package/dist/chunks/devtools.cjs +10 -37
- package/dist/chunks/devtools.cjs.map +1 -1
- package/dist/chunks/devtools.mjs +10 -37
- package/dist/chunks/devtools.mjs.map +1 -1
- package/dist/chunks/indexeddb.cjs +4 -4
- package/dist/chunks/indexeddb.cjs.map +1 -1
- package/dist/chunks/indexeddb.mjs +1 -1
- package/dist/chunks/local-storage.cjs +2 -2
- package/dist/chunks/local-storage.cjs.map +1 -1
- package/dist/chunks/local-storage.mjs +1 -1
- package/dist/chunks/session-storage.cjs +2 -2
- package/dist/chunks/session-storage.cjs.map +1 -1
- package/dist/chunks/session-storage.mjs +1 -1
- package/dist/index.cjs +42 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +159 -196
- package/dist/index.d.mts +159 -196
- package/dist/index.d.ts +159 -196
- package/dist/index.mjs +5 -7
- package/dist/index.mjs.map +1 -1
- package/dist/nuxt.cjs +31 -40
- package/dist/nuxt.cjs.map +1 -1
- package/dist/nuxt.d.cts +8 -1
- package/dist/nuxt.d.mts +8 -1
- package/dist/nuxt.d.ts +8 -1
- package/dist/nuxt.mjs +32 -41
- package/dist/nuxt.mjs.map +1 -1
- package/dist/runtime/components/AttaformDevtoolsPanel.d.vue.ts +7 -0
- package/dist/runtime/components/AttaformDevtoolsPanel.vue +453 -0
- package/dist/runtime/components/AttaformDevtoolsPanel.vue.d.ts +7 -0
- package/dist/runtime/components/DevtoolsValueTree.d.vue.ts +37 -0
- package/dist/runtime/components/DevtoolsValueTree.vue +192 -0
- package/dist/runtime/components/DevtoolsValueTree.vue.d.ts +37 -0
- package/dist/runtime/plugins/attaform.cjs +17 -6
- package/dist/runtime/plugins/attaform.cjs.map +1 -1
- package/dist/runtime/plugins/attaform.mjs +15 -4
- package/dist/runtime/plugins/attaform.mjs.map +1 -1
- package/dist/shared/{attaform.C0iFnTN0.d.ts → attaform.2b7M2mww.d.mts} +57 -23
- package/dist/shared/attaform.5UhpSVFI.cjs +63 -0
- package/dist/shared/attaform.5UhpSVFI.cjs.map +1 -0
- package/dist/shared/attaform.BDdFdjeX.mjs +57 -0
- package/dist/shared/attaform.BDdFdjeX.mjs.map +1 -0
- package/dist/shared/{attaform.Dee2rU1P.cjs → attaform.BqK_L4gK.cjs} +310 -24
- package/dist/shared/attaform.BqK_L4gK.cjs.map +1 -0
- package/dist/shared/attaform.Bubm_slq.cjs.map +1 -1
- package/dist/shared/attaform.CXpzmj38.mjs.map +1 -1
- package/dist/shared/{attaform.Drt6fivF.mjs → attaform.CtNUB9nf.mjs} +74 -76
- package/dist/shared/attaform.CtNUB9nf.mjs.map +1 -0
- package/dist/shared/{attaform.C5MH4lNh.d.mts → attaform.DF8wo-ry.d.ts} +4 -4
- package/dist/shared/attaform.DK9aj0N8.d.ts +1651 -0
- package/dist/shared/{attaform.BPRHR3Zs.cjs → attaform.DUHru0OF.cjs} +83 -85
- package/dist/shared/attaform.DUHru0OF.cjs.map +1 -0
- package/dist/shared/{attaform.C6lbmMUe.d.ts → attaform.DVLB6CAn.d.mts} +4 -4
- package/dist/shared/{attaform.C_5aB6EQ.d.ts → attaform.Dj9mwbaV.d.cts} +756 -148
- package/dist/shared/{attaform.C_5aB6EQ.d.mts → attaform.Dj9mwbaV.d.mts} +756 -148
- package/dist/shared/{attaform.C_5aB6EQ.d.cts → attaform.Dj9mwbaV.d.ts} +756 -148
- package/dist/shared/{attaform.BV40t5y2.cjs → attaform.Dlk1jMuv.cjs} +245 -108
- package/dist/shared/attaform.Dlk1jMuv.cjs.map +1 -0
- package/dist/shared/attaform.DoSuaKMd.d.cts +1651 -0
- package/dist/shared/{attaform.B3ZaPIzS.mjs → attaform.DsC3rZHG.mjs} +1804 -219
- package/dist/shared/attaform.DsC3rZHG.mjs.map +1 -0
- package/dist/shared/{attaform.Cer8JO_P.cjs → attaform.II89Pcf4.cjs} +1860 -272
- package/dist/shared/attaform.II89Pcf4.cjs.map +1 -0
- package/dist/shared/{attaform.CHorcsIU.d.cts → attaform.M33WKVV4.d.cts} +57 -23
- package/dist/shared/{attaform.CIEQgJnM.mjs → attaform.Xhg0AYNa.mjs} +300 -26
- package/dist/shared/attaform.Xhg0AYNa.mjs.map +1 -0
- package/dist/shared/{attaform.CpERWz3u.mjs → attaform.Xt0A3QUd.mjs} +232 -95
- package/dist/shared/attaform.Xt0A3QUd.mjs.map +1 -0
- package/dist/shared/attaform.iTqxvl-P.d.mts +1651 -0
- package/dist/shared/{attaform.CuE-bS1C.d.mts → attaform.tsNFcEW7.d.ts} +57 -23
- package/dist/shared/{attaform.DtMN-MAm.d.cts → attaform.tts_OM7j.d.cts} +4 -4
- package/dist/vite.cjs +288 -2
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +288 -2
- package/dist/vite.mjs.map +1 -1
- package/dist/zod-v3.cjs +11 -8
- package/dist/zod-v3.cjs.map +1 -1
- package/dist/zod-v3.d.cts +6 -6
- package/dist/zod-v3.d.mts +6 -6
- package/dist/zod-v3.d.ts +6 -6
- package/dist/zod-v3.mjs +3 -3
- package/dist/zod-v4.cjs +11 -8
- package/dist/zod-v4.cjs.map +1 -1
- package/dist/zod-v4.d.cts +5 -5
- package/dist/zod-v4.d.mts +5 -5
- package/dist/zod-v4.d.ts +5 -5
- package/dist/zod-v4.mjs +3 -3
- package/dist/zod.cjs +15 -16
- package/dist/zod.cjs.map +1 -1
- package/dist/zod.d.cts +127 -40
- package/dist/zod.d.mts +127 -40
- package/dist/zod.d.ts +127 -40
- package/dist/zod.mjs +7 -11
- package/dist/zod.mjs.map +1 -1
- package/package.json +18 -7
- package/dist/shared/attaform.B1jvxsOF.d.mts +0 -156
- package/dist/shared/attaform.B3ZaPIzS.mjs.map +0 -1
- package/dist/shared/attaform.BBM2muQ9.cjs +0 -101
- package/dist/shared/attaform.BBM2muQ9.cjs.map +0 -1
- package/dist/shared/attaform.BPRHR3Zs.cjs.map +0 -1
- package/dist/shared/attaform.BV40t5y2.cjs.map +0 -1
- package/dist/shared/attaform.C6qzEdIM.d.cts +0 -156
- package/dist/shared/attaform.C8LVFVVe.cjs +0 -32
- package/dist/shared/attaform.C8LVFVVe.cjs.map +0 -1
- package/dist/shared/attaform.CIEQgJnM.mjs.map +0 -1
- package/dist/shared/attaform.CTwNcpLE.d.ts +0 -156
- package/dist/shared/attaform.Cer8JO_P.cjs.map +0 -1
- package/dist/shared/attaform.CpERWz3u.mjs.map +0 -1
- package/dist/shared/attaform.Dee2rU1P.cjs.map +0 -1
- package/dist/shared/attaform.Drt6fivF.mjs.map +0 -1
- package/dist/shared/attaform.Vo-Kft0t.mjs +0 -29
- package/dist/shared/attaform.Vo-Kft0t.mjs.map +0 -1
- package/dist/shared/attaform.h1sq3BFu.mjs +0 -92
- package/dist/shared/attaform.h1sq3BFu.mjs.map +0 -1
package/dist/vite.mjs
CHANGED
|
@@ -2,6 +2,190 @@ import { readFileSync } from 'node:fs';
|
|
|
2
2
|
import { pathToFileURL, fileURLToPath } from 'node:url';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { a as vRegisterPreambleTransform, s as selectNodeTransform, i as inputTextAreaNodeTransform, v as vRegisterHintTransform } from './shared/attaform.CXpzmj38.mjs';
|
|
5
|
+
import { parse, babelParse } from '@vue/compiler-sfc';
|
|
6
|
+
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
10
|
+
const TARGET_PACKAGES = /* @__PURE__ */ new Set(["attaform", "attaform/zod", "attaform/zod-v3", "attaform/zod-v4"]);
|
|
11
|
+
const TARGET_FUNCTIONS = /* @__PURE__ */ new Set(["useForm", "injectForm"]);
|
|
12
|
+
class SourceEditor {
|
|
13
|
+
constructor(original) {
|
|
14
|
+
__publicField(this, "original");
|
|
15
|
+
__publicField(this, "edits", []);
|
|
16
|
+
this.original = original;
|
|
17
|
+
}
|
|
18
|
+
appendRight(offset, text) {
|
|
19
|
+
this.edits.push({ start: offset, end: offset, replacement: text });
|
|
20
|
+
}
|
|
21
|
+
overwrite(start, end, text) {
|
|
22
|
+
this.edits.push({ start, end, replacement: text });
|
|
23
|
+
}
|
|
24
|
+
toString() {
|
|
25
|
+
let out = this.original;
|
|
26
|
+
for (const e of [...this.edits].sort((a, b) => b.start - a.start)) {
|
|
27
|
+
out = out.slice(0, e.start) + e.replacement + out.slice(e.end);
|
|
28
|
+
}
|
|
29
|
+
return out;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function transformSsrAccessed(code, id) {
|
|
33
|
+
if (!id.endsWith(".vue")) return null;
|
|
34
|
+
const { descriptor } = parse(code, { filename: id });
|
|
35
|
+
if (descriptor.scriptSetup === null || descriptor.template === null) return null;
|
|
36
|
+
const scriptSource = descriptor.scriptSetup.content;
|
|
37
|
+
const scriptOffset = descriptor.scriptSetup.loc.start.offset;
|
|
38
|
+
let scriptAst;
|
|
39
|
+
try {
|
|
40
|
+
scriptAst = babelParse(scriptSource, {
|
|
41
|
+
sourceType: "module",
|
|
42
|
+
plugins: ["typescript"]
|
|
43
|
+
});
|
|
44
|
+
} catch {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const program = scriptAst.program ?? scriptAst;
|
|
48
|
+
const body = program.body ?? [];
|
|
49
|
+
const localImports = collectImports(body);
|
|
50
|
+
if (localImports.size === 0) return null;
|
|
51
|
+
const bindings = collectBindings(body, localImports);
|
|
52
|
+
if (bindings.size === 0) return null;
|
|
53
|
+
const referenced = collectTemplateReferences(descriptor.template.ast, bindings);
|
|
54
|
+
if (referenced.size === 0) return null;
|
|
55
|
+
const editor = new SourceEditor(code);
|
|
56
|
+
for (const name of referenced) {
|
|
57
|
+
const entry = bindings.get(name);
|
|
58
|
+
if (entry === void 0) continue;
|
|
59
|
+
injectMark(editor, entry.call, scriptOffset);
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
code: editor.toString(),
|
|
63
|
+
map: null
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function collectImports(body) {
|
|
67
|
+
const locals = /* @__PURE__ */ new Map();
|
|
68
|
+
for (const node of body) {
|
|
69
|
+
if (node.type !== "ImportDeclaration") continue;
|
|
70
|
+
const decl = node;
|
|
71
|
+
const source = decl.source.value;
|
|
72
|
+
if (!TARGET_PACKAGES.has(source)) continue;
|
|
73
|
+
for (const specifier of decl.specifiers) {
|
|
74
|
+
if (specifier.type !== "ImportSpecifier") continue;
|
|
75
|
+
const spec = specifier;
|
|
76
|
+
const imported = spec.imported;
|
|
77
|
+
const importedName = imported.type === "Identifier" ? imported.name : imported.value;
|
|
78
|
+
if (importedName === void 0 || !TARGET_FUNCTIONS.has(importedName)) continue;
|
|
79
|
+
locals.set(spec.local.name, importedName);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return locals;
|
|
83
|
+
}
|
|
84
|
+
function collectBindings(body, localImports) {
|
|
85
|
+
const bindings = /* @__PURE__ */ new Map();
|
|
86
|
+
for (const node of body) {
|
|
87
|
+
if (node.type !== "VariableDeclaration") continue;
|
|
88
|
+
const decl = node;
|
|
89
|
+
for (const declarator of decl.declarations) {
|
|
90
|
+
const id = declarator.id;
|
|
91
|
+
if (id.type !== "Identifier") continue;
|
|
92
|
+
const idNode = id;
|
|
93
|
+
const init = declarator.init;
|
|
94
|
+
if (init === null || init === void 0 || init.type !== "CallExpression") continue;
|
|
95
|
+
const call = init;
|
|
96
|
+
if (call.callee.type !== "Identifier") continue;
|
|
97
|
+
const callName = call.callee.name;
|
|
98
|
+
const tracked = localImports.get(callName);
|
|
99
|
+
if (tracked === void 0) continue;
|
|
100
|
+
bindings.set(idNode.name, { callee: tracked, call });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return bindings;
|
|
104
|
+
}
|
|
105
|
+
function collectTemplateReferences(root, bindings) {
|
|
106
|
+
const referenced = /* @__PURE__ */ new Set();
|
|
107
|
+
if (root === void 0) return referenced;
|
|
108
|
+
const candidates = new Set(bindings.keys());
|
|
109
|
+
if (candidates.size === 0) return referenced;
|
|
110
|
+
const visit = (node) => {
|
|
111
|
+
if ("children" in node && Array.isArray(node.children)) {
|
|
112
|
+
for (const child of node.children) visit(child);
|
|
113
|
+
}
|
|
114
|
+
if (node.type === 5) {
|
|
115
|
+
collectFromExpression(node.content, candidates, referenced);
|
|
116
|
+
} else if (node.type === 1 && Array.isArray(node.props)) {
|
|
117
|
+
for (const prop of node.props) {
|
|
118
|
+
if (prop.type === 7) {
|
|
119
|
+
if (prop.exp !== void 0 && prop.exp !== null) {
|
|
120
|
+
collectFromExpression(prop.exp, candidates, referenced);
|
|
121
|
+
}
|
|
122
|
+
if (prop.arg !== void 0 && prop.arg !== null) {
|
|
123
|
+
collectFromExpression(prop.arg, candidates, referenced);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
visit(root);
|
|
130
|
+
return referenced;
|
|
131
|
+
}
|
|
132
|
+
function collectFromExpression(expr, candidates, out) {
|
|
133
|
+
if (expr === null || expr === void 0) return;
|
|
134
|
+
if (typeof expr !== "object") return;
|
|
135
|
+
const node = expr;
|
|
136
|
+
if (node.type === 4 && typeof node.content === "string") {
|
|
137
|
+
for (const name of candidates) {
|
|
138
|
+
if (matchesIdentifier(node.content, name)) out.add(name);
|
|
139
|
+
}
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (node.type === 8 && Array.isArray(node.children)) {
|
|
143
|
+
for (const child of node.children) collectFromExpression(child, candidates, out);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function matchesIdentifier(source, name) {
|
|
147
|
+
const pattern = new RegExp(`(?<![\\w$])${escapeForRegExp(name)}(?![\\w$])`);
|
|
148
|
+
return pattern.test(source);
|
|
149
|
+
}
|
|
150
|
+
function escapeForRegExp(value) {
|
|
151
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
152
|
+
}
|
|
153
|
+
function injectMark(editor, call, scriptOffset) {
|
|
154
|
+
const args = call.arguments;
|
|
155
|
+
if (args.length === 0) {
|
|
156
|
+
const calleeEnd = call.callee.end;
|
|
157
|
+
if (calleeEnd === null || calleeEnd === void 0) return;
|
|
158
|
+
const openParenAbs = findChar(editor.original, "(", scriptOffset + calleeEnd) + 1;
|
|
159
|
+
editor.appendRight(openParenAbs, "{ __ssrAccessed: true }");
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const first = args[0];
|
|
163
|
+
if (first === void 0) return;
|
|
164
|
+
if (first.type === "ObjectExpression") {
|
|
165
|
+
const obj = first;
|
|
166
|
+
if (obj.start === null || obj.start === void 0) return;
|
|
167
|
+
const openBraceAbs = scriptOffset + obj.start + 1;
|
|
168
|
+
const insertion = obj.properties.length === 0 ? " __ssrAccessed: true " : " __ssrAccessed: true,";
|
|
169
|
+
editor.appendRight(openBraceAbs, insertion);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
if (first.type === "StringLiteral") {
|
|
173
|
+
const lit = first;
|
|
174
|
+
if (lit.start === null || lit.start === void 0) return;
|
|
175
|
+
if (lit.end === null || lit.end === void 0) return;
|
|
176
|
+
const startAbs = scriptOffset + lit.start;
|
|
177
|
+
const endAbs = scriptOffset + lit.end;
|
|
178
|
+
const original = editor.original.slice(startAbs, endAbs);
|
|
179
|
+
editor.overwrite(startAbs, endAbs, `{ key: ${original}, __ssrAccessed: true }`);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
function findChar(source, target, from) {
|
|
184
|
+
for (let i = from; i < source.length; i += 1) {
|
|
185
|
+
if (source[i] === target) return i;
|
|
186
|
+
}
|
|
187
|
+
return -1;
|
|
188
|
+
}
|
|
5
189
|
|
|
6
190
|
const ZOD_UNIFIED_SPECIFIER = "attaform/zod";
|
|
7
191
|
const ZOD_V3_SPECIFIER = "attaform/zod-v3";
|
|
@@ -77,11 +261,113 @@ function attaform(options = {}) {
|
|
|
77
261
|
}
|
|
78
262
|
aliasTarget = detection.major === 4 ? ZOD_V4_SPECIFIER : ZOD_V3_SPECIFIER;
|
|
79
263
|
},
|
|
80
|
-
|
|
264
|
+
configureServer(server) {
|
|
265
|
+
server.middlewares.use(
|
|
266
|
+
"/_attaform_devtools",
|
|
267
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
268
|
+
async (req, res, next) => {
|
|
269
|
+
if (req.method !== "GET") {
|
|
270
|
+
next();
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
if (req.url === "/icon.svg") {
|
|
274
|
+
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>`;
|
|
275
|
+
res.setHeader("Content-Type", "image/svg+xml; charset=utf-8");
|
|
276
|
+
res.setHeader("Cache-Control", "public, max-age=3600");
|
|
277
|
+
res.end(svg);
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
try {
|
|
281
|
+
const rawHtml = `<!DOCTYPE html>
|
|
282
|
+
<html lang="en">
|
|
283
|
+
<head>
|
|
284
|
+
<meta charset="UTF-8" />
|
|
285
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
286
|
+
<title>Attaform DevTools</title>
|
|
287
|
+
<style>
|
|
288
|
+
html, body { height: 100%; margin: 0; background: #0f172a; }
|
|
289
|
+
@media (prefers-color-scheme: light) {
|
|
290
|
+
html, body { background: #ffffff; }
|
|
291
|
+
}
|
|
292
|
+
#atf-loading {
|
|
293
|
+
padding: 1rem;
|
|
294
|
+
color: #94a3b8;
|
|
295
|
+
font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
|
|
296
|
+
font-size: 13px;
|
|
297
|
+
}
|
|
298
|
+
</style>
|
|
299
|
+
</head>
|
|
300
|
+
<body>
|
|
301
|
+
<div id="atf-app"><div id="atf-loading">Loading Attaform DevTools\u2026</div></div>
|
|
302
|
+
<script type="module">
|
|
303
|
+
import { createApp, h } from 'vue'
|
|
304
|
+
import AttaformDevtoolsPanel from 'attaform/devtools-panel'
|
|
305
|
+
|
|
306
|
+
// The panel runs inside Nuxt DevTools' overlay iframe, which itself
|
|
307
|
+
// is nested in the consumer's main page. \`window.parent\` only
|
|
308
|
+
// crosses one frame boundary \u2014 the overlay UI \u2014 which doesn't have
|
|
309
|
+
// the bridge attached. The bridge lives on the consumer's main
|
|
310
|
+
// page, which sits at the top of the frame hierarchy. Walk the
|
|
311
|
+
// chain checking each ancestor frame so the same code works whether
|
|
312
|
+
// the panel is opened in 0, 1, or 2+ iframe layers deep.
|
|
313
|
+
//
|
|
314
|
+
// Same-origin assumption holds (everything served from the dev
|
|
315
|
+
// server's origin) so cross-frame property access doesn't throw.
|
|
316
|
+
// If a future Nuxt DevTools build sandboxes the overlay iframe,
|
|
317
|
+
// the try/catch falls through to the empty-bridge path with a
|
|
318
|
+
// clear "not found" message.
|
|
319
|
+
function findBridge() {
|
|
320
|
+
let frame = window
|
|
321
|
+
for (let depth = 0; depth < 10; depth++) {
|
|
322
|
+
try {
|
|
323
|
+
const candidate = frame.__attaform_devtools__
|
|
324
|
+
if (candidate !== undefined) return candidate
|
|
325
|
+
} catch {
|
|
326
|
+
return undefined
|
|
327
|
+
}
|
|
328
|
+
if (frame.parent === frame) return undefined
|
|
329
|
+
frame = frame.parent
|
|
330
|
+
}
|
|
331
|
+
return undefined
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
const start = Date.now()
|
|
335
|
+
function bootstrap() {
|
|
336
|
+
const bridge = findBridge()
|
|
337
|
+
if (bridge !== undefined) {
|
|
338
|
+
const root = document.getElementById('atf-app')
|
|
339
|
+
root.innerHTML = ''
|
|
340
|
+
createApp({ render: () => h(AttaformDevtoolsPanel, { bridge }) }).mount(root)
|
|
341
|
+
return
|
|
342
|
+
}
|
|
343
|
+
if (Date.now() - start < 2000) {
|
|
344
|
+
setTimeout(bootstrap, 50)
|
|
345
|
+
return
|
|
346
|
+
}
|
|
347
|
+
document.getElementById('atf-loading').textContent =
|
|
348
|
+
'Attaform devtools bridge not found. The host app may not have the Nuxt module installed.'
|
|
349
|
+
}
|
|
350
|
+
bootstrap()
|
|
351
|
+
<\/script>
|
|
352
|
+
</body>
|
|
353
|
+
</html>`;
|
|
354
|
+
const html = await server.transformIndexHtml("/_attaform_devtools", rawHtml);
|
|
355
|
+
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
356
|
+
res.end(html);
|
|
357
|
+
} catch (err) {
|
|
358
|
+
next(err);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
);
|
|
362
|
+
},
|
|
363
|
+
async resolveId(source, importer) {
|
|
81
364
|
if (!resolveZodAlias) return null;
|
|
82
365
|
if (aliasTarget === null) return null;
|
|
83
366
|
if (source !== ZOD_UNIFIED_SPECIFIER) return null;
|
|
84
|
-
return aliasTarget;
|
|
367
|
+
return this.resolve(aliasTarget, importer, { skipSelf: true });
|
|
368
|
+
},
|
|
369
|
+
transform(code, id) {
|
|
370
|
+
return transformSsrAccessed(code, id);
|
|
85
371
|
}
|
|
86
372
|
};
|
|
87
373
|
}
|
package/dist/vite.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.mjs","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":[],"mappings":";;;;;AA0EA,MAAM,qBAAA,GAAwB,cAAA;AAC9B,MAAM,gBAAA,GAAmB,iBAAA;AACzB,MAAM,gBAAA,GAAmB,iBAAA;AAezB,SAAS,eACP,eAAA,EAC2E;AAC3E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,CAAU,UAAU,SAAA,EAAW;AAIjC,QAAA,IAAI,CAAC,oBAAA,EAAsB;AACzB,UAAA,oBAAA,GAAuB,IAAA;AACvB,UAAA,OAAA,CAAQ,IAAA;AAAA,YACN;AAAA,WAIF;AAAA,QACF;AACA,QAAA;AAAA,MACF;AACA,MAAA,WAAA,GAAc,SAAA,CAAU,KAAA,KAAU,CAAA,GAAI,gBAAA,GAAmB,gBAAA;AAAA,IAC3D,CAAA;AAAA,IACA,UAAU,MAAA,EAAQ;AAKhB,MAAA,IAAI,CAAC,iBAAiB,OAAO,IAAA;AAC7B,MAAA,IAAI,WAAA,KAAgB,MAAM,OAAO,IAAA;AACjC,MAAA,IAAI,MAAA,KAAW,uBAAuB,OAAO,IAAA;AAC7C,MAAA,OAAO,WAAA;AAAA,IACT;AAAA,GACF;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"vite.mjs","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 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: null\n}\n\n// Edits get applied right-to-left so earlier-position offsets stay valid.\nclass SourceEditor {\n readonly original: string\n private edits: { start: number; end: number; replacement: string }[] = []\n\n constructor(original: string) {\n this.original = original\n }\n\n appendRight(offset: number, text: string): void {\n this.edits.push({ start: offset, end: offset, replacement: text })\n }\n\n overwrite(start: number, end: number, text: string): void {\n this.edits.push({ start, end, replacement: text })\n }\n\n toString(): string {\n let out = this.original\n for (const e of [...this.edits].sort((a, b) => b.start - a.start)) {\n out = out.slice(0, e.start) + e.replacement + out.slice(e.end)\n }\n return out\n }\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 editor = new SourceEditor(code)\n for (const name of referenced) {\n const entry = bindings.get(name)\n if (entry === undefined) continue\n injectMark(editor, entry.call, scriptOffset)\n }\n\n return {\n code: editor.toString(),\n map: null,\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(editor: SourceEditor, 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(editor.original, '(', scriptOffset + calleeEnd) + 1\n editor.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 editor.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 = editor.original.slice(startAbs, endAbs)\n editor.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"],"mappings":";;;;;;;;;AA+DA,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;AAa1D,MAAM,YAAA,CAAa;AAAA,EAIj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AAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAA,CAAA;AAyEhB,YAAA,MAAM,IAAA,GAAO,MAAM,MAAA,CAAO,kBAAA,CAAmB,uBAAuB,OAAO,CAAA;AAC3E,YAAA,GAAA,CAAI,SAAA,CAAU,gBAAgB,0BAA0B,CAAA;AACxD,YAAA,GAAA,CAAI,IAAI,IAAI,CAAA;AAAA,UACd,SAAS,GAAA,EAAK;AACZ,YAAA,IAAA,CAAK,GAAG,CAAA;AAAA,UACV;AAAA,QACF;AAAA,OACF;AAAA,IACF,CAAA;AAAA,IACA,MAAM,SAAA,CAAU,MAAA,EAAQ,QAAA,EAAU;AAKhC,MAAA,IAAI,CAAC,iBAAiB,OAAO,IAAA;AAC7B,MAAA,IAAI,WAAA,KAAgB,MAAM,OAAO,IAAA;AACjC,MAAA,IAAI,MAAA,KAAW,uBAAuB,OAAO,IAAA;AAQ7C,MAAA,OAAO,KAAK,OAAA,CAAQ,WAAA,EAAa,UAAU,EAAE,QAAA,EAAU,MAAM,CAAA;AAAA,IAC/D,CAAA;AAAA,IACA,SAAA,CAAU,MAAM,EAAA,EAAI;AAQlB,MAAA,OAAO,oBAAA,CAAqB,MAAM,EAAE,CAAA;AAAA,IACtC;AAAA,GACF;AACF;;;;"}
|
package/dist/zod-v3.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const useForm = require('./shared/attaform.
|
|
4
|
-
const
|
|
5
|
-
const
|
|
3
|
+
const useForm = require('./shared/attaform.DUHru0OF.cjs');
|
|
4
|
+
const injectWizard = require('./shared/attaform.II89Pcf4.cjs');
|
|
5
|
+
const paths = require('./shared/attaform.BqK_L4gK.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -11,9 +11,12 @@ exports.isZodSchemaType = useForm.isZodSchemaType;
|
|
|
11
11
|
exports.useForm = useForm.useForm;
|
|
12
12
|
exports.withMeta = useForm.withMeta;
|
|
13
13
|
exports.zodAdapter = useForm.zodAdapter;
|
|
14
|
-
exports.AttaformErrorCode =
|
|
15
|
-
exports.injectForm =
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
14
|
+
exports.AttaformErrorCode = injectWizard.AttaformErrorCode;
|
|
15
|
+
exports.injectForm = injectWizard.injectForm;
|
|
16
|
+
exports.injectWizard = injectWizard.injectWizard;
|
|
17
|
+
exports.isUnset = injectWizard.isUnset;
|
|
18
|
+
exports.lazy = injectWizard.lazy;
|
|
19
|
+
exports.unset = injectWizard.unset;
|
|
20
|
+
exports.useWizard = injectWizard.useWizard;
|
|
21
|
+
exports.useRegister = paths.useRegister;
|
|
19
22
|
//# sourceMappingURL=zod-v3.cjs.map
|
package/dist/zod-v3.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod-v3.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zod-v3.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
|
package/dist/zod-v3.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { G as GenericForm,
|
|
3
|
-
export {
|
|
4
|
-
import { U as UnwrapZodObject, a as UseFormConfigurationWithZod, S as StorageShape } from './shared/attaform.
|
|
5
|
-
export {
|
|
2
|
+
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, a as AbstractSchema, D as DefaultValuesInput, b as UseFormReturnType, av as SchemaFactoryOptions, p as FieldMetaPayload } from './shared/attaform.Dj9mwbaV.cjs';
|
|
3
|
+
export { ai as Unset, as as isUnset, au as unset } from './shared/attaform.Dj9mwbaV.cjs';
|
|
4
|
+
import { U as UnwrapZodObject, a as UseFormConfigurationWithZod, S as StorageShape } from './shared/attaform.tts_OM7j.cjs';
|
|
5
|
+
export { b as AggregateError, c as AnyForm, d as AttaformErrorCode, C as CompiledStep, F as FormStatus, I as InjectWizardInput, L as LazyMarker, e as StepSlot, U as UseRegisterReturn, f as UseWizardReturnType, W 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.DoSuaKMd.cjs';
|
|
6
6
|
import 'vue';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -18,7 +18,7 @@ import 'vue';
|
|
|
18
18
|
* directly — it wraps the adapter automatically. For Zod v4, import
|
|
19
19
|
* from `attaform/zod` instead.
|
|
20
20
|
*/
|
|
21
|
-
declare function useForm<Form extends GenericForm, GetValueFormType extends GenericForm = Form>(configuration: UseFormConfiguration<Form, GetValueFormType, AbstractSchema<Form, GetValueFormType>,
|
|
21
|
+
declare function useForm<Form extends GenericForm, GetValueFormType extends GenericForm = Form, K extends FormKey = FormKey>(configuration: UseFormConfiguration<Form, GetValueFormType, AbstractSchema<Form, GetValueFormType>, DefaultValuesInput<Form>, K>): UseFormReturnType<Form, GetValueFormType, Form, K>;
|
|
22
22
|
/**
|
|
23
23
|
* Create a form bound to a Zod v3 `ZodObject` schema.
|
|
24
24
|
*
|
|
@@ -43,7 +43,7 @@ declare function useForm<Form extends GenericForm, GetValueFormType extends Gene
|
|
|
43
43
|
*
|
|
44
44
|
* For Zod v4, import from `attaform/zod` instead.
|
|
45
45
|
*/
|
|
46
|
-
declare function useForm<Schema extends z.ZodObject<z.ZodRawShape>, GetValueFormType extends GenericForm = z.output<UnwrapZodObject<Schema>> extends GenericForm ? z.output<UnwrapZodObject<Schema>> : never>(configuration: UseFormConfigurationWithZod<Schema,
|
|
46
|
+
declare function useForm<Schema extends z.ZodObject<z.ZodRawShape>, GetValueFormType extends GenericForm = z.output<UnwrapZodObject<Schema>> extends GenericForm ? z.output<UnwrapZodObject<Schema>> : never, K extends FormKey = FormKey>(configuration: UseFormConfigurationWithZod<Schema, DefaultValuesInput<z.input<UnwrapZodObject<Schema>>>, K>): UseFormReturnType<z.input<UnwrapZodObject<Schema>>, GetValueFormType, StorageShape<UnwrapZodObject<Schema>> extends GenericForm ? StorageShape<UnwrapZodObject<Schema>> : never, K>;
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* Narrow accessor type for Zod v3's internal `_def`. Only useful
|
package/dist/zod-v3.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { G as GenericForm,
|
|
3
|
-
export {
|
|
4
|
-
import { U as UnwrapZodObject, a as UseFormConfigurationWithZod, S as StorageShape } from './shared/attaform.
|
|
5
|
-
export {
|
|
2
|
+
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, a as AbstractSchema, D as DefaultValuesInput, b as UseFormReturnType, av as SchemaFactoryOptions, p as FieldMetaPayload } from './shared/attaform.Dj9mwbaV.mjs';
|
|
3
|
+
export { ai as Unset, as as isUnset, au as unset } from './shared/attaform.Dj9mwbaV.mjs';
|
|
4
|
+
import { U as UnwrapZodObject, a as UseFormConfigurationWithZod, S as StorageShape } from './shared/attaform.DVLB6CAn.mjs';
|
|
5
|
+
export { b as AggregateError, c as AnyForm, d as AttaformErrorCode, C as CompiledStep, F as FormStatus, I as InjectWizardInput, L as LazyMarker, e as StepSlot, U as UseRegisterReturn, f as UseWizardReturnType, W 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.iTqxvl-P.mjs';
|
|
6
6
|
import 'vue';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -18,7 +18,7 @@ import 'vue';
|
|
|
18
18
|
* directly — it wraps the adapter automatically. For Zod v4, import
|
|
19
19
|
* from `attaform/zod` instead.
|
|
20
20
|
*/
|
|
21
|
-
declare function useForm<Form extends GenericForm, GetValueFormType extends GenericForm = Form>(configuration: UseFormConfiguration<Form, GetValueFormType, AbstractSchema<Form, GetValueFormType>,
|
|
21
|
+
declare function useForm<Form extends GenericForm, GetValueFormType extends GenericForm = Form, K extends FormKey = FormKey>(configuration: UseFormConfiguration<Form, GetValueFormType, AbstractSchema<Form, GetValueFormType>, DefaultValuesInput<Form>, K>): UseFormReturnType<Form, GetValueFormType, Form, K>;
|
|
22
22
|
/**
|
|
23
23
|
* Create a form bound to a Zod v3 `ZodObject` schema.
|
|
24
24
|
*
|
|
@@ -43,7 +43,7 @@ declare function useForm<Form extends GenericForm, GetValueFormType extends Gene
|
|
|
43
43
|
*
|
|
44
44
|
* For Zod v4, import from `attaform/zod` instead.
|
|
45
45
|
*/
|
|
46
|
-
declare function useForm<Schema extends z.ZodObject<z.ZodRawShape>, GetValueFormType extends GenericForm = z.output<UnwrapZodObject<Schema>> extends GenericForm ? z.output<UnwrapZodObject<Schema>> : never>(configuration: UseFormConfigurationWithZod<Schema,
|
|
46
|
+
declare function useForm<Schema extends z.ZodObject<z.ZodRawShape>, GetValueFormType extends GenericForm = z.output<UnwrapZodObject<Schema>> extends GenericForm ? z.output<UnwrapZodObject<Schema>> : never, K extends FormKey = FormKey>(configuration: UseFormConfigurationWithZod<Schema, DefaultValuesInput<z.input<UnwrapZodObject<Schema>>>, K>): UseFormReturnType<z.input<UnwrapZodObject<Schema>>, GetValueFormType, StorageShape<UnwrapZodObject<Schema>> extends GenericForm ? StorageShape<UnwrapZodObject<Schema>> : never, K>;
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* Narrow accessor type for Zod v3's internal `_def`. Only useful
|
package/dist/zod-v3.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { G as GenericForm,
|
|
3
|
-
export {
|
|
4
|
-
import { U as UnwrapZodObject, a as UseFormConfigurationWithZod, S as StorageShape } from './shared/attaform.
|
|
5
|
-
export {
|
|
2
|
+
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, a as AbstractSchema, D as DefaultValuesInput, b as UseFormReturnType, av as SchemaFactoryOptions, p as FieldMetaPayload } from './shared/attaform.Dj9mwbaV.js';
|
|
3
|
+
export { ai as Unset, as as isUnset, au as unset } from './shared/attaform.Dj9mwbaV.js';
|
|
4
|
+
import { U as UnwrapZodObject, a as UseFormConfigurationWithZod, S as StorageShape } from './shared/attaform.DF8wo-ry.js';
|
|
5
|
+
export { b as AggregateError, c as AnyForm, d as AttaformErrorCode, C as CompiledStep, F as FormStatus, I as InjectWizardInput, L as LazyMarker, e as StepSlot, U as UseRegisterReturn, f as UseWizardReturnType, W 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.DK9aj0N8.js';
|
|
6
6
|
import 'vue';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -18,7 +18,7 @@ import 'vue';
|
|
|
18
18
|
* directly — it wraps the adapter automatically. For Zod v4, import
|
|
19
19
|
* from `attaform/zod` instead.
|
|
20
20
|
*/
|
|
21
|
-
declare function useForm<Form extends GenericForm, GetValueFormType extends GenericForm = Form>(configuration: UseFormConfiguration<Form, GetValueFormType, AbstractSchema<Form, GetValueFormType>,
|
|
21
|
+
declare function useForm<Form extends GenericForm, GetValueFormType extends GenericForm = Form, K extends FormKey = FormKey>(configuration: UseFormConfiguration<Form, GetValueFormType, AbstractSchema<Form, GetValueFormType>, DefaultValuesInput<Form>, K>): UseFormReturnType<Form, GetValueFormType, Form, K>;
|
|
22
22
|
/**
|
|
23
23
|
* Create a form bound to a Zod v3 `ZodObject` schema.
|
|
24
24
|
*
|
|
@@ -43,7 +43,7 @@ declare function useForm<Form extends GenericForm, GetValueFormType extends Gene
|
|
|
43
43
|
*
|
|
44
44
|
* For Zod v4, import from `attaform/zod` instead.
|
|
45
45
|
*/
|
|
46
|
-
declare function useForm<Schema extends z.ZodObject<z.ZodRawShape>, GetValueFormType extends GenericForm = z.output<UnwrapZodObject<Schema>> extends GenericForm ? z.output<UnwrapZodObject<Schema>> : never>(configuration: UseFormConfigurationWithZod<Schema,
|
|
46
|
+
declare function useForm<Schema extends z.ZodObject<z.ZodRawShape>, GetValueFormType extends GenericForm = z.output<UnwrapZodObject<Schema>> extends GenericForm ? z.output<UnwrapZodObject<Schema>> : never, K extends FormKey = FormKey>(configuration: UseFormConfigurationWithZod<Schema, DefaultValuesInput<z.input<UnwrapZodObject<Schema>>>, K>): UseFormReturnType<z.input<UnwrapZodObject<Schema>>, GetValueFormType, StorageShape<UnwrapZodObject<Schema>> extends GenericForm ? StorageShape<UnwrapZodObject<Schema>> : never, K>;
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* Narrow accessor type for Zod v3's internal `_def`. Only useful
|
package/dist/zod-v3.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { f as fieldMeta, i as isZodSchemaType, u as useForm, w as withMeta, z as zodAdapter } from './shared/attaform.
|
|
2
|
-
export { A as AttaformErrorCode, i as injectForm, a as isUnset, u as unset } from './shared/attaform.
|
|
3
|
-
export { u as useRegister } from './shared/attaform.
|
|
1
|
+
export { f as fieldMeta, i as isZodSchemaType, u as useForm, w as withMeta, z as zodAdapter } from './shared/attaform.CtNUB9nf.mjs';
|
|
2
|
+
export { A as AttaformErrorCode, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, c as useWizard } from './shared/attaform.DsC3rZHG.mjs';
|
|
3
|
+
export { u as useRegister } from './shared/attaform.Xhg0AYNa.mjs';
|
|
4
4
|
//# sourceMappingURL=zod-v3.mjs.map
|
package/dist/zod-v4.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./shared/attaform.
|
|
4
|
-
const
|
|
5
|
-
const
|
|
3
|
+
const index = require('./shared/attaform.Dlk1jMuv.cjs');
|
|
4
|
+
const injectWizard = require('./shared/attaform.II89Pcf4.cjs');
|
|
5
|
+
const paths = require('./shared/attaform.BqK_L4gK.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -13,9 +13,12 @@ exports.kindOf = index.kindOf;
|
|
|
13
13
|
exports.useForm = index.useForm;
|
|
14
14
|
exports.withMeta = index.withMeta;
|
|
15
15
|
exports.zodAdapter = index.zodV4Adapter;
|
|
16
|
-
exports.AttaformErrorCode =
|
|
17
|
-
exports.injectForm =
|
|
18
|
-
exports.
|
|
19
|
-
exports.
|
|
20
|
-
exports.
|
|
16
|
+
exports.AttaformErrorCode = injectWizard.AttaformErrorCode;
|
|
17
|
+
exports.injectForm = injectWizard.injectForm;
|
|
18
|
+
exports.injectWizard = injectWizard.injectWizard;
|
|
19
|
+
exports.isUnset = injectWizard.isUnset;
|
|
20
|
+
exports.lazy = injectWizard.lazy;
|
|
21
|
+
exports.unset = injectWizard.unset;
|
|
22
|
+
exports.useWizard = injectWizard.useWizard;
|
|
23
|
+
exports.useRegister = paths.useRegister;
|
|
21
24
|
//# sourceMappingURL=zod-v4.cjs.map
|
package/dist/zod-v4.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod-v4.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zod-v4.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;"}
|