attaform 0.27.6 → 0.28.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/dist/abstract.d.mts +5 -4
- package/dist/abstract.mjs +4 -3
- package/dist/chunks/fingerprint.mjs +0 -1
- package/dist/chunks/fingerprint2.mjs +1 -2
- package/dist/dev/abstract.mjs +4 -0
- package/dist/{chunks → dev/chunks}/dev-key-collision-warnings.mjs +0 -1
- package/dist/{chunks → dev/chunks}/devtools.mjs +5 -6
- package/dist/{chunks/fingerprint.cjs → dev/chunks/fingerprint.mjs} +7 -10
- package/dist/{chunks/fingerprint2.cjs → dev/chunks/fingerprint2.mjs} +32 -35
- package/dist/dev/directive.mjs +1 -0
- package/dist/dev/history.mjs +89 -0
- package/dist/dev/index.mjs +5 -0
- package/dist/dev/runtime/plugins/attaform.mjs +40 -0
- package/dist/{shared/attaform.D6tk90Rc.cjs → dev/shared/attaform-dev.6qxD-Yqo.mjs} +187 -43
- package/dist/{shared/attaform.CQN9R62B.cjs → dev/shared/attaform-dev.BJGA_UOS.mjs} +1 -4
- package/dist/{shared/attaform.DYEr28Pt.mjs → dev/shared/attaform-dev.BR8u0YOZ.mjs} +6 -7
- package/dist/dev/shared/attaform-dev.BXE2cr0L.mjs +220 -0
- package/dist/dev/shared/attaform-dev.By4PRjt0.mjs +248 -0
- package/dist/{shared/attaform.B1ZYt2Li.mjs → dev/shared/attaform-dev.D2I8e_Mm.mjs} +132 -568
- package/dist/dev/shared/attaform-dev.Dr2YzS5B.mjs +197 -0
- package/dist/{shared/attaform.nMaz2C5P.mjs → dev/shared/attaform-dev.P7cseiEG.mjs} +178 -397
- package/dist/{shared/attaform.CKH2lGdL.mjs → dev/shared/attaform-dev.WmuhD_CZ.mjs} +3944 -5056
- package/dist/{shared/attaform.DMxM2kol.mjs → dev/shared/attaform-dev.oYrkP9dj.mjs} +160 -508
- package/dist/dev/zod-v3.mjs +17 -0
- package/dist/dev/zod-v4.mjs +16 -0
- package/dist/dev/zod.mjs +5 -0
- package/dist/directive.d.mts +20 -0
- package/dist/directive.mjs +1 -0
- package/dist/esbuild.mjs +0 -1
- package/dist/history.d.mts +59 -0
- package/dist/history.mjs +89 -0
- package/dist/index.d.mts +11 -5
- package/dist/index.mjs +5 -4
- package/dist/nuxt.d.mts +1 -1
- package/dist/nuxt.mjs +5 -2
- package/dist/rollup.mjs +0 -1
- package/dist/rspack.d.mts +6 -1
- package/dist/rspack.mjs +0 -1
- package/dist/runtime/components/AttaformDevtoolsPanel.vue +9 -8
- package/dist/runtime/plugins/attaform.mjs +1 -2
- package/dist/shared/{attaform.Fp3sCrVs.d.ts → attaform.B4VkS43-.d.mts} +2 -2
- package/dist/shared/{attaform.DrvMscNX.cjs → attaform.B8k8JrmK.mjs} +4073 -5630
- package/dist/shared/attaform.BJGA_UOS.mjs +0 -1
- package/dist/shared/{attaform.CoR4mWfv.mjs → attaform.C09fpdLS.mjs} +172 -16
- package/dist/shared/{attaform.D8kliaKw.cjs → attaform.CJP3RkGa.mjs} +141 -590
- package/dist/shared/{attaform.DniawQLP.d.cts → attaform.Cgu-hdSb.d.mts} +268 -68
- package/dist/shared/attaform.Cs2Rbdlo.mjs +0 -1
- package/dist/shared/{attaform.CHlJLAiv.d.mts → attaform.D5V4tZWq.d.mts} +69 -179
- package/dist/shared/{attaform.B9Wyhfro.cjs → attaform.D6DCnnQu.mjs} +11 -16
- package/dist/shared/attaform.DhnPb6nK.mjs +0 -1
- package/dist/shared/attaform.Dq4vWxuG.mjs +197 -0
- package/dist/shared/attaform.JfSWdEcb.d.mts +44 -0
- package/dist/shared/attaform.KvlEedlF.mjs +0 -1
- package/dist/shared/{attaform.DdQN7sgN.cjs → attaform.NLmerepI.mjs} +175 -557
- package/dist/shared/attaform.h0i6LijT.mjs +242 -0
- package/dist/shared/{attaform.Biytrv0-.cjs → attaform.uLbun31C.mjs} +204 -544
- package/dist/shared/attaform.v0fQtWyA.mjs +0 -1
- package/dist/shared/attaform.wfY8XFvm.mjs +197 -0
- package/dist/transforms.mjs +0 -1
- package/dist/vite.d.mts +17 -5
- package/dist/vite.mjs +24 -2
- package/dist/webpack.d.mts +6 -1
- package/dist/webpack.mjs +0 -1
- package/dist/zod-v3.d.mts +11 -6
- package/dist/zod-v3.mjs +17 -4
- package/dist/zod-v4.d.mts +12 -6
- package/dist/zod-v4.mjs +16 -4
- package/dist/zod.d.mts +4 -3
- package/dist/zod.mjs +5 -4
- package/package.json +23 -8
- package/skills/attaform/SKILL.md +2 -1
- package/dist/abstract.cjs +0 -48
- package/dist/abstract.cjs.map +0 -1
- package/dist/abstract.d.cts +0 -42
- package/dist/abstract.d.ts +0 -42
- package/dist/abstract.mjs.map +0 -1
- package/dist/chunks/dev-key-collision-warnings.cjs +0 -25
- package/dist/chunks/dev-key-collision-warnings.cjs.map +0 -1
- package/dist/chunks/dev-key-collision-warnings.mjs.map +0 -1
- package/dist/chunks/devtools.cjs +0 -157
- package/dist/chunks/devtools.cjs.map +0 -1
- package/dist/chunks/devtools.mjs.map +0 -1
- package/dist/chunks/fingerprint.cjs.map +0 -1
- package/dist/chunks/fingerprint.mjs.map +0 -1
- package/dist/chunks/fingerprint2.cjs.map +0 -1
- package/dist/chunks/fingerprint2.mjs.map +0 -1
- package/dist/esbuild.cjs +0 -28
- package/dist/esbuild.cjs.map +0 -1
- package/dist/esbuild.d.cts +0 -56
- package/dist/esbuild.d.ts +0 -56
- package/dist/esbuild.mjs.map +0 -1
- package/dist/index.cjs +0 -51
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -249
- package/dist/index.d.ts +0 -249
- package/dist/index.mjs.map +0 -1
- package/dist/nuxt.cjs +0 -84
- package/dist/nuxt.cjs.map +0 -1
- package/dist/nuxt.d.cts +0 -66
- package/dist/nuxt.d.ts +0 -66
- package/dist/nuxt.mjs.map +0 -1
- package/dist/rollup.cjs +0 -24
- package/dist/rollup.cjs.map +0 -1
- package/dist/rollup.d.cts +0 -35
- package/dist/rollup.d.ts +0 -35
- package/dist/rollup.mjs.map +0 -1
- package/dist/rspack.cjs +0 -10
- package/dist/rspack.cjs.map +0 -1
- package/dist/rspack.d.cts +0 -40
- package/dist/rspack.d.ts +0 -40
- package/dist/rspack.mjs.map +0 -1
- package/dist/runtime/components/AttaformDevtoolsPanel.vue.d.ts +0 -7
- package/dist/runtime/components/DevtoolsValueTree.vue.d.ts +0 -35
- package/dist/runtime/plugins/attaform.cjs +0 -43
- package/dist/runtime/plugins/attaform.cjs.map +0 -1
- package/dist/runtime/plugins/attaform.d.cts +0 -5
- package/dist/runtime/plugins/attaform.d.ts +0 -5
- package/dist/runtime/plugins/attaform.mjs.map +0 -1
- package/dist/shared/attaform.B1ZYt2Li.mjs.map +0 -1
- package/dist/shared/attaform.B9Wyhfro.cjs.map +0 -1
- package/dist/shared/attaform.BGDV42hI.d.cts +0 -232
- package/dist/shared/attaform.BJGA_UOS.mjs.map +0 -1
- package/dist/shared/attaform.Biytrv0-.cjs.map +0 -1
- package/dist/shared/attaform.Bn0IzhD_.cjs +0 -800
- package/dist/shared/attaform.Bn0IzhD_.cjs.map +0 -1
- package/dist/shared/attaform.C9fPTxjB.d.cts +0 -41
- package/dist/shared/attaform.C9fPTxjB.d.ts +0 -41
- package/dist/shared/attaform.CKH2lGdL.mjs.map +0 -1
- package/dist/shared/attaform.CQN9R62B.cjs.map +0 -1
- package/dist/shared/attaform.CoR4mWfv.mjs.map +0 -1
- package/dist/shared/attaform.Cs2Rbdlo.mjs.map +0 -1
- package/dist/shared/attaform.D6tk90Rc.cjs.map +0 -1
- package/dist/shared/attaform.D8kliaKw.cjs.map +0 -1
- package/dist/shared/attaform.DLknk9nF.d.mts +0 -232
- package/dist/shared/attaform.DMxM2kol.mjs.map +0 -1
- package/dist/shared/attaform.DRUT703x.d.cts +0 -56
- package/dist/shared/attaform.DRUT703x.d.ts +0 -56
- package/dist/shared/attaform.DYEr28Pt.mjs.map +0 -1
- package/dist/shared/attaform.DdQN7sgN.cjs.map +0 -1
- package/dist/shared/attaform.DhnPb6nK.mjs.map +0 -1
- package/dist/shared/attaform.DniawQLP.d.mts +0 -4763
- package/dist/shared/attaform.DniawQLP.d.ts +0 -4763
- package/dist/shared/attaform.DoQm_Vkd.cjs +0 -58
- package/dist/shared/attaform.DoQm_Vkd.cjs.map +0 -1
- package/dist/shared/attaform.DrvMscNX.cjs.map +0 -1
- package/dist/shared/attaform.F2Q8iv38.d.ts +0 -2494
- package/dist/shared/attaform.FmqKO1Ex.d.cts +0 -2494
- package/dist/shared/attaform.KvlEedlF.mjs.map +0 -1
- package/dist/shared/attaform.RaTzp1WF.cjs +0 -26
- package/dist/shared/attaform.RaTzp1WF.cjs.map +0 -1
- package/dist/shared/attaform.nMaz2C5P.mjs.map +0 -1
- package/dist/shared/attaform.v0fQtWyA.mjs.map +0 -1
- package/dist/shared/attaform.yUrz7C2z.cjs +0 -29
- package/dist/shared/attaform.yUrz7C2z.cjs.map +0 -1
- package/dist/transforms.cjs +0 -12
- package/dist/transforms.cjs.map +0 -1
- package/dist/transforms.d.cts +0 -73
- package/dist/transforms.d.ts +0 -73
- package/dist/transforms.mjs.map +0 -1
- package/dist/vite.cjs +0 -363
- package/dist/vite.cjs.map +0 -1
- package/dist/vite.d.cts +0 -133
- package/dist/vite.d.ts +0 -133
- package/dist/vite.mjs.map +0 -1
- package/dist/webpack.cjs +0 -10
- package/dist/webpack.cjs.map +0 -1
- package/dist/webpack.d.cts +0 -37
- package/dist/webpack.d.ts +0 -37
- package/dist/webpack.mjs.map +0 -1
- package/dist/zod-v3.cjs +0 -53
- package/dist/zod-v3.cjs.map +0 -1
- package/dist/zod-v3.d.cts +0 -246
- package/dist/zod-v3.d.ts +0 -246
- package/dist/zod-v3.mjs.map +0 -1
- package/dist/zod-v4.cjs +0 -55
- package/dist/zod-v4.cjs.map +0 -1
- package/dist/zod-v4.d.cts +0 -172
- package/dist/zod-v4.d.ts +0 -172
- package/dist/zod-v4.mjs.map +0 -1
- package/dist/zod.cjs +0 -51
- package/dist/zod.cjs.map +0 -1
- package/dist/zod.d.cts +0 -7
- package/dist/zod.d.ts +0 -7
- package/dist/zod.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attaform.v0fQtWyA.mjs","sources":["../../src/core/webpack-family-plugin.ts"],"sourcesContent":["/**\n * Shared webpack/rspack plugin body. Rspack mirrors webpack's plugin API\n * for the resolve hooks attaform taps, so one implementation backs both\n * `attaform/webpack` and `attaform/rspack`; only the diagnostic `tag`\n * differs.\n *\n * The plugin taps `normalModuleFactory.beforeResolve` and rewrites the\n * `attaform` / `attaform/zod` request to the matching adapter subpath, the\n * same effect as webpack's own `NormalModuleReplacementPlugin` but tapping\n * the hook directly so the plugin imports nothing from webpack/rspack\n * (keeping attaform dependency-free). The bundler injects the hook API at\n * the consumer's build, so the minimal structural types below are all the\n * plugin needs to compile.\n *\n * Build-time only: never part of a consumer's browser bundle.\n */\nimport { isRewritableZodSpecifier, resolveZodAliasTarget } from './detect-zod-major'\n\nexport interface WebpackFamilyPluginOptions {\n /**\n * Rewrite `attaform` and `attaform/zod` imports at build time to the\n * matching adapter subpath, based on the consumer's installed Zod major.\n * Default `true`. Set to `false` to keep the runtime-dispatch unified\n * entry (ships both adapters) when a project intentionally mixes Zod\n * versions or resolves Zod in a non-standard way.\n */\n resolveZodAlias?: boolean\n /**\n * Project root to resolve the installed Zod from. Defaults to the\n * compiler's `context`, falling back to `process.cwd()`. Set this when\n * the build runs from a directory other than the project that owns the\n * Zod dependency (some monorepo layouts).\n */\n root?: string\n}\n\ninterface WebpackTapable<T> {\n tap(name: string, fn: (arg: T) => void): void\n}\ninterface WebpackResolveData {\n request: string\n}\ninterface WebpackNormalModuleFactory {\n hooks: { beforeResolve: WebpackTapable<WebpackResolveData> }\n}\ninterface WebpackCompiler {\n context?: string\n hooks: { normalModuleFactory: WebpackTapable<WebpackNormalModuleFactory> }\n}\n\n/** The structural shape webpack/rspack require of a plugin: an object\n * with an `apply(compiler)` method. */\nexport interface WebpackFamilyPlugin {\n apply(compiler: WebpackCompiler): void\n}\n\nconst TAP_NAME = 'attaform'\n\nexport function createWebpackFamilyPlugin(\n tag: string,\n options: WebpackFamilyPluginOptions\n): WebpackFamilyPlugin {\n const resolveZodAlias = options.resolveZodAlias !== false\n const warnState = { warned: false }\n return {\n apply(compiler) {\n const root = compiler.context ?? options.root ?? process.cwd()\n const target = resolveZodAliasTarget(root, tag, resolveZodAlias, warnState)\n if (target === null) return\n compiler.hooks.normalModuleFactory.tap(TAP_NAME, (factory) => {\n factory.hooks.beforeResolve.tap(TAP_NAME, (data) => {\n // Rewrite both the bare `attaform` barrel and the explicit\n // `attaform/zod` (both carry the runtime dispatcher) to the one\n // detected adapter; pinned subpaths pass through untouched.\n if (isRewritableZodSpecifier(data.request)) {\n data.request = target\n }\n })\n })\n },\n }\n}\n"],"names":[],"mappings":";;AAwDA,MAAM,QAAA,GAAW,UAAA;AAEV,SAAS,yBAAA,CACd,KACA,OAAA,EACqB;AACrB,EAAA,MAAM,eAAA,GAAkB,QAAQ,eAAA,KAAoB,KAAA;AACpD,EAAA,MAAM,SAAA,GAAY,EAAE,MAAA,EAAQ,KAAA,EAAM;AAClC,EAAA,OAAO;AAAA,IACL,MAAM,QAAA,EAAU;AACd,MAAA,MAAM,OAAO,QAAA,CAAS,OAAA,IAAW,OAAA,CAAQ,IAAA,IAAQ,QAAQ,GAAA,EAAI;AAC7D,MAAA,MAAM,MAAA,GAAS,qBAAA,CAAsB,IAAA,EAAM,GAAA,EAAK,iBAAiB,SAAS,CAAA;AAC1E,MAAA,IAAI,WAAW,IAAA,EAAM;AACrB,MAAA,QAAA,CAAS,KAAA,CAAM,mBAAA,CAAoB,GAAA,CAAI,QAAA,EAAU,CAAC,OAAA,KAAY;AAC5D,QAAA,OAAA,CAAQ,KAAA,CAAM,aAAA,CAAc,GAAA,CAAI,QAAA,EAAU,CAAC,IAAA,KAAS;AAIlD,UAAA,IAAI,wBAAA,CAAyB,IAAA,CAAK,OAAO,CAAA,EAAG;AAC1C,YAAA,IAAA,CAAK,OAAA,GAAU,MAAA;AAAA,UACjB;AAAA,QACF,CAAC,CAAA;AAAA,MACH,CAAC,CAAA;AAAA,IACH;AAAA,GACF;AACF;;;;"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const vue = require('vue');
|
|
4
|
-
|
|
5
|
-
const V_REGISTER_MARKER = /* @__PURE__ */ Symbol.for("attaform:v-register-directive");
|
|
6
|
-
const REGISTER_OWNER_MARKER = /* @__PURE__ */ Symbol.for("attaform:register-owner-marker");
|
|
7
|
-
const SSR_COMPONENT_HOST_MODIFIER = "attaformComponentHost";
|
|
8
|
-
const V_REGISTER_COMPILED_MODIFIER = "attaformCompiled";
|
|
9
|
-
function isRegisterValue(val) {
|
|
10
|
-
if (typeof val !== "object" || val === null) return false;
|
|
11
|
-
if (!("innerRef" in val)) return false;
|
|
12
|
-
if (!vue.isRef(val.innerRef)) return false;
|
|
13
|
-
if (!("registerElement" in val)) return false;
|
|
14
|
-
if (typeof val.registerElement !== "function") return false;
|
|
15
|
-
if (!("setValueWithInternalPath" in val)) return false;
|
|
16
|
-
if (typeof val.setValueWithInternalPath !== "function") return false;
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
function isTransforming(value) {
|
|
20
|
-
return isRegisterValue(value) && value.transforming;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
exports.REGISTER_OWNER_MARKER = REGISTER_OWNER_MARKER;
|
|
24
|
-
exports.SSR_COMPONENT_HOST_MODIFIER = SSR_COMPONENT_HOST_MODIFIER;
|
|
25
|
-
exports.V_REGISTER_COMPILED_MODIFIER = V_REGISTER_COMPILED_MODIFIER;
|
|
26
|
-
exports.V_REGISTER_MARKER = V_REGISTER_MARKER;
|
|
27
|
-
exports.isRegisterValue = isRegisterValue;
|
|
28
|
-
exports.isTransforming = isTransforming;
|
|
29
|
-
//# sourceMappingURL=attaform.yUrz7C2z.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attaform.yUrz7C2z.cjs","sources":["../../src/runtime/core/register-protocol.ts"],"sourcesContent":["import { isRef } from 'vue'\nimport type { InternalRegisterValue, RegisterValue } from '../types/types-api'\n\n// Shared register-protocol primitives: the markers and value guards that\n// the v-register directive, its file / lifecycle satellites, and\n// useRegister all build on. They live in this leaf (depending only on vue\n// and the types module) so those modules don't import directive.ts back,\n// which would form an import cycle.\n\n/**\n * Marker installed on the v-register directive object so consumers\n * (notably `useRegister`) can identify it in a child vnode's\n * directive list even when the consumer's bundler hasn't installed\n * attaform's compile-time transforms. `Symbol.for(...)` round-trips\n * across duplicate bundle copies: `attaform` and `attaform/zod` can\n * land on different `vRegister` references in the playground or\n * under pnpm-hoist edge cases, but both carry the same marker.\n */\nexport const V_REGISTER_MARKER: unique symbol = Symbol.for('attaform:v-register-directive')\n\n/**\n * Marker on the rendered root DOM element. Set by `useRegister`'s\n * `onMounted` hook; read by the directive's deferred warn check to\n * skip the \"is a no-op\" warn for components that handle binding via\n * an inner v-register.\n *\n * `Symbol.for(...)` so the marker round-trips across duplicate copies\n * of attaform — see `assignKey` in core/directive.ts for the same\n * reasoning. `useRegister` and the directive are typically loaded\n * from the same module copy, but a consumer importing from\n * `attaform/zod` (Vite-optimized bundle) and the Nuxt\n * plugin's relative-path import (live ESM) can land on different\n * copies; a global symbol means the marker check still works.\n */\nexport const REGISTER_OWNER_MARKER: unique symbol = Symbol.for('attaform:register-owner-marker')\n\n/**\n * Directive modifier the `componentBridgeTransform` stamps onto a\n * `v-register` that lands on a component host (or kebab custom element).\n * It is the compile-time -> runtime signal the directive's `getSSRProps`\n * reads under compiled SSR, where Vue passes a `null` vnode and the host\n * is otherwise indistinguishable from a native control. autoAria then\n * suppresses its attrs on the host root (the inner control the component\n * re-binds via useRegister carries them). Namespaced to avoid collision\n * with any author-written modifier. (#404)\n */\nexport const SSR_COMPONENT_HOST_MODIFIER = 'attaformComponentHost'\n\n/**\n * Directive modifier the `redundantBindingWarnTransform` stamps onto\n * every `v-register` it processes. It is the compile-time -> runtime\n * signal that Attaform's template transforms are active, and it lets the\n * runtime redundant-binding diagnostic (in the directive's `created`\n * hook) stand down.\n *\n * The hand-off matters because `inputTextAreaNodeTransform` strips the\n * author's `value` / `checked` and injects its own. Once that has run,\n * `vnode.props` no longer reflects what the author wrote, so a runtime\n * check would flag every field. With this marker present the compile\n * layer owns detection (it reads the authored props BEFORE injection);\n * with it absent (no bundler plugin) the runtime layer reads the\n * untouched `vnode.props` directly. Exactly one layer fires per\n * consumer, never both.\n *\n * Namespaced to avoid collision with any author-written modifier, like\n * `SSR_COMPONENT_HOST_MODIFIER` above.\n */\nexport const V_REGISTER_COMPILED_MODIFIER = 'attaformCompiled'\n\n/**\n * Type guard for a `RegisterValue`. Returns `true` when `val` looks\n * like the object returned from `form.register(path)`.\n *\n * ```ts\n * if (isRegisterValue(slotValue)) {\n * // slotValue.innerRef is now a Ref<unknown>\n * }\n * ```\n *\n * Useful when building wrapper components that accept either a\n * `RegisterValue` or a plain ref via the same prop.\n */\nexport function isRegisterValue<Value = unknown>(val: unknown): val is RegisterValue<Value> {\n if (typeof val !== 'object' || val === null) return false\n if (!('innerRef' in val)) return false\n if (!isRef(val.innerRef)) return false\n if (!('registerElement' in val)) return false\n if (typeof val.registerElement !== 'function') return false\n if (!('setValueWithInternalPath' in val)) return false\n if (typeof val.setValueWithInternalPath !== 'function') return false\n return true\n}\n\n/**\n * `true` while a deferred async transform is in flight at this path.\n * `beginTransform` flips it synchronously inside the assigner, so a\n * listener's post-write force-sync block reads it (right after the\n * assigner returns) to skip snapping the DOM back to stale storage —\n * the resolved value is painted in by the orchestrator's `syncDom`\n * once the run lands.\n */\nexport function isTransforming(value: unknown): boolean {\n return isRegisterValue(value) && (value as InternalRegisterValue).transforming\n}\n"],"names":["isRef"],"mappings":";;;;AAkBO,MAAM,iBAAA,mBAAmC,MAAA,CAAO,GAAA,CAAI,+BAA+B;AAgBnF,MAAM,qBAAA,mBAAuC,MAAA,CAAO,GAAA,CAAI,gCAAgC;AAYxF,MAAM,2BAAA,GAA8B;AAqBpC,MAAM,4BAAA,GAA+B;AAerC,SAAS,gBAAiC,GAAA,EAA2C;AAC1F,EAAA,IAAI,OAAO,GAAA,KAAQ,QAAA,IAAY,GAAA,KAAQ,MAAM,OAAO,KAAA;AACpD,EAAA,IAAI,EAAE,UAAA,IAAc,GAAA,CAAA,EAAM,OAAO,KAAA;AACjC,EAAA,IAAI,CAACA,SAAA,CAAM,GAAA,CAAI,QAAQ,GAAG,OAAO,KAAA;AACjC,EAAA,IAAI,EAAE,iBAAA,IAAqB,GAAA,CAAA,EAAM,OAAO,KAAA;AACxC,EAAA,IAAI,OAAO,GAAA,CAAI,eAAA,KAAoB,UAAA,EAAY,OAAO,KAAA;AACtD,EAAA,IAAI,EAAE,0BAAA,IAA8B,GAAA,CAAA,EAAM,OAAO,KAAA;AACjD,EAAA,IAAI,OAAO,GAAA,CAAI,wBAAA,KAA6B,UAAA,EAAY,OAAO,KAAA;AAC/D,EAAA,OAAO,IAAA;AACT;AAUO,SAAS,eAAe,KAAA,EAAyB;AACtD,EAAA,OAAO,eAAA,CAAgB,KAAK,CAAA,IAAM,KAAA,CAAgC,YAAA;AACpE;;;;;;;;;"}
|
package/dist/transforms.cjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const vRegisterPreambleTransform = require('./shared/attaform.Bn0IzhD_.cjs');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
exports.componentBridgeTransform = vRegisterPreambleTransform.componentBridgeTransform;
|
|
8
|
-
exports.inputTextAreaNodeTransform = vRegisterPreambleTransform.inputTextAreaNodeTransform;
|
|
9
|
-
exports.redundantBindingWarnTransform = vRegisterPreambleTransform.redundantBindingWarnTransform;
|
|
10
|
-
exports.vRegisterHintTransform = vRegisterPreambleTransform.vRegisterHintTransform;
|
|
11
|
-
exports.vRegisterPreambleTransform = vRegisterPreambleTransform.vRegisterPreambleTransform;
|
|
12
|
-
//# sourceMappingURL=transforms.cjs.map
|
package/dist/transforms.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transforms.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
package/dist/transforms.d.cts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { NodeTransform } from '@vue/compiler-core';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Vue compiler node transform that bridges `v-register` into the
|
|
5
|
-
* downstream binding shapes its consumers expect:
|
|
6
|
-
*
|
|
7
|
-
* - `<select v-register>` — injects `:value` (single-select) and
|
|
8
|
-
* per-`<option>` `:selected` so the runtime directive can pre-mark
|
|
9
|
-
* selected options at SSR time.
|
|
10
|
-
* - `<MyComponent v-register>` and kebab-case custom-element hosts
|
|
11
|
-
* — injects a `:registerValue` bridge prop so `useRegister` inside
|
|
12
|
-
* the child sees the parent's RegisterValue (the binding the audit
|
|
13
|
-
* called out as the transform's "fires on every component" path),
|
|
14
|
-
* and marks any parent-authored slotted `<option>`s with `:selected`
|
|
15
|
-
* the same way the native path does, so a `<select>` wrapped in a
|
|
16
|
-
* styled component keeps its SSR-selected option (#394).
|
|
17
|
-
*
|
|
18
|
-
* Wired automatically by `attaform/vite` and `attaform/nuxt`. Use
|
|
19
|
-
* directly only when integrating with a custom bundler.
|
|
20
|
-
*
|
|
21
|
-
* Renamed from `selectNodeTransform` (DIR-F6): the original name read
|
|
22
|
-
* as a `<select>`-only transform, but the component-bridge path is
|
|
23
|
-
* load-bearing for every `useRegister` consumer.
|
|
24
|
-
*/
|
|
25
|
-
declare const componentBridgeTransform: NodeTransform;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Vue compiler node transform for `<input v-register>` and
|
|
29
|
-
* `<textarea v-register>`. Injects the `:value` / `:checked`
|
|
30
|
-
* bindings required for SSR-correct initial render.
|
|
31
|
-
*
|
|
32
|
-
* Wired automatically by `attaform/vite` and
|
|
33
|
-
* `attaform/nuxt`. Use directly only when integrating with
|
|
34
|
-
* a custom bundler.
|
|
35
|
-
*/
|
|
36
|
-
declare const inputTextAreaNodeTransform: NodeTransform;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Vue compiler node transform that warns about a redundant state
|
|
40
|
-
* binding co-located with `v-register`, and stamps the
|
|
41
|
-
* compile-active marker so the runtime diagnostic stands down.
|
|
42
|
-
*
|
|
43
|
-
* Must run BEFORE `inputTextAreaNodeTransform` and
|
|
44
|
-
* `componentBridgeTransform` so it reads the author's props before they
|
|
45
|
-
* are stripped / injected. Wired first by `attaform/vite` and
|
|
46
|
-
* `attaform/nuxt`.
|
|
47
|
-
*/
|
|
48
|
-
declare const redundantBindingWarnTransform: NodeTransform;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Vue compiler node transform that wraps every `v-register`
|
|
52
|
-
* expression in a small IIFE so the directive can flag a field as
|
|
53
|
-
* connected during SSR. Eliminates the `false → true` flicker on
|
|
54
|
-
* `getFieldState(path).connected` after hydration.
|
|
55
|
-
*
|
|
56
|
-
* Must run after `vRegisterPreambleTransform`. Wired automatically
|
|
57
|
-
* by `attaform/vite` and `attaform/nuxt`.
|
|
58
|
-
*/
|
|
59
|
-
declare const vRegisterHintTransform: NodeTransform;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Vue compiler node transform that hoists `v-register`'s SSR
|
|
63
|
-
* connection marks to the root of the template. Together with
|
|
64
|
-
* `vRegisterHintTransform`, ensures expressions earlier in the
|
|
65
|
-
* template that read `getFieldState(path).connected` see the
|
|
66
|
-
* correct value during the server's single-pass render.
|
|
67
|
-
*
|
|
68
|
-
* Must run before `vRegisterHintTransform`. Wired automatically
|
|
69
|
-
* by `attaform/vite` and `attaform/nuxt`.
|
|
70
|
-
*/
|
|
71
|
-
declare const vRegisterPreambleTransform: NodeTransform;
|
|
72
|
-
|
|
73
|
-
export { componentBridgeTransform, inputTextAreaNodeTransform, redundantBindingWarnTransform, vRegisterHintTransform, vRegisterPreambleTransform };
|
package/dist/transforms.d.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { NodeTransform } from '@vue/compiler-core';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Vue compiler node transform that bridges `v-register` into the
|
|
5
|
-
* downstream binding shapes its consumers expect:
|
|
6
|
-
*
|
|
7
|
-
* - `<select v-register>` — injects `:value` (single-select) and
|
|
8
|
-
* per-`<option>` `:selected` so the runtime directive can pre-mark
|
|
9
|
-
* selected options at SSR time.
|
|
10
|
-
* - `<MyComponent v-register>` and kebab-case custom-element hosts
|
|
11
|
-
* — injects a `:registerValue` bridge prop so `useRegister` inside
|
|
12
|
-
* the child sees the parent's RegisterValue (the binding the audit
|
|
13
|
-
* called out as the transform's "fires on every component" path),
|
|
14
|
-
* and marks any parent-authored slotted `<option>`s with `:selected`
|
|
15
|
-
* the same way the native path does, so a `<select>` wrapped in a
|
|
16
|
-
* styled component keeps its SSR-selected option (#394).
|
|
17
|
-
*
|
|
18
|
-
* Wired automatically by `attaform/vite` and `attaform/nuxt`. Use
|
|
19
|
-
* directly only when integrating with a custom bundler.
|
|
20
|
-
*
|
|
21
|
-
* Renamed from `selectNodeTransform` (DIR-F6): the original name read
|
|
22
|
-
* as a `<select>`-only transform, but the component-bridge path is
|
|
23
|
-
* load-bearing for every `useRegister` consumer.
|
|
24
|
-
*/
|
|
25
|
-
declare const componentBridgeTransform: NodeTransform;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Vue compiler node transform for `<input v-register>` and
|
|
29
|
-
* `<textarea v-register>`. Injects the `:value` / `:checked`
|
|
30
|
-
* bindings required for SSR-correct initial render.
|
|
31
|
-
*
|
|
32
|
-
* Wired automatically by `attaform/vite` and
|
|
33
|
-
* `attaform/nuxt`. Use directly only when integrating with
|
|
34
|
-
* a custom bundler.
|
|
35
|
-
*/
|
|
36
|
-
declare const inputTextAreaNodeTransform: NodeTransform;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Vue compiler node transform that warns about a redundant state
|
|
40
|
-
* binding co-located with `v-register`, and stamps the
|
|
41
|
-
* compile-active marker so the runtime diagnostic stands down.
|
|
42
|
-
*
|
|
43
|
-
* Must run BEFORE `inputTextAreaNodeTransform` and
|
|
44
|
-
* `componentBridgeTransform` so it reads the author's props before they
|
|
45
|
-
* are stripped / injected. Wired first by `attaform/vite` and
|
|
46
|
-
* `attaform/nuxt`.
|
|
47
|
-
*/
|
|
48
|
-
declare const redundantBindingWarnTransform: NodeTransform;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Vue compiler node transform that wraps every `v-register`
|
|
52
|
-
* expression in a small IIFE so the directive can flag a field as
|
|
53
|
-
* connected during SSR. Eliminates the `false → true` flicker on
|
|
54
|
-
* `getFieldState(path).connected` after hydration.
|
|
55
|
-
*
|
|
56
|
-
* Must run after `vRegisterPreambleTransform`. Wired automatically
|
|
57
|
-
* by `attaform/vite` and `attaform/nuxt`.
|
|
58
|
-
*/
|
|
59
|
-
declare const vRegisterHintTransform: NodeTransform;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Vue compiler node transform that hoists `v-register`'s SSR
|
|
63
|
-
* connection marks to the root of the template. Together with
|
|
64
|
-
* `vRegisterHintTransform`, ensures expressions earlier in the
|
|
65
|
-
* template that read `getFieldState(path).connected` see the
|
|
66
|
-
* correct value during the server's single-pass render.
|
|
67
|
-
*
|
|
68
|
-
* Must run before `vRegisterHintTransform`. Wired automatically
|
|
69
|
-
* by `attaform/vite` and `attaform/nuxt`.
|
|
70
|
-
*/
|
|
71
|
-
declare const vRegisterPreambleTransform: NodeTransform;
|
|
72
|
-
|
|
73
|
-
export { componentBridgeTransform, inputTextAreaNodeTransform, redundantBindingWarnTransform, vRegisterHintTransform, vRegisterPreambleTransform };
|
package/dist/transforms.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transforms.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/vite.cjs
DELETED
|
@@ -1,363 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const detectZodMajor = require('./shared/attaform.DoQm_Vkd.cjs');
|
|
4
|
-
const vRegisterPreambleTransform = require('./shared/attaform.Bn0IzhD_.cjs');
|
|
5
|
-
const compilerSfc = require('@vue/compiler-sfc');
|
|
6
|
-
const compilerCore = require('@vue/compiler-core');
|
|
7
|
-
|
|
8
|
-
const attaformAutoImports = [
|
|
9
|
-
{ name: "useForm", from: "attaform/zod" },
|
|
10
|
-
{ name: "useWizard", from: "attaform/zod" },
|
|
11
|
-
{ name: "injectForm", from: "attaform/zod" },
|
|
12
|
-
{ name: "injectWizard", from: "attaform/zod" },
|
|
13
|
-
{ name: "fieldMeta", from: "attaform/zod" },
|
|
14
|
-
{ name: "withMeta", from: "attaform/zod" },
|
|
15
|
-
{ name: "lazy", from: "attaform/zod" },
|
|
16
|
-
{ name: "gate", from: "attaform/zod" }
|
|
17
|
-
];
|
|
18
|
-
const attaformAutoImportsMap = attaformAutoImports.reduce((map, entry) => {
|
|
19
|
-
const names = map[entry.from] ?? [];
|
|
20
|
-
names.push(entry.name);
|
|
21
|
-
map[entry.from] = names;
|
|
22
|
-
return map;
|
|
23
|
-
}, {});
|
|
24
|
-
|
|
25
|
-
var __defProp = Object.defineProperty;
|
|
26
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
27
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
28
|
-
const TARGET_PACKAGES = /* @__PURE__ */ new Set(["attaform", "attaform/zod", "attaform/zod-v3", "attaform/zod-v4"]);
|
|
29
|
-
const TARGET_FUNCTIONS = /* @__PURE__ */ new Set(["useForm", "injectForm"]);
|
|
30
|
-
class SourceEditor {
|
|
31
|
-
constructor(original) {
|
|
32
|
-
__publicField(this, "original");
|
|
33
|
-
__publicField(this, "edits", []);
|
|
34
|
-
this.original = original;
|
|
35
|
-
}
|
|
36
|
-
appendRight(offset, text) {
|
|
37
|
-
this.edits.push({ start: offset, end: offset, replacement: text });
|
|
38
|
-
}
|
|
39
|
-
overwrite(start, end, text) {
|
|
40
|
-
this.edits.push({ start, end, replacement: text });
|
|
41
|
-
}
|
|
42
|
-
toString() {
|
|
43
|
-
let out = this.original;
|
|
44
|
-
for (const e of [...this.edits].sort((a, b) => b.start - a.start)) {
|
|
45
|
-
out = out.slice(0, e.start) + e.replacement + out.slice(e.end);
|
|
46
|
-
}
|
|
47
|
-
return out;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
function transformSsrAccessed(code, id) {
|
|
51
|
-
if (!id.endsWith(".vue")) return null;
|
|
52
|
-
const { descriptor } = compilerSfc.parse(code, { filename: id });
|
|
53
|
-
if (descriptor.scriptSetup === null || descriptor.template === null) return null;
|
|
54
|
-
const scriptSource = descriptor.scriptSetup.content;
|
|
55
|
-
const scriptOffset = descriptor.scriptSetup.loc.start.offset;
|
|
56
|
-
let scriptAst;
|
|
57
|
-
try {
|
|
58
|
-
scriptAst = compilerSfc.babelParse(scriptSource, {
|
|
59
|
-
sourceType: "module",
|
|
60
|
-
plugins: ["typescript"]
|
|
61
|
-
});
|
|
62
|
-
} catch {
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
const program = scriptAst.program ?? scriptAst;
|
|
66
|
-
const body = program.body ?? [];
|
|
67
|
-
const localImports = collectImports(body);
|
|
68
|
-
if (localImports.size === 0) return null;
|
|
69
|
-
const bindings = collectBindings(body, localImports);
|
|
70
|
-
if (bindings.size === 0) return null;
|
|
71
|
-
const referenced = collectTemplateReferences(descriptor.template.ast, bindings);
|
|
72
|
-
if (referenced.size === 0) return null;
|
|
73
|
-
const editor = new SourceEditor(code);
|
|
74
|
-
for (const name of referenced) {
|
|
75
|
-
const entry = bindings.get(name);
|
|
76
|
-
if (entry === void 0) continue;
|
|
77
|
-
injectMark(editor, entry.call, scriptOffset);
|
|
78
|
-
}
|
|
79
|
-
return {
|
|
80
|
-
code: editor.toString(),
|
|
81
|
-
map: null
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
function collectImports(body) {
|
|
85
|
-
const locals = /* @__PURE__ */ new Map();
|
|
86
|
-
for (const node of body) {
|
|
87
|
-
if (node.type !== "ImportDeclaration") continue;
|
|
88
|
-
const decl = node;
|
|
89
|
-
const source = decl.source.value;
|
|
90
|
-
if (!TARGET_PACKAGES.has(source)) continue;
|
|
91
|
-
for (const specifier of decl.specifiers) {
|
|
92
|
-
if (specifier.type !== "ImportSpecifier") continue;
|
|
93
|
-
const spec = specifier;
|
|
94
|
-
const imported = spec.imported;
|
|
95
|
-
const importedName = imported.type === "Identifier" ? imported.name : imported.value;
|
|
96
|
-
if (importedName === void 0 || !TARGET_FUNCTIONS.has(importedName)) continue;
|
|
97
|
-
locals.set(spec.local.name, importedName);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return locals;
|
|
101
|
-
}
|
|
102
|
-
function collectBindings(body, localImports) {
|
|
103
|
-
const bindings = /* @__PURE__ */ new Map();
|
|
104
|
-
for (const node of body) {
|
|
105
|
-
if (node.type !== "VariableDeclaration") continue;
|
|
106
|
-
const decl = node;
|
|
107
|
-
for (const declarator of decl.declarations) {
|
|
108
|
-
const id = declarator.id;
|
|
109
|
-
if (id.type !== "Identifier") continue;
|
|
110
|
-
const idNode = id;
|
|
111
|
-
const init = declarator.init;
|
|
112
|
-
if (init === null || init === void 0 || init.type !== "CallExpression") continue;
|
|
113
|
-
const call = init;
|
|
114
|
-
if (call.callee.type !== "Identifier") continue;
|
|
115
|
-
const callName = call.callee.name;
|
|
116
|
-
const tracked = localImports.get(callName);
|
|
117
|
-
if (tracked === void 0) continue;
|
|
118
|
-
bindings.set(idNode.name, { callee: tracked, call });
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
return bindings;
|
|
122
|
-
}
|
|
123
|
-
function collectTemplateReferences(root, bindings) {
|
|
124
|
-
const referenced = /* @__PURE__ */ new Set();
|
|
125
|
-
if (root === void 0) return referenced;
|
|
126
|
-
const candidates = new Set(bindings.keys());
|
|
127
|
-
if (candidates.size === 0) return referenced;
|
|
128
|
-
const visit = (node) => {
|
|
129
|
-
if ("children" in node && Array.isArray(node.children)) {
|
|
130
|
-
for (const child of node.children) visit(child);
|
|
131
|
-
}
|
|
132
|
-
if (node.type === compilerCore.NodeTypes.INTERPOLATION) {
|
|
133
|
-
collectFromExpression(node.content, candidates, referenced);
|
|
134
|
-
} else if (node.type === compilerCore.NodeTypes.ELEMENT && Array.isArray(node.props)) {
|
|
135
|
-
for (const prop of node.props) {
|
|
136
|
-
if (prop.type === compilerCore.NodeTypes.DIRECTIVE) {
|
|
137
|
-
if (prop.exp !== void 0 && prop.exp !== null) {
|
|
138
|
-
collectFromExpression(prop.exp, candidates, referenced);
|
|
139
|
-
}
|
|
140
|
-
if (prop.arg !== void 0 && prop.arg !== null) {
|
|
141
|
-
collectFromExpression(prop.arg, candidates, referenced);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
visit(root);
|
|
148
|
-
return referenced;
|
|
149
|
-
}
|
|
150
|
-
function collectFromExpression(expr, candidates, out) {
|
|
151
|
-
if (expr === null || expr === void 0) return;
|
|
152
|
-
if (typeof expr !== "object") return;
|
|
153
|
-
const node = expr;
|
|
154
|
-
if (node.type === compilerCore.NodeTypes.SIMPLE_EXPRESSION && typeof node.content === "string") {
|
|
155
|
-
for (const name of candidates) {
|
|
156
|
-
if (matchesIdentifier(node.content, name)) out.add(name);
|
|
157
|
-
}
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
if (node.type === compilerCore.NodeTypes.COMPOUND_EXPRESSION && Array.isArray(node.children)) {
|
|
161
|
-
for (const child of node.children) collectFromExpression(child, candidates, out);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
function matchesIdentifier(source, name) {
|
|
165
|
-
const pattern = new RegExp(`(?<![\\w$])${escapeForRegExp(name)}(?![\\w$])`);
|
|
166
|
-
return pattern.test(source);
|
|
167
|
-
}
|
|
168
|
-
function escapeForRegExp(value) {
|
|
169
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
170
|
-
}
|
|
171
|
-
function injectMark(editor, call, scriptOffset) {
|
|
172
|
-
const args = call.arguments;
|
|
173
|
-
if (args.length === 0) {
|
|
174
|
-
const calleeEnd = call.callee.end;
|
|
175
|
-
if (calleeEnd === null || calleeEnd === void 0) return;
|
|
176
|
-
const openParenAbs = findChar(editor.original, "(", scriptOffset + calleeEnd) + 1;
|
|
177
|
-
editor.appendRight(openParenAbs, "{ __ssrAccessed: true }");
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
const first = args[0];
|
|
181
|
-
if (first === void 0) return;
|
|
182
|
-
if (first.type === "ObjectExpression") {
|
|
183
|
-
const obj = first;
|
|
184
|
-
if (obj.start === null || obj.start === void 0) return;
|
|
185
|
-
const openBraceAbs = scriptOffset + obj.start + 1;
|
|
186
|
-
const insertion = obj.properties.length === 0 ? " __ssrAccessed: true " : " __ssrAccessed: true,";
|
|
187
|
-
editor.appendRight(openBraceAbs, insertion);
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
if (first.type === "StringLiteral") {
|
|
191
|
-
const lit = first;
|
|
192
|
-
if (lit.start === null || lit.start === void 0) return;
|
|
193
|
-
if (lit.end === null || lit.end === void 0) return;
|
|
194
|
-
const startAbs = scriptOffset + lit.start;
|
|
195
|
-
const endAbs = scriptOffset + lit.end;
|
|
196
|
-
const original = editor.original.slice(startAbs, endAbs);
|
|
197
|
-
editor.overwrite(startAbs, endAbs, `{ key: ${original}, __ssrAccessed: true }`);
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
function findChar(source, target, from) {
|
|
202
|
-
for (let i = from; i < source.length; i += 1) {
|
|
203
|
-
if (source[i] === target) return i;
|
|
204
|
-
}
|
|
205
|
-
return -1;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
function attaform(options = {}) {
|
|
209
|
-
const resolveZodAlias = options.resolveZodAlias !== false;
|
|
210
|
-
let aliasTarget = null;
|
|
211
|
-
const warnState = { warned: false };
|
|
212
|
-
return {
|
|
213
|
-
name: "attaform",
|
|
214
|
-
enforce: "pre",
|
|
215
|
-
configResolved(resolved) {
|
|
216
|
-
var _a, _b;
|
|
217
|
-
const vuePlugin = resolved.plugins.find((p) => p.name === "vite:vue");
|
|
218
|
-
if (vuePlugin === void 0) {
|
|
219
|
-
throw new Error(
|
|
220
|
-
"[attaform/vite] @vitejs/plugin-vue is not installed (or not registered before attaform()). Install @vitejs/plugin-vue and place `attaform()` after `vue()` in your plugins array."
|
|
221
|
-
);
|
|
222
|
-
}
|
|
223
|
-
const api = vuePlugin.api;
|
|
224
|
-
if (api?.options === void 0) {
|
|
225
|
-
throw new Error(
|
|
226
|
-
"[attaform/vite] Found @vitejs/plugin-vue but it does not expose `api.options`. This usually means a version-incompatible @vitejs/plugin-vue (or a wrapper plugin re-exporting it). Pin @vitejs/plugin-vue to a version compatible with the documented `api.options.template.compilerOptions.nodeTransforms` surface."
|
|
227
|
-
);
|
|
228
|
-
}
|
|
229
|
-
(_a = api.options).template ?? (_a.template = {});
|
|
230
|
-
(_b = api.options.template).compilerOptions ?? (_b.compilerOptions = {});
|
|
231
|
-
const existing = api.options.template.compilerOptions.nodeTransforms ?? [];
|
|
232
|
-
if (!existing.includes(vRegisterPreambleTransform.vRegisterPreambleTransform)) {
|
|
233
|
-
api.options.template.compilerOptions.nodeTransforms = [
|
|
234
|
-
...existing,
|
|
235
|
-
vRegisterPreambleTransform.redundantBindingWarnTransform,
|
|
236
|
-
vRegisterPreambleTransform.componentBridgeTransform,
|
|
237
|
-
vRegisterPreambleTransform.inputTextAreaNodeTransform,
|
|
238
|
-
vRegisterPreambleTransform.vRegisterPreambleTransform,
|
|
239
|
-
vRegisterPreambleTransform.vRegisterHintTransform
|
|
240
|
-
];
|
|
241
|
-
}
|
|
242
|
-
aliasTarget = detectZodMajor.resolveZodAliasTarget(
|
|
243
|
-
resolved.root,
|
|
244
|
-
"attaform/vite",
|
|
245
|
-
resolveZodAlias,
|
|
246
|
-
warnState
|
|
247
|
-
);
|
|
248
|
-
},
|
|
249
|
-
configureServer(server) {
|
|
250
|
-
server.middlewares.use(
|
|
251
|
-
"/_attaform_devtools",
|
|
252
|
-
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
253
|
-
async (req, res, next) => {
|
|
254
|
-
if (req.method !== "GET") {
|
|
255
|
-
next();
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
if (req.url === "/icon.svg") {
|
|
259
|
-
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>`;
|
|
260
|
-
res.setHeader("Content-Type", "image/svg+xml; charset=utf-8");
|
|
261
|
-
res.setHeader("Cache-Control", "public, max-age=3600");
|
|
262
|
-
res.end(svg);
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
try {
|
|
266
|
-
const rawHtml = `<!DOCTYPE html>
|
|
267
|
-
<html lang="en">
|
|
268
|
-
<head>
|
|
269
|
-
<meta charset="UTF-8" />
|
|
270
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
271
|
-
<title>Attaform DevTools</title>
|
|
272
|
-
<style>
|
|
273
|
-
html, body { height: 100%; margin: 0; background: #0f172a; }
|
|
274
|
-
@media (prefers-color-scheme: light) {
|
|
275
|
-
html, body { background: #ffffff; }
|
|
276
|
-
}
|
|
277
|
-
#atf-loading {
|
|
278
|
-
padding: 1rem;
|
|
279
|
-
color: #94a3b8;
|
|
280
|
-
font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
|
|
281
|
-
font-size: 13px;
|
|
282
|
-
}
|
|
283
|
-
</style>
|
|
284
|
-
</head>
|
|
285
|
-
<body>
|
|
286
|
-
<div id="atf-app"><div id="atf-loading">Loading Attaform DevTools\u2026</div></div>
|
|
287
|
-
<script type="module">
|
|
288
|
-
import { createApp, h } from 'vue'
|
|
289
|
-
import AttaformDevtoolsPanel from 'attaform/devtools-panel'
|
|
290
|
-
|
|
291
|
-
// The panel runs inside Nuxt DevTools' overlay iframe, which itself
|
|
292
|
-
// is nested in the consumer's main page. \`window.parent\` only
|
|
293
|
-
// crosses one frame boundary \u2014 the overlay UI \u2014 which doesn't have
|
|
294
|
-
// the bridge attached. The bridge lives on the consumer's main
|
|
295
|
-
// page, which sits at the top of the frame hierarchy. Walk the
|
|
296
|
-
// chain checking each ancestor frame so the same code works whether
|
|
297
|
-
// the panel is opened in 0, 1, or 2+ iframe layers deep.
|
|
298
|
-
//
|
|
299
|
-
// Same-origin assumption holds (everything served from the dev
|
|
300
|
-
// server's origin) so cross-frame property access doesn't throw.
|
|
301
|
-
// If a future Nuxt DevTools build sandboxes the overlay iframe,
|
|
302
|
-
// the try/catch falls through to the empty-bridge path with a
|
|
303
|
-
// clear "not found" message.
|
|
304
|
-
function findBridge() {
|
|
305
|
-
let frame = window
|
|
306
|
-
for (let depth = 0; depth < 10; depth++) {
|
|
307
|
-
try {
|
|
308
|
-
const candidate = frame.__attaform_devtools__
|
|
309
|
-
if (candidate !== undefined) return candidate
|
|
310
|
-
} catch {
|
|
311
|
-
return undefined
|
|
312
|
-
}
|
|
313
|
-
if (frame.parent === frame) return undefined
|
|
314
|
-
frame = frame.parent
|
|
315
|
-
}
|
|
316
|
-
return undefined
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
const start = Date.now()
|
|
320
|
-
function bootstrap() {
|
|
321
|
-
const bridge = findBridge()
|
|
322
|
-
if (bridge !== undefined) {
|
|
323
|
-
const root = document.getElementById('atf-app')
|
|
324
|
-
root.innerHTML = ''
|
|
325
|
-
createApp({ render: () => h(AttaformDevtoolsPanel, { bridge }) }).mount(root)
|
|
326
|
-
return
|
|
327
|
-
}
|
|
328
|
-
if (Date.now() - start < 2000) {
|
|
329
|
-
setTimeout(bootstrap, 50)
|
|
330
|
-
return
|
|
331
|
-
}
|
|
332
|
-
document.getElementById('atf-loading').textContent =
|
|
333
|
-
'Attaform devtools bridge not found. The host app may not have the Nuxt module installed.'
|
|
334
|
-
}
|
|
335
|
-
bootstrap()
|
|
336
|
-
<\/script>
|
|
337
|
-
</body>
|
|
338
|
-
</html>`;
|
|
339
|
-
const html = await server.transformIndexHtml("/_attaform_devtools", rawHtml);
|
|
340
|
-
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
341
|
-
res.end(html);
|
|
342
|
-
} catch (err) {
|
|
343
|
-
next(err);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
);
|
|
347
|
-
},
|
|
348
|
-
async resolveId(source, importer) {
|
|
349
|
-
if (!resolveZodAlias) return null;
|
|
350
|
-
if (aliasTarget === null) return null;
|
|
351
|
-
if (!detectZodMajor.isRewritableZodSpecifier(source)) return null;
|
|
352
|
-
return this.resolve(aliasTarget, importer, { skipSelf: true });
|
|
353
|
-
},
|
|
354
|
-
transform(code, id) {
|
|
355
|
-
return transformSsrAccessed(code, id);
|
|
356
|
-
}
|
|
357
|
-
};
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
exports.attaform = attaform;
|
|
361
|
-
exports.attaformAutoImports = attaformAutoImports;
|
|
362
|
-
exports.attaformAutoImportsMap = attaformAutoImportsMap;
|
|
363
|
-
//# sourceMappingURL=vite.cjs.map
|