what-core 0.12.0 → 0.12.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/dist/index.min.js +1 -1
- package/package.json +1 -1
- package/src/agent-context.js +1 -1
package/dist/index.min.js
CHANGED
|
@@ -122,4 +122,4 @@ redirect(ALLOWED.has(query.next) ? query.next : '/');`},REDIRECT_NOT_CAUGHT:{cod
|
|
|
122
122
|
try { html = renderToString(<App />); }
|
|
123
123
|
catch (e) { if (e.name === 'RouterRedirect') return Response.redirect(e.to, 302); throw e; }`}},ie=class extends Error{constructor({code:t,message:n,suggestion:r,file:o,line:s,component:i,signal:a,effect:u}){super(n),this.name="WhatError",this.code=t,this.suggestion=r,this.file=o,this.line=s,this.component=i,this.signal=a,this.effect=u}toJSON(){return{code:this.code,message:this.message,suggestion:this.suggestion,file:this.file,line:this.line,component:this.component,signal:this.signal,effect:this.effect}}};function oe(e,t={}){let n=typeof e=="string"?nt[e]:e;if(!n)return new ie({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 ie({code:n.code,message:r,suggestion:n.suggestion,file:t.file,line:t.line,component:t.component,signal:t.signal||t.signalName,effect:t.effect||t.effectName})}var re=[],tt=200;function we(e){F&&(re.push({...e.toJSON(),timestamp:Date.now()}),re.length>tt&&(re=re.slice(-tt)))}function be(e){return e?re.filter(t=>t.timestamp>e):re.slice()}function $r(){re=[]}function Hr(e,t={}){let n=e?.message||String(e);return n.includes("infinite effect loop")||n.includes("25 iterations")?oe("INFINITE_EFFECT",t):n.includes("hydration")||n.includes("Hydration")?oe("HYDRATION_MISMATCH",t):n.includes("Signal.set() called inside a computed")?oe("SIGNAL_WRITE_IN_RENDER",{...t,signalName:n.match(/signal: (\w+)/)?.[1]||t.signalName}):new ie({code:"ERR_RUNTIME",message:n,suggestion:"Check the stack trace and component context for more details.",...t})}var he={signalReadDetection:!0,componentNaming:!0,importValidation:!0};function Vr(e){Object.assign(he,e)}function jr(){return{...he}}function Gr(e,t){return!F||!he.signalReadDetection||(e.toString=function(){let n=oe("MISSING_SIGNAL_READ",{signalName:t||"(unnamed)"});return console.warn(`[what] ${n.message}
|
|
124
124
|
Suggestion: ${n.suggestion}`),we(n),String(e())},e.valueOf=function(){let n=oe("MISSING_SIGNAL_READ",{signalName:t||"(unnamed)"});return console.warn(`[what] ${n.message}
|
|
125
|
-
Suggestion: ${n.suggestion}`),we(n),e()}),e}function qr(e){if(!F||!he.componentNaming||!e||/^[A-Z]/.test(e))return null;let t=`Component "${e}" should use PascalCase (e.g., "${Br(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 Br(e){return e.charAt(0).toUpperCase()+e.slice(1)}var rt=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 Wr(e){if(!F||!he.importValidation)return[];let t=[];for(let n of e)rt.has(n)||t.push({name:n,message:`"${n}" is not a valid export from what-framework.`,suggestion:`Check the API reference. Did you mean: ${Yr(n)}?`});return t}function Yr(e){let t=e.toLowerCase(),n=null,r=1/0;for(let o of rt){let s=Xr(t,o.toLowerCase());s<r&&(r=s,n=o)}return r<=3?n:"(no close match found)"}function Xr(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 Qr="0.12.
|
|
125
|
+
Suggestion: ${n.suggestion}`),we(n),e()}),e}function qr(e){if(!F||!he.componentNaming||!e||/^[A-Z]/.test(e))return null;let t=`Component "${e}" should use PascalCase (e.g., "${Br(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 Br(e){return e.charAt(0).toUpperCase()+e.slice(1)}var rt=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 Wr(e){if(!F||!he.importValidation)return[];let t=[];for(let n of e)rt.has(n)||t.push({name:n,message:`"${n}" is not a valid export from what-framework.`,suggestion:`Check the API reference. Did you mean: ${Yr(n)}?`});return t}function Yr(e){let t=e.toLowerCase(),n=null,r=1/0;for(let o of rt){let s=Xr(t,o.toLowerCase());s<r&&(r=s,n=o)}return r<=3?n:"(no close match found)"}function Xr(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 Qr="0.12.1",ge=[];function zr(e){F&&ge.push(e)}function Ur(e){if(!F)return;let t=ge.indexOf(e);t>=0&&ge.splice(t,1)}function ot(){return ge.slice()}var ae=[];function Kr(e){F&&ae.push(e)}function Jr(e){if(!F)return;let t=ae.indexOf(e);t>=0&&ae.splice(t,1)}function st(){return ae.slice()}function it(){let e=be(),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=ae.filter(u=>!!(u._subs&&u._subs.size===0)).length,i=ae.length,a=i>1e4?"high":i>1e3?"medium":"low";return{effectCycleRisk:r,orphanEffects:o.length,signalLeaks:s,memoryPressure:a,recentErrorCount:t.length,totalSignals:i,totalComponents:ge.length}}function Zr(){F&&(typeof globalThis>"u"||(globalThis.__WHAT_AGENT__={framework:"what-framework",version:Qr,mode:"development",features:["signals","effects","computed","ssr","islands","router","stores","forms","animations","a11y"],components:()=>ot().map(e=>({id:e.id,name:e.name||e.displayName||e.constructor?.name})),signals:()=>st().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:()=>be(),health:()=>it(),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{Nr as Checkbox,nt as ERROR_CODES,Et as ErrorBoundary,Pr as ErrorMessage,Wt as FocusTrap,_t as For,mt as Fragment,Hn as Head,Lr as Input,Tt as Island,cr as IslandSkeleton,sn as Keys,en as LiveRegion,fr as LoadingDots,At as Match,lr as Placeholder,Pt as Portal,Or as Radio,Fr as Select,Ct as Show,Me as Skeleton,ir as SkeletonAvatar,Ue as SkeletonCard,ar as SkeletonTable,Le as SkeletonText,Qt as SkipLink,dr as Spinner,St as Suspense,Rt as Switch,Dr as Textarea,Zt as VisuallyHidden,ie as WhatError,ln as _$createComponent,fn as _$template,gt as __drainPreinstallBuffer,Cr as __getCacheSnapshot,xt as __installServerContextStorage,Ee as __readHydrationData,kn as __resetHydrationData,ct as __setDevToolsHooks,Vt as _isAriaAttr,un as _setTextInsertHook,De as _template,Yt as announce,Xt as announceAssertive,$n as atom,M as batch,Gn as beginHeadCollection,qr as checkComponentName,vn as classList,Hr as classifyError,Er as clearCache,$r as clearCollectedErrors,Xn as clearHead,Mt as cls,we as collectError,O as computed,Vr as configureGuardrails,Mn as createContext,Nn as createResource,pt as createRoot,Pn as createStore,Qe as createTransitionClasses,oe as createWhatError,or as cssTransition,Dt as debounce,yn as delegateEvents,Pe as derived,It as each,Xe as easings,$ as effect,qn as endHeadCollection,je as flushScheduler,lt as flushSync,st as getActiveSignals,be as getCollectedErrors,jr as getGuardrailConfig,it as getHealth,Ce as getLoaderData,ot as getMountedComponents,ft as getOwner,Sr as getQueryData,_e as getResource,se as getServerContext,C as h,yt as html,bn as hydrate,pn as insert,Zr as installAgentContext,Gr as installSignalReadGuardrail,wr as invalidateQueries,wn as isHydrating,kt as lazy,hn as mapArray,Qn as measure,bt as memo,jt as mount,zn as mutate,Kn as nextFrame,xn as on,Fn as onCleanup,Zn as onIntersect,an as onKey,cn as onKeys,Dn as onMount,Jn as onResize,ht as onRootCleanup,br as prefetchQuery,qe as raf,zr as registerComponent,Kr as registerSignal,Ir as rules,dt as runWithOwner,wt as runWithServerContext,W as scheduleRead,U as scheduleWrite,mn as setProp,kr as setQueryData,vt as setServerContext,f as signal,ut as signalMemo,Tr as simpleResolver,er as smoothScrollTo,gn as spread,We as spring,On as storeComputed,Lt as style,dn as svgTemplate,De as template,Ft as throttle,Ht as transition,Ye as tween,Ur as unregisterComponent,Jr as unregisterSignal,ue as untrack,rr as useAnimatedValue,Kt as useAriaChecked,zt as useAriaExpanded,Ut as useAriaSelected,Tn as useCallback,$t as useClickOutside,_n as useComputed,Fe as useContext,rn as useDescribedBy,Rn as useEffect,gr as useFetch,Mr as useField,Gt as useFocus,qt as useFocusRestore,Bt as useFocusTrap,_r as useForm,nr as useGesture,tn as useId,nn as useIds,xr as useInfiniteQuery,on as useLabelledBy,Sn as useLoaderData,Ot as useLocalStorage,Nt as useMediaQuery,An as useMemo,yr as useQuery,Ln as useReducer,In as useRef,Jt as useRovingTabIndex,mr as useSWR,Un as useScheduledEffect,Cn as useSignal,ur as useSkeleton,En as useState,tr as useTransition,Wr as validateImports,Ar as yupResolver,Rr 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.12.
|
|
11
|
+
const VERSION = '0.12.1';
|
|
12
12
|
|
|
13
13
|
// --- Component Registry ---
|
|
14
14
|
// Tracks mounted components for agent inspection.
|