what-core 0.13.2 → 0.13.4
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/index.min.js +1 -1
- package/package.json +1 -1
- package/src/agent-context.js +1 -1
package/dist/index.min.js
CHANGED
|
@@ -206,4 +206,4 @@ createWhatError('MISSING_KEYS');
|
|
|
206
206
|
createWhatError('MISSING_KEY', { component: 'TodoList' });`},UNKNOWN_TOOL:{code:"ERR_UNKNOWN_TOOL",severity:"error",template:"Unknown tool: {{name}}.",suggestion:"The MCP client called a tool this server does not expose. Call tools/list to enumerate what is available; a stale client cache is the usual cause.",codeExample:`// List what the server actually exposes:
|
|
207
207
|
{ "method": "tools/list" }`}},Xe=null;function _t(e){return Xe===null&&(Xe=new Map(Object.values(ze).map(t=>[t.code,t]))),Xe.get(e)}var pe=class extends Error{constructor({code:t,message:n,suggestion:r,codeExample:o,file:s,line:a,component:c,signal:u,effect:p}){super(n),this.name="WhatError",this.code=t,this.suggestion=r,this.codeExample=o,this.file=s,this.line=a,this.component=c,this.signal=u,this.effect=p}toJSON(){return{code:this.code,message:this.message,suggestion:this.suggestion,codeExample:this.codeExample,file:this.file,line:this.line,component:this.component,signal:this.signal,effect:this.effect}}};function fe(e,t={}){let n=typeof e=="string"?ze[e]:e;if(!n)return new pe({code:"ERR_UNKNOWN",message:`Unknown error: ${e}`,suggestion:"Check the error code and try again."});let r=n.template;for(let[o,s]of Object.entries(t))r=r.replace(new RegExp(`\\{\\{${o}\\}\\}`,"g"),String(s));return r=r.replace(/\{\{[^}]+\}\}/g,"(unknown)"),new pe({code:n.code,message:r,suggestion:n.suggestion,codeExample:n.codeExample,file:t.file,line:t.line,component:t.component,signal:t.signal||t.signalName,effect:t.effect||t.effectName})}var de=[],bt=200;function Ae(e){L&&(de.push({...e.toJSON(),timestamp:Date.now()}),de.length>bt&&(de=de.slice(-bt)))}function Ie(e){return e?de.filter(t=>t.timestamp>e):de.slice()}function po(){de=[]}function ho(e,t={}){let n=e?.message||String(e);if(e&&typeof e.code=="string"){let r=_t(e.code);if(r)return new pe({code:r.code,message:n,suggestion:r.suggestion,codeExample:r.codeExample,file:t.file,line:t.line,component:t.component,signal:t.signal||t.signalName,effect:t.effect||t.effectName})}return n.includes("infinite effect loop")||n.includes("25 iterations")?fe("INFINITE_EFFECT",t):n.includes("hydration")||n.includes("Hydration")?fe("HYDRATION_MISMATCH",t):n.includes("Signal.set() called inside a computed")?fe("SIGNAL_WRITE_IN_RENDER",{...t,signalName:n.match(/signal: (\w+)/)?.[1]||t.signalName}):new pe({code:"ERR_RUNTIME",message:n,suggestion:"Check the stack trace and component context for more details.",...t})}var be={signalReadDetection:!0,componentNaming:!0,importValidation:!0};function go(e){Object.assign(be,e)}function mo(){return{...be}}function yo(e,t){return!L||!be.signalReadDetection||(e.toString=function(){let n=fe("MISSING_SIGNAL_READ",{signalName:t||"(unnamed)"});return console.warn(`[what] ${n.message}
|
|
208
208
|
Suggestion: ${n.suggestion}`),Ae(n),String(e())},e.valueOf=function(){let n=fe("MISSING_SIGNAL_READ",{signalName:t||"(unnamed)"});return console.warn(`[what] ${n.message}
|
|
209
|
-
Suggestion: ${n.suggestion}`),Ae(n),e()}),e}function vo(e){if(!L||!be.componentNaming||!e||/^[A-Z]/.test(e))return null;let t=`Component "${e}" should use PascalCase (e.g., "${wo(e)}"). PascalCase distinguishes components from HTML elements in JSX and is required by the What Framework compiler.`;return console.warn(`[what] ${t}`),{code:"WARN_COMPONENT_NAMING",name:e,suggestion:t}}function wo(e){return e.charAt(0).toUpperCase()+e.slice(1)}var St=new Set(["signal","computed","effect","signalMemo","batch","untrack","flushSync","createRoot","getOwner","runWithOwner","onRootCleanup","__setDevToolsHooks","template","_template","svgTemplate","insert","mapArray","spread","setProp","delegateEvents","on","classList","hydrate","isHydrating","_$createComponent","h","Fragment","html","mount","useState","useSignal","useComputed","useEffect","useMemo","useCallback","useRef","useContext","useReducer","createContext","onMount","onCleanup","createResource","memo","lazy","Suspense","ErrorBoundary","Show","For","Switch","Match","Island","createStore","derived","storeComputed","atom","Head","clearHead","each","cls","style","debounce","throttle","useMediaQuery","useLocalStorage","useClickOutside","Portal","transition","scheduleRead","scheduleWrite","flushScheduler","measure","mutate","useScheduledEffect","nextFrame","raf","onResize","onIntersect","smoothScrollTo","_setTextInsertHook","spring","tween","easings","useTransition","useGesture","useAnimatedValue","createTransitionClasses","cssTransition","useFocus","useFocusRestore","useFocusTrap","FocusTrap","announce","announceAssertive","SkipLink","useAriaExpanded","useAriaSelected","useAriaChecked","useRovingTabIndex","VisuallyHidden","LiveRegion","useId","useIds","useDescribedBy","useLabelledBy","Keys","onKey","onKeys","Skeleton","SkeletonText","SkeletonAvatar","SkeletonCard","SkeletonTable","IslandSkeleton","useSkeleton","Placeholder","LoadingDots","Spinner","useFetch","useSWR","useQuery","useInfiniteQuery","invalidateQueries","prefetchQuery","setQueryData","getQueryData","clearCache","__getCacheSnapshot","useForm","useField","rules","simpleResolver","zodResolver","yupResolver","Input","Textarea","Select","Checkbox","Radio","ErrorMessage"]);function xo(e){if(!L||!be.importValidation)return[];let t=[];for(let n of e)St.has(n)||t.push({name:n,message:`"${n}" is not a valid export from what-framework.`,suggestion:`Check the API reference. Did you mean: ${Eo(n)}?`});return t}function Eo(e){let t=e.toLowerCase(),n=null,r=1/0;for(let o of St){let s=bo(t,o.toLowerCase());s<r&&(r=s,n=o)}return r<=3?n:"(no close match found)"}function bo(e,t){if(e.length===0)return t.length;if(t.length===0)return e.length;let n=[];for(let r=0;r<=t.length;r++)n[r]=[r];for(let r=0;r<=e.length;r++)n[0][r]=r;for(let r=1;r<=t.length;r++)for(let o=1;o<=e.length;o++){let s=t[r-1]===e[o-1]?0:1;n[r][o]=Math.min(n[r-1][o]+1,n[r][o-1]+1,n[r-1][o-1]+s)}return n[t.length][e.length]}var _o="0.13.
|
|
209
|
+
Suggestion: ${n.suggestion}`),Ae(n),e()}),e}function vo(e){if(!L||!be.componentNaming||!e||/^[A-Z]/.test(e))return null;let t=`Component "${e}" should use PascalCase (e.g., "${wo(e)}"). PascalCase distinguishes components from HTML elements in JSX and is required by the What Framework compiler.`;return console.warn(`[what] ${t}`),{code:"WARN_COMPONENT_NAMING",name:e,suggestion:t}}function wo(e){return e.charAt(0).toUpperCase()+e.slice(1)}var St=new Set(["signal","computed","effect","signalMemo","batch","untrack","flushSync","createRoot","getOwner","runWithOwner","onRootCleanup","__setDevToolsHooks","template","_template","svgTemplate","insert","mapArray","spread","setProp","delegateEvents","on","classList","hydrate","isHydrating","_$createComponent","h","Fragment","html","mount","useState","useSignal","useComputed","useEffect","useMemo","useCallback","useRef","useContext","useReducer","createContext","onMount","onCleanup","createResource","memo","lazy","Suspense","ErrorBoundary","Show","For","Switch","Match","Island","createStore","derived","storeComputed","atom","Head","clearHead","each","cls","style","debounce","throttle","useMediaQuery","useLocalStorage","useClickOutside","Portal","transition","scheduleRead","scheduleWrite","flushScheduler","measure","mutate","useScheduledEffect","nextFrame","raf","onResize","onIntersect","smoothScrollTo","_setTextInsertHook","spring","tween","easings","useTransition","useGesture","useAnimatedValue","createTransitionClasses","cssTransition","useFocus","useFocusRestore","useFocusTrap","FocusTrap","announce","announceAssertive","SkipLink","useAriaExpanded","useAriaSelected","useAriaChecked","useRovingTabIndex","VisuallyHidden","LiveRegion","useId","useIds","useDescribedBy","useLabelledBy","Keys","onKey","onKeys","Skeleton","SkeletonText","SkeletonAvatar","SkeletonCard","SkeletonTable","IslandSkeleton","useSkeleton","Placeholder","LoadingDots","Spinner","useFetch","useSWR","useQuery","useInfiniteQuery","invalidateQueries","prefetchQuery","setQueryData","getQueryData","clearCache","__getCacheSnapshot","useForm","useField","rules","simpleResolver","zodResolver","yupResolver","Input","Textarea","Select","Checkbox","Radio","ErrorMessage"]);function xo(e){if(!L||!be.importValidation)return[];let t=[];for(let n of e)St.has(n)||t.push({name:n,message:`"${n}" is not a valid export from what-framework.`,suggestion:`Check the API reference. Did you mean: ${Eo(n)}?`});return t}function Eo(e){let t=e.toLowerCase(),n=null,r=1/0;for(let o of St){let s=bo(t,o.toLowerCase());s<r&&(r=s,n=o)}return r<=3?n:"(no close match found)"}function bo(e,t){if(e.length===0)return t.length;if(t.length===0)return e.length;let n=[];for(let r=0;r<=t.length;r++)n[r]=[r];for(let r=0;r<=e.length;r++)n[0][r]=r;for(let r=1;r<=t.length;r++)for(let o=1;o<=e.length;o++){let s=t[r-1]===e[o-1]?0:1;n[r][o]=Math.min(n[r-1][o]+1,n[r][o-1]+1,n[r-1][o-1]+s)}return n[t.length][e.length]}var _o="0.13.4",_e=[];function So(e){L&&_e.push(e)}function ko(e){if(!L)return;let t=_e.indexOf(e);t>=0&&_e.splice(t,1)}function kt(){return _e.slice()}var ve=[];function Ro(e){L&&ve.push(e)}function Co(e){if(!L)return;let t=ve.indexOf(e);t>=0&&ve.splice(t,1)}function Rt(){return ve.slice()}function Ct(){let e=Ie(),t=e.filter(u=>Date.now()-u.timestamp<6e4),r=e.filter(u=>u.code==="ERR_INFINITE_EFFECT").length>0,o=e.filter(u=>u.code==="ERR_ORPHAN_EFFECT"),s=ve.filter(u=>!!(u._subs&&u._subs.size===0)).length,a=ve.length,c=a>1e4?"high":a>1e3?"medium":"low";return{effectCycleRisk:r,orphanEffects:o.length,signalLeaks:s,memoryPressure:c,recentErrorCount:t.length,totalSignals:a,totalComponents:_e.length}}function Ao(){L&&(typeof globalThis>"u"||(globalThis.__WHAT_AGENT__={framework:"what-framework",version:_o,mode:"development",features:["signals","effects","computed","ssr","islands","router","stores","forms","animations","a11y"],components:()=>kt().map(e=>({id:e.id,name:e.name||e.displayName||e.constructor?.name})),signals:()=>Rt().map((e,t)=>({id:t,name:e._debugName||`signal_${t}`,value:typeof e=="function"?e.peek?.():void 0,subscriberCount:e._subs?e._subs.size:0})),errors:()=>Ie(),health:()=>Ct(),api:{reactive:["signal","computed","effect","batch","untrack","flushSync","createRoot","memo"],hooks:["useState","useSignal","useComputed","useEffect","useMemo","useCallback","useRef","useContext","onMount","onCleanup"],components:["Show","For","Switch","Match","Suspense","ErrorBoundary","lazy","Island"],data:["useSWR","useQuery","useFetch","useInfiniteQuery"],store:["createStore","derived","atom"]}}))}export{lo as Checkbox,ze as ERROR_CODES,qt as ErrorBoundary,fo as ErrorMessage,hn as FocusTrap,Wt as For,Ft as Fragment,cr as Head,ao as Input,zt as Island,Nr as IslandSkeleton,An as Keys,_n as LiveRegion,Lr as LoadingDots,Xt as Match,Or as Placeholder,rn as Portal,uo as Radio,co as Select,Bt as Show,$e as Skeleton,Ir as SkeletonAvatar,ht as SkeletonCard,Tr as SkeletonTable,Ue as SkeletonText,yn as SkipLink,Mr as Spinner,jt as Suspense,Yt as Switch,io as Textarea,bn as VisuallyHidden,pe as WhatError,Dn as _$createComponent,On as _$template,Mt as __drainPreinstallBuffer,Xr as __getCacheSnapshot,Ht as __installServerContextStorage,Oe as __readHydrationData,Bn as __resetHydrationData,At as __setDevToolsHooks,ln as _beginComponentSSR,un as _endComponentSSR,an as _isAriaAttr,Pn as _mapArrayToArray,Nn as _setTextInsertHook,Je as _template,gn as announce,mn as announceAssertive,ir as atom,O as batch,dr as beginHeadCollection,vo as checkComponentName,Un as classList,ho as classifyError,Yr as clearCache,po as clearCollectedErrors,mr as clearHead,Kt as cls,Ae as collectError,P as computed,go as configureGuardrails,er as createContext,or as createResource,Ot as createRoot,ar as createStore,ft as createTransitionClasses,fe as createWhatError,Cr as cssTransition,Zt as debounce,Vn as delegateEvents,nt as derived,Qt as each,dt as easings,V as effect,fr as endHeadCollection,at as flushScheduler,Tt as flushSync,Rt as getActiveSignals,Ie as getCollectedErrors,_t as getErrorDefinition,mo as getGuardrailConfig,Ct as getHealth,Le as getLoaderData,kt as getMountedComponents,Nt as getOwner,Wr as getQueryData,Me as getResource,ge as getServerContext,N as h,Pt as html,qn as hydrate,Mn as insert,Ao as installAgentContext,yo as installSignalReadGuardrail,jr as invalidateQueries,jn as isHydrating,Ut as lazy,Fn as mapArray,yr as measure,$t as memo,cn as mount,vr as mutate,xr as nextFrame,$n as on,rr as onCleanup,br as onIntersect,In as onKey,Tn as onKeys,nr as onMount,Er as onResize,Lt as onRootCleanup,qr as prefetchQuery,it as raf,So as registerComponent,Ro as registerSignal,oo as rules,Dt as runWithOwner,Vt as runWithServerContext,Z as scheduleRead,se as scheduleWrite,Gn as setProp,Br as setQueryData,Gt as setServerContext,d as signal,It as signalMemo,ro as simpleResolver,_r as smoothScrollTo,Hn as spread,lt as spring,sr as storeComputed,Jt as style,Ln as svgTemplate,Je as template,en as throttle,sn as transition,ut as tween,ko as unregisterComponent,Co as unregisterSignal,ce as untrack,Rr as useAnimatedValue,xn as useAriaChecked,vn as useAriaExpanded,wn as useAriaSelected,Jn as useCallback,on as useClickOutside,zn as useComputed,Ze as useContext,Rn as useDescribedBy,Qn as useEffect,Gr as useFetch,so as useField,dn as useFocus,fn as useFocusRestore,pn as useFocusTrap,Kr as useForm,kr as useGesture,Sn as useId,kn as useIds,Ur as useInfiniteQuery,Cn as useLabelledBy,Wn as useLoaderData,nn as useLocalStorage,tn as useMediaQuery,Kn as useMemo,$r as useQuery,tr as useReducer,Zn as useRef,En as useRovingTabIndex,Vr as useSWR,wr as useScheduledEffect,Xn as useSignal,Dr as useSkeleton,Yn as useState,Sr as useTransition,xo as validateImports,no as yupResolver,eo as zodResolver};
|
package/package.json
CHANGED
package/src/agent-context.js
CHANGED
|
@@ -8,7 +8,7 @@ import { getCollectedErrors } from './errors.js';
|
|
|
8
8
|
// --- Version ---
|
|
9
9
|
// Keep in sync with packages/core/package.json (checked by
|
|
10
10
|
// core/test/guardrails.test.js so it can't silently go stale again).
|
|
11
|
-
const VERSION = '0.13.
|
|
11
|
+
const VERSION = '0.13.4';
|
|
12
12
|
|
|
13
13
|
// --- Component Registry ---
|
|
14
14
|
// Tracks mounted components for agent inspection.
|