attaform 0.25.0 → 0.27.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.
- package/README.md +21 -11
- package/bin/attaform.mjs +78 -0
- package/dist/abstract.cjs +47 -0
- package/dist/abstract.cjs.map +1 -0
- package/dist/abstract.d.cts +42 -0
- package/dist/abstract.d.mts +42 -0
- package/dist/abstract.d.ts +42 -0
- package/dist/abstract.mjs +4 -0
- package/dist/abstract.mjs.map +1 -0
- package/dist/chunks/devtools.cjs +2 -2
- package/dist/chunks/devtools.cjs.map +1 -1
- package/dist/chunks/devtools.mjs +1 -1
- package/dist/chunks/fingerprint2.cjs +1 -1
- package/dist/chunks/fingerprint2.mjs +1 -1
- package/dist/esbuild.cjs +2 -2
- package/dist/esbuild.cjs.map +1 -1
- package/dist/esbuild.d.cts +3 -3
- package/dist/esbuild.d.mts +3 -3
- package/dist/esbuild.d.ts +3 -3
- package/dist/esbuild.mjs +2 -2
- package/dist/esbuild.mjs.map +1 -1
- package/dist/index.cjs +41 -56
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +194 -282
- package/dist/index.d.mts +194 -282
- package/dist/index.d.ts +194 -282
- package/dist/index.mjs +4 -25
- package/dist/index.mjs.map +1 -1
- package/dist/nuxt.cjs +3 -1
- package/dist/nuxt.cjs.map +1 -1
- package/dist/nuxt.d.cts +17 -4
- package/dist/nuxt.d.mts +17 -4
- package/dist/nuxt.d.ts +17 -4
- package/dist/nuxt.mjs +4 -2
- package/dist/nuxt.mjs.map +1 -1
- package/dist/rollup.cjs +2 -2
- package/dist/rollup.cjs.map +1 -1
- package/dist/rollup.d.cts +3 -3
- package/dist/rollup.d.mts +3 -3
- package/dist/rollup.d.ts +3 -3
- package/dist/rollup.mjs +2 -2
- package/dist/rollup.mjs.map +1 -1
- package/dist/rspack.cjs +1 -1
- package/dist/rspack.d.cts +1 -1
- package/dist/rspack.d.mts +1 -1
- package/dist/rspack.d.ts +1 -1
- package/dist/rspack.mjs +1 -1
- package/dist/runtime/plugins/attaform.cjs +4 -5
- package/dist/runtime/plugins/attaform.cjs.map +1 -1
- package/dist/runtime/plugins/attaform.mjs +1 -2
- package/dist/runtime/plugins/attaform.mjs.map +1 -1
- package/dist/shared/{attaform.BRzKBj2g.cjs → attaform.8tFZu1Ub.cjs} +2 -2
- package/dist/shared/{attaform.BRzKBj2g.cjs.map → attaform.8tFZu1Ub.cjs.map} +1 -1
- package/dist/shared/{attaform.k9V0py0s.mjs → attaform.BERt5YMU.mjs} +2 -2
- package/dist/shared/{attaform.k9V0py0s.mjs.map → attaform.BERt5YMU.mjs.map} +1 -1
- package/dist/shared/{attaform.CN4ZEGo6.mjs → attaform.BceJrhQ7.mjs} +5 -5
- package/dist/shared/{attaform.CN4ZEGo6.mjs.map → attaform.BceJrhQ7.mjs.map} +1 -1
- package/dist/shared/{attaform.i_LA3X9o.d.cts → attaform.C3WnCDXz.d.cts} +81 -24
- package/dist/shared/{attaform.i_LA3X9o.d.ts → attaform.C3WnCDXz.d.mts} +81 -24
- package/dist/shared/{attaform.i_LA3X9o.d.mts → attaform.C3WnCDXz.d.ts} +81 -24
- package/dist/shared/{attaform.DuzQYscR.d.ts → attaform.C9fPTxjB.d.cts} +5 -5
- package/dist/shared/{attaform.DuzQYscR.d.cts → attaform.C9fPTxjB.d.mts} +5 -5
- package/dist/shared/{attaform.DuzQYscR.d.mts → attaform.C9fPTxjB.d.ts} +5 -5
- package/dist/shared/{attaform.B3cgZE3c.d.ts → attaform.CC_y1_Ej.d.ts} +33 -33
- package/dist/shared/{attaform.DS_zBcdr.d.ts → attaform.CEXUlUkc.d.ts} +1588 -1190
- package/dist/shared/{attaform.Xe8dATED.cjs → attaform.C__F01CE.cjs} +15 -15
- package/dist/shared/{attaform.Xe8dATED.cjs.map → attaform.C__F01CE.cjs.map} +1 -1
- package/dist/shared/{attaform.3heDHayA.cjs → attaform.Co5LNRnv.cjs} +186 -129
- package/dist/shared/attaform.Co5LNRnv.cjs.map +1 -0
- package/dist/shared/{attaform.BJt4ZCkM.d.mts → attaform.CpXHK60W.d.cts} +33 -33
- package/dist/shared/{attaform.DmKLa4tL.d.cts → attaform.CvVYOvZF.d.mts} +33 -33
- package/dist/shared/{attaform.DK3xUBkj.mjs → attaform.CyQxTOdX.mjs} +162 -79
- package/dist/shared/attaform.CyQxTOdX.mjs.map +1 -0
- package/dist/shared/{attaform.B5GFS3Su.d.cts → attaform.D99pd7JG.d.cts} +1588 -1190
- package/dist/shared/{attaform.CwXXbZIQ.mjs → attaform.DDAmSFnl.mjs} +4 -4
- package/dist/shared/{attaform.CwXXbZIQ.mjs.map → attaform.DDAmSFnl.mjs.map} +1 -1
- package/dist/shared/{attaform.BkUzunyB.cjs → attaform.DQT7_-FO.cjs} +371 -287
- package/dist/shared/attaform.DQT7_-FO.cjs.map +1 -0
- package/dist/shared/{attaform.CqwcTExO.mjs → attaform.Da8EdI2t.mjs} +182 -129
- package/dist/shared/attaform.Da8EdI2t.mjs.map +1 -0
- package/dist/shared/{attaform.sks1MFVO.cjs → attaform.DhVgG2jh.cjs} +16 -16
- package/dist/shared/{attaform.sks1MFVO.cjs.map → attaform.DhVgG2jh.cjs.map} +1 -1
- package/dist/shared/{attaform.sHkHv_98.mjs → attaform.DhnPb6nK.mjs} +6 -3
- package/dist/shared/attaform.DhnPb6nK.mjs.map +1 -0
- package/dist/shared/attaform.DkD0DR7R.mjs +42 -0
- package/dist/shared/attaform.DkD0DR7R.mjs.map +1 -0
- package/dist/shared/{attaform.DMNnfQq_.mjs → attaform.DlSu08F5.mjs} +4 -4
- package/dist/shared/{attaform.DMNnfQq_.mjs.map → attaform.DlSu08F5.mjs.map} +1 -1
- package/dist/shared/{attaform.LEWUFqUw.cjs → attaform.DoQm_Vkd.cjs} +7 -3
- package/dist/shared/attaform.DoQm_Vkd.cjs.map +1 -0
- package/dist/shared/{attaform.B5YcWrKi.cjs → attaform.Drsi43GG.cjs} +19 -19
- package/dist/shared/{attaform.B5YcWrKi.cjs.map → attaform.Drsi43GG.cjs.map} +1 -1
- package/dist/shared/attaform.K6Thc6By.cjs +46 -0
- package/dist/shared/attaform.K6Thc6By.cjs.map +1 -0
- package/dist/shared/{attaform.Vp2-CWZB.mjs → attaform.KvlEedlF.mjs} +3 -3
- package/dist/shared/{attaform.Vp2-CWZB.mjs.map → attaform.KvlEedlF.mjs.map} +1 -1
- package/dist/shared/{attaform.BRGIpZo4.cjs → attaform.RaTzp1WF.cjs} +3 -3
- package/dist/shared/attaform.RaTzp1WF.cjs.map +1 -0
- package/dist/shared/{attaform.8vmdOURQ.d.mts → attaform.kBkYlKP_.d.mts} +1588 -1190
- package/dist/shared/{attaform.C3Doa9Pt.mjs → attaform.v0fQtWyA.mjs} +3 -3
- package/dist/shared/attaform.v0fQtWyA.mjs.map +1 -0
- package/dist/shared/{attaform.ZXZ6dH72.cjs → attaform.yUrz7C2z.cjs} +3 -3
- package/dist/shared/{attaform.ZXZ6dH72.cjs.map → attaform.yUrz7C2z.cjs.map} +1 -1
- package/dist/transforms.cjs +1 -1
- package/dist/transforms.mjs +1 -1
- package/dist/vite.cjs +21 -3
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.d.cts +70 -17
- package/dist/vite.d.mts +70 -17
- package/dist/vite.d.ts +70 -17
- package/dist/vite.mjs +20 -4
- package/dist/vite.mjs.map +1 -1
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.d.cts +1 -1
- package/dist/webpack.d.mts +1 -1
- package/dist/webpack.d.ts +1 -1
- package/dist/webpack.mjs +1 -1
- package/dist/zod-v3.cjs +41 -10
- package/dist/zod-v3.cjs.map +1 -1
- package/dist/zod-v3.d.cts +5 -5
- package/dist/zod-v3.d.mts +5 -5
- package/dist/zod-v3.d.ts +5 -5
- package/dist/zod-v3.mjs +4 -2
- package/dist/zod-v3.mjs.map +1 -1
- package/dist/zod-v4.cjs +41 -10
- package/dist/zod-v4.cjs.map +1 -1
- package/dist/zod-v4.d.cts +7 -7
- package/dist/zod-v4.d.mts +7 -7
- package/dist/zod-v4.d.ts +7 -7
- package/dist/zod-v4.mjs +4 -2
- package/dist/zod-v4.mjs.map +1 -1
- package/dist/zod.cjs +44 -49
- package/dist/zod.cjs.map +1 -1
- package/dist/zod.d.cts +6 -248
- package/dist/zod.d.mts +6 -248
- package/dist/zod.d.ts +6 -248
- package/dist/zod.mjs +4 -42
- package/dist/zod.mjs.map +1 -1
- package/package.json +12 -2
- package/skills/attaform/SKILL.md +128 -0
- package/skills/attaform/references/custom-components.md +72 -0
- package/skills/attaform/references/errors.md +62 -0
- package/skills/attaform/references/ssr.md +26 -0
- package/skills/attaform/references/validation.md +40 -0
- package/skills/attaform/references/wizards.md +104 -0
- package/dist/shared/attaform.3heDHayA.cjs.map +0 -1
- package/dist/shared/attaform.BRGIpZo4.cjs.map +0 -1
- package/dist/shared/attaform.BkUzunyB.cjs.map +0 -1
- package/dist/shared/attaform.C3Doa9Pt.mjs.map +0 -1
- package/dist/shared/attaform.CO0e7YVY.d.cts +0 -94
- package/dist/shared/attaform.CO0e7YVY.d.mts +0 -94
- package/dist/shared/attaform.CO0e7YVY.d.ts +0 -94
- package/dist/shared/attaform.CqwcTExO.mjs.map +0 -1
- package/dist/shared/attaform.DK3xUBkj.mjs.map +0 -1
- package/dist/shared/attaform.LEWUFqUw.cjs.map +0 -1
- package/dist/shared/attaform.OLtKd9gM.mjs +0 -35
- package/dist/shared/attaform.OLtKd9gM.mjs.map +0 -1
- package/dist/shared/attaform.sHkHv_98.mjs.map +0 -1
- package/dist/shared/attaform.xBDo0Ko0.cjs +0 -39
- package/dist/shared/attaform.xBDo0Ko0.cjs.map +0 -1
- package/dist/shared/{attaform.DdjDqTah.d.mts → attaform.DRUT703x.d.cts} +14 -14
- package/dist/shared/{attaform.DdjDqTah.d.ts → attaform.DRUT703x.d.mts} +14 -14
- package/dist/shared/{attaform.DdjDqTah.d.cts → attaform.DRUT703x.d.ts} +14 -14
|
@@ -4,9 +4,12 @@ const node_fs = require('node:fs');
|
|
|
4
4
|
const node_url = require('node:url');
|
|
5
5
|
const node_path = require('node:path');
|
|
6
6
|
|
|
7
|
-
const ZOD_UNIFIED_SPECIFIER = "attaform/zod";
|
|
8
7
|
const ZOD_V3_SPECIFIER = "attaform/zod-v3";
|
|
9
8
|
const ZOD_V4_SPECIFIER = "attaform/zod-v4";
|
|
9
|
+
const REWRITABLE_ZOD_SPECIFIER_FILTER = /^attaform(?:\/zod)?$/;
|
|
10
|
+
function isRewritableZodSpecifier(source) {
|
|
11
|
+
return REWRITABLE_ZOD_SPECIFIER_FILTER.test(source);
|
|
12
|
+
}
|
|
10
13
|
function detectZodMajor(consumerRootDir) {
|
|
11
14
|
const consumerURL = node_url.pathToFileURL(node_path.join(consumerRootDir, "package.json")).href;
|
|
12
15
|
let resolved;
|
|
@@ -49,6 +52,7 @@ function resolveZodAliasTarget(consumerRootDir, tag, resolveZodAlias, warnState)
|
|
|
49
52
|
return detection.major === 4 ? ZOD_V4_SPECIFIER : ZOD_V3_SPECIFIER;
|
|
50
53
|
}
|
|
51
54
|
|
|
52
|
-
exports.
|
|
55
|
+
exports.REWRITABLE_ZOD_SPECIFIER_FILTER = REWRITABLE_ZOD_SPECIFIER_FILTER;
|
|
56
|
+
exports.isRewritableZodSpecifier = isRewritableZodSpecifier;
|
|
53
57
|
exports.resolveZodAliasTarget = resolveZodAliasTarget;
|
|
54
|
-
//# sourceMappingURL=attaform.
|
|
58
|
+
//# sourceMappingURL=attaform.DoQm_Vkd.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attaform.DoQm_Vkd.cjs","sources":["../../src/core/detect-zod-major.ts"],"sourcesContent":["/**\n * Shared build-time Zod-major detection and adapter-alias resolution for\n * the bundler plugins (`attaform/vite`, `attaform/rollup`,\n * `attaform/esbuild`, `attaform/webpack`, `attaform/rspack`).\n *\n * The unified `attaform/zod` entry — and the bare `attaform` barrel, which\n * re-exports the identical surface — runtime-dispatches between the v3 and\n * v4 adapters, so a bundler that does not rewrite the import ships BOTH.\n * Each plugin rewrites those two specifiers (see\n * {@link REWRITABLE_ZOD_SPECIFIER_FILTER}) to the single matching adapter\n * subpath (`attaform/zod-v3` or `attaform/zod-v4`) based on the Zod major\n * resolved from the consumer's project, so the consumer bundle carries\n * one adapter instead of two. This module holds the detection (pure Node,\n * no bundler API) plus the shared diagnostic copy so every plugin behaves\n * and reads identically.\n *\n * Build-time only: imported by the build-tool entries at `src/*.ts`,\n * never by runtime code, so it never reaches a consumer's browser bundle.\n */\nimport { readFileSync } from 'node:fs'\nimport { fileURLToPath, pathToFileURL } from 'node:url'\nimport { join } from 'node:path'\n\nexport const ZOD_UNIFIED_SPECIFIER = 'attaform/zod'\nexport const ZOD_V3_SPECIFIER = 'attaform/zod-v3'\nexport const ZOD_V4_SPECIFIER = 'attaform/zod-v4'\nexport const ZOD_BARREL_SPECIFIER = 'attaform'\n\n/**\n * The two specifiers a plugin collapses to a single adapter: the explicit\n * unified `attaform/zod` entry AND the bare `attaform` barrel. Both are\n * structurally identical (the barrel re-exports the same\n * `_shared-exports` + `_zod-binding` surface as `attaform/zod`), so both\n * carry the runtime-dispatching `useForm` that pulls in BOTH adapters —\n * and both rewrite to the same single adapter when one Zod major is\n * detected.\n *\n * The rewrite is value-safe: every runtime binding the barrel exports\n * (`useForm`, `fieldMeta`, `withMeta`, plus everything in\n * `_shared-exports`) is also exported by `attaform/zod-v3` and\n * `attaform/zod-v4`, so redirecting bare `attaform` to a pinned adapter\n * can never strand a runtime import. (Type-only exports are erased before\n * this resolve hook runs and are type-checked against the un-rewritten\n * `attaform` specifier, so their per-adapter asymmetry is irrelevant.)\n *\n * The pattern is anchored (`^...$`) so it matches ONLY those two\n * specifiers: the pinned adapters (`attaform/zod-v3`, `attaform/zod-v4`)\n * and every build-tool / other subpath (`attaform/nuxt`, `attaform/vite`,\n * `attaform/abstract`, `attaform/transforms`, ...) pass through untouched.\n * It serves double duty — as esbuild's `onResolve` `filter` (a Go RE2\n * regexp) and, via `.test()`, as the string-match predicate the other\n * plugins call — so the two representations can never diverge.\n */\nexport const REWRITABLE_ZOD_SPECIFIER_FILTER = /^attaform(?:\\/zod)?$/\n\n/**\n * True when `source` is a specifier the plugins rewrite to a single Zod\n * adapter: the bare `attaform` barrel or the explicit `attaform/zod`.\n * Backed by {@link REWRITABLE_ZOD_SPECIFIER_FILTER} so it stays in lockstep\n * with esbuild's filter.\n */\nexport function isRewritableZodSpecifier(source: string): boolean {\n return REWRITABLE_ZOD_SPECIFIER_FILTER.test(source)\n}\n\nexport type ZodMajorDetection =\n | { major: 3 }\n | { major: 4 }\n | { major: 'missing' }\n | { major: 'unknown' }\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 */\nexport function detectZodMajor(consumerRootDir: string): ZodMajorDetection {\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 * One-shot latch so a plugin warns about an unclassifiable Zod version\n * only once, however many times its detection runs across a build.\n */\nexport interface ZodDetectionWarnState {\n warned: boolean\n}\n\nfunction missingZodError(tag: string): string {\n return (\n `[${tag}] 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\nfunction unclassifiableZodWarning(tag: string): string {\n return (\n `[${tag}] 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\n/**\n * Resolve the rewrite target for the unified `attaform/zod` specifier,\n * shared by every bundler plugin so they diagnose identically:\n * - returns `attaform/zod-v3` / `attaform/zod-v4` when the consumer's\n * Zod major is detected;\n * - returns `null` to leave `attaform/zod` on its runtime-dispatch\n * entry, either because `resolveZodAlias` is off or because the\n * version could not be classified (warned once via `warnState`);\n * - throws when zod is not installed at all, a fatal misconfiguration\n * the consumer must fix.\n *\n * `tag` brands the diagnostics (`attaform/vite`, `attaform/rollup`, etc).\n * `resolveZodAlias` and `warnState` are supplied by the calling plugin:\n * its consumer-facing default and its per-instance warn latch live at the\n * plugin surface, not here.\n */\nexport function resolveZodAliasTarget(\n consumerRootDir: string,\n tag: string,\n resolveZodAlias: boolean,\n warnState: ZodDetectionWarnState\n): string | null {\n if (!resolveZodAlias) return null\n const detection = detectZodMajor(consumerRootDir)\n if (detection.major === 'missing') {\n throw new Error(missingZodError(tag))\n }\n if (detection.major === 'unknown') {\n if (!warnState.warned) {\n warnState.warned = true\n console.warn(unclassifiableZodWarning(tag))\n }\n return null\n }\n return detection.major === 4 ? ZOD_V4_SPECIFIER : ZOD_V3_SPECIFIER\n}\n"],"names":["pathToFileURL","join","readFileSync","fileURLToPath"],"mappings":";;;;;;AAwBO,MAAM,gBAAA,GAAmB,iBAAA;AACzB,MAAM,gBAAA,GAAmB,iBAAA;AA4BzB,MAAM,+BAAA,GAAkC;AAQxC,SAAS,yBAAyB,MAAA,EAAyB;AAChE,EAAA,OAAO,+BAAA,CAAgC,KAAK,MAAM,CAAA;AACpD;AAqBO,SAAS,eAAe,eAAA,EAA4C;AACzE,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,IAAA,MAAM,KAAA,GAAQ,MAAA,CAAO,QAAA,CAAS,OAAA,CAAQ,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA,IAAK,EAAA,EAAI,EAAE,CAAA;AAC7D,IAAA,IAAI,KAAA,KAAU,CAAA,EAAG,OAAO,EAAE,OAAO,CAAA,EAAE;AACnC,IAAA,IAAI,KAAA,KAAU,CAAA,EAAG,OAAO,EAAE,OAAO,CAAA,EAAE;AACnC,IAAA,OAAO,EAAE,OAAO,SAAA,EAAU;AAAA,EAC5B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,EAAE,OAAO,SAAA,EAAU;AAAA,EAC5B;AACF;AAUA,SAAS,gBAAgB,GAAA,EAAqB;AAC5C,EAAA,OACE,IAAI,GAAG,CAAA,2NAAA,CAAA;AAIX;AAEA,SAAS,yBAAyB,GAAA,EAAqB;AACrD,EAAA,OACE,IAAI,GAAG,CAAA,wRAAA,CAAA;AAKX;AAkBO,SAAS,qBAAA,CACd,eAAA,EACA,GAAA,EACA,eAAA,EACA,SAAA,EACe;AACf,EAAA,IAAI,CAAC,iBAAiB,OAAO,IAAA;AAC7B,EAAA,MAAM,SAAA,GAAY,eAAe,eAAe,CAAA;AAChD,EAAA,IAAI,SAAA,CAAU,UAAU,SAAA,EAAW;AACjC,IAAA,MAAM,IAAI,KAAA,CAAM,eAAA,CAAgB,GAAG,CAAC,CAAA;AAAA,EACtC;AACA,EAAA,IAAI,SAAA,CAAU,UAAU,SAAA,EAAW;AACjC,IAAA,IAAI,CAAC,UAAU,MAAA,EAAQ;AACrB,MAAA,SAAA,CAAU,MAAA,GAAS,IAAA;AACnB,MAAA,OAAA,CAAQ,IAAA,CAAK,wBAAA,CAAyB,GAAG,CAAC,CAAA;AAAA,IAC5C;AACA,IAAA,OAAO,IAAA;AAAA,EACT;AACA,EAAA,OAAO,SAAA,CAAU,KAAA,KAAU,CAAA,GAAI,gBAAA,GAAmB,gBAAA;AACpD;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const
|
|
3
|
+
const serializeScript = require('./attaform.DQT7_-FO.cjs');
|
|
4
|
+
const devtoolsShared = require('./attaform.Co5LNRnv.cjs');
|
|
5
5
|
|
|
6
6
|
const PATH_SEPARATOR = ".";
|
|
7
7
|
function createAbstractSchema(rootSchema, intro, services, formKey, options) {
|
|
@@ -118,7 +118,7 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
|
|
|
118
118
|
return out;
|
|
119
119
|
},
|
|
120
120
|
isLeafAtPath(path) {
|
|
121
|
-
const cacheKey =
|
|
121
|
+
const cacheKey = devtoolsShared.canonicalizePath(path).key;
|
|
122
122
|
const cached = leafCache.get(cacheKey);
|
|
123
123
|
if (cached !== void 0) return cached;
|
|
124
124
|
const prim = this.getSlimPrimitiveTypesAtPath(path);
|
|
@@ -127,7 +127,7 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
|
|
|
127
127
|
return isLeaf;
|
|
128
128
|
},
|
|
129
129
|
isPreprocessOrCoerceLeaf(path) {
|
|
130
|
-
const cacheKey =
|
|
130
|
+
const cacheKey = devtoolsShared.canonicalizePath(path).key;
|
|
131
131
|
const cached = preprocessOrCoerceCache.get(cacheKey);
|
|
132
132
|
if (cached !== void 0) return cached;
|
|
133
133
|
let hit = false;
|
|
@@ -154,7 +154,7 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
|
|
|
154
154
|
return services.resolveFieldMetaAtPath(rootSchema, path, maxRecursionDepth);
|
|
155
155
|
},
|
|
156
156
|
getUnionDiscriminatorAtPath(path) {
|
|
157
|
-
const cacheKey =
|
|
157
|
+
const cacheKey = devtoolsShared.canonicalizePath(path).key;
|
|
158
158
|
if (discriminatorCache.has(cacheKey)) {
|
|
159
159
|
return discriminatorCache.get(cacheKey);
|
|
160
160
|
}
|
|
@@ -228,7 +228,7 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
|
|
|
228
228
|
message,
|
|
229
229
|
path: [...errPath],
|
|
230
230
|
formKey,
|
|
231
|
-
code:
|
|
231
|
+
code: serializeScript.AttaformErrorCode.ValidatorThrew
|
|
232
232
|
}
|
|
233
233
|
],
|
|
234
234
|
success: false,
|
|
@@ -243,7 +243,7 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
|
|
|
243
243
|
message: `Path '${p.join(PATH_SEPARATOR)}' did not resolve to any schema`,
|
|
244
244
|
path: [...p],
|
|
245
245
|
formKey,
|
|
246
|
-
code:
|
|
246
|
+
code: serializeScript.AttaformErrorCode.PathNotFound
|
|
247
247
|
}
|
|
248
248
|
],
|
|
249
249
|
success: false,
|
|
@@ -257,16 +257,16 @@ function createAbstractSchema(rootSchema, intro, services, formKey, options) {
|
|
|
257
257
|
|
|
258
258
|
function mergeDeep(base, override) {
|
|
259
259
|
if (override === void 0) return base;
|
|
260
|
-
if (!
|
|
261
|
-
if (!
|
|
260
|
+
if (!serializeScript.isPlainRecord(override)) return override;
|
|
261
|
+
if (!serializeScript.isPlainRecord(base)) return override;
|
|
262
262
|
const result = { ...base };
|
|
263
263
|
for (const key of Object.keys(override)) {
|
|
264
|
-
const oVal =
|
|
265
|
-
const bVal =
|
|
266
|
-
if (
|
|
267
|
-
|
|
264
|
+
const oVal = serializeScript.safeOwnRead(override, key);
|
|
265
|
+
const bVal = serializeScript.safeOwnRead(base, key);
|
|
266
|
+
if (serializeScript.isPlainRecord(oVal) && serializeScript.isPlainRecord(bVal)) {
|
|
267
|
+
serializeScript.safeAssign(result, key, mergeDeep(bVal, oVal));
|
|
268
268
|
} else {
|
|
269
|
-
|
|
269
|
+
serializeScript.safeAssign(result, key, oVal);
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
272
|
return result;
|
|
@@ -359,7 +359,7 @@ function walkPathSegments(schema, segments, intro, maxDepth, lazyDepth) {
|
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
361
|
|
|
362
|
-
const NO_EMBEDDED_DEFAULT = Symbol("atta:no-embedded-default");
|
|
362
|
+
const NO_EMBEDDED_DEFAULT = /* @__PURE__ */ Symbol("atta:no-embedded-default");
|
|
363
363
|
function peelEmbeddedDefault(schema, intro) {
|
|
364
364
|
let current = schema;
|
|
365
365
|
for (let i = 0; i < 32; i++) {
|
|
@@ -417,7 +417,7 @@ function deriveDefaultWalk(schema, useDefault, intro, maxDepth, ctx, lazyDepth =
|
|
|
417
417
|
const shape = intro.getObjectShape(schema);
|
|
418
418
|
const out = {};
|
|
419
419
|
for (const [key, subSchema] of Object.entries(shape)) {
|
|
420
|
-
|
|
420
|
+
serializeScript.safeAssign(
|
|
421
421
|
out,
|
|
422
422
|
key,
|
|
423
423
|
deriveDefaultWalk(subSchema, useDefault, intro, maxDepth, ctx, lazyDepth)
|
|
@@ -667,7 +667,7 @@ function slimPrimitivesWalk(schema, intro, maxDepth, lazyDepth = 0) {
|
|
|
667
667
|
case "literal": {
|
|
668
668
|
const values = intro.getLiteralValues(schema);
|
|
669
669
|
const out = /* @__PURE__ */ new Set();
|
|
670
|
-
for (const v of values) out.add(
|
|
670
|
+
for (const v of values) out.add(serializeScript.slimKindOf(v));
|
|
671
671
|
return out.size === 0 ? PERMISSIVE_SLIM_KINDS : out;
|
|
672
672
|
}
|
|
673
673
|
case "object":
|
|
@@ -787,7 +787,7 @@ function walkForMeta(schema, path, map, counters, lastPathPerSchema, inProgress,
|
|
|
787
787
|
inProgress.add(schema);
|
|
788
788
|
try {
|
|
789
789
|
const { intro, peelAllWrappers, getFieldMetaList } = services;
|
|
790
|
-
const pathKey =
|
|
790
|
+
const pathKey = devtoolsShared.canonicalizePath(path).key;
|
|
791
791
|
if (!map.has(pathKey)) {
|
|
792
792
|
const payload = consumePayload(schema, counters, getFieldMetaList);
|
|
793
793
|
if (payload !== void 0) {
|
|
@@ -916,4 +916,4 @@ exports.mergeDeep = mergeDeep;
|
|
|
916
916
|
exports.peelEmbeddedDefault = peelEmbeddedDefault;
|
|
917
917
|
exports.slimPrimitivesWalk = slimPrimitivesWalk;
|
|
918
918
|
exports.walkPathSegments = walkPathSegments;
|
|
919
|
-
//# sourceMappingURL=attaform.
|
|
919
|
+
//# sourceMappingURL=attaform.Drsi43GG.cjs.map
|