@metagptx/web-sdk 0.0.51 → 0.0.52-beta.11

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.d.ts CHANGED
@@ -125,4 +125,24 @@ type IntegrationFunction = (params?: IntegrationParams) => Promise<AnyType>;
125
125
  */
126
126
  declare function vitePlugin404(): Plugin;
127
127
  //#endregion
128
- export { type AnyType, type ApiCallParams, type ClientConfig, type IntegrationFunction, type IntegrationParams, type RequestConfig, createClient, vitePlugin404 };
128
+ //#region src/plugins/vite-plugin-routes.d.ts
129
+ interface PluginOptions {
130
+ /** 路由文件路径,默认 'src/App.tsx' */
131
+ routeFile?: string;
132
+ /** 入口文件路径,用于自动注入,默认 'src/main.tsx' */
133
+ entryFile?: string;
134
+ /** 虚拟模块 ID */
135
+ moduleId?: string;
136
+ /** 是否自动向父级 iframe 发送路由信息,默认 true */
137
+ notifyParent?: boolean;
138
+ /** 发送给父级的消息类型标识 */
139
+ messageType?: string;
140
+ /** 要排除的路由路径模式 */
141
+ excludePaths?: string[];
142
+ }
143
+ /**
144
+ * Vite 插件:解析 React Router 的 Route 组件,生成路由信息
145
+ */
146
+ declare function vitePluginRoutes(options?: PluginOptions): Plugin;
147
+ //#endregion
148
+ export { type AnyType, type ApiCallParams, type ClientConfig, type IntegrationFunction, type IntegrationParams, type RequestConfig, createClient, vitePlugin404, vitePluginRoutes };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import e from"axios";import t from"qs";const n=e=>{let t=e.response?.status;if(t&&t>=400&&t!==401)try{typeof window<`u`&&window.top&&window.top?.postMessage({type:`mgx-appview-error`,targetName:window.name,data:{errMsg:e.response?.data?.message||e.response?.data?.detail||`Server Error`,stack:JSON.stringify({url:e.response?.config?.url,data:e.response?.data,status:e.response?.status})}},`*`)}catch(e){console.warn(`Failed to notify parent window about API error:`,e)}},r=(r={})=>{let{onUnauthorized:i,...a}=r,o=typeof globalThis<`u`&&`localStorage`in globalThis&&typeof globalThis.localStorage?.getItem==`function`?globalThis.localStorage.getItem(`token`)??void 0:void 0,s={timeout:6e4,paramsSerializer:e=>t.stringify(e,{arrayFormat:`brackets`}),...a,headers:{"Content-Type":`application/json`,"App-Host":globalThis?.window?.location?.origin??``,...o?{Authorization:`Bearer ${o}`}:{},...a.headers}},c=e.create(s);return c.interceptors.request.use(e=>e,e=>Promise.reject(e)),c.interceptors.response.use(e=>e,e=>{let t=e.response?.status;return t===401&&i&&i(),n(e),Promise.reject(e)}),c},i=[`stripe.com`],a=e=>typeof e==`string`?e.startsWith(`_`)||e.startsWith(`$`)||e===`constructor`||e===`toString`||e===`valueOf`||e===`inspect`||e===`toJSON`:!0,o=()=>{let e=window.location?.href??``,t=``;e.startsWith(`/`)?t=e:e&&(t=e.replace(/^[a-z][a-z0-9+.-]*:\/\/[^/]+/i,``));let n=new URLSearchParams({from_url:t});window.location.href=`/api/v1/auth/login?${n.toString()}`},s=()=>globalThis?.window?.name?.includes(`devIframe`),c=e=>e?i.some(t=>e.toString().includes(t)):!1,l=e=>{let{requestInstance:t}=e;return{async login(){let e=new URLSearchParams(window.location.search),t=e.get(`token`);return t&&typeof globalThis<`u`&&`localStorage`in globalThis&&(globalThis.localStorage?.setItem(`token`,t),window.location.href=`/`),t},async me(){return t.get(`/api/v1/auth/me`)},async logout(){typeof globalThis<`u`&&`localStorage`in globalThis&&globalThis.localStorage?.removeItem(`token`);let e=await t.get(`/api/v1/auth/logout`);return typeof globalThis<`u`&&`window`in globalThis&&(globalThis.window.opener=null),window.location.href=`/`,e},toLogin:o}},u=e=>{let{requestInstance:t,entityName:n}=e,r=`/api/v1/entities/${n}`,i=e=>{if(!e)return;let t={...e};return e.fields&&Array.isArray(e.fields)&&(t.fields=e.fields.join(`,`)),e.query&&typeof e.query==`object`&&(t.query=JSON.stringify(e.query)),t};return{async query(e){let n=i(e);return t.get(r,{params:n})},async queryAll(e){let n=i(e);return t.get(`${r}/all`,{params:n})},async get(e){let{id:n,...a}=e,o=i(a);return t.get(`${r}/${n}`,{params:o})},async create(e){return t.post(r,e.data)},async update(e){return t.put(`${r}/${e.id}`,e.data)},async delete(e){return t.delete(`${r}/${e.id}`)},async deleteBatch(e){return t.delete(`${r}/batch`,{data:{ids:e.ids}})},async createBatch(e){return t.post(`${r}/batch`,e.data)},async updateBatch(e){return t.put(`${r}/batch`,e.data)}}},d=e=>{let{requestInstance:t}=e,n=new Map;return new Proxy({},{get(e,r){if(!a(r))return n.has(r)||n.set(r,u({requestInstance:t,entityName:r})),n.get(r)}})},f=e=>{let{requestInstance:t}=e;return{async invoke(e){let{url:n,method:r=`GET`,data:i,options:a={}}=e;if(typeof window<`u`&&a?.responseType===`stream`){let e;try{typeof globalThis<`u`&&`localStorage`in globalThis&&typeof globalThis.localStorage?.getItem==`function`&&(e=globalThis.localStorage.getItem(`token`)??void 0)}catch{}let t={"Content-Type":`application/json`,"App-Host":globalThis?.window?.location?.origin??``,...e?{Authorization:`Bearer ${e}`}:{},...a.headers||{}},o;i&&[`POST`,`PUT`,`PATCH`].includes(r.toUpperCase())&&(o=JSON.stringify(i));let s=await fetch(n,{method:r.toUpperCase(),headers:t,body:o});return s}let o={method:r.toUpperCase(),url:n,...a};return i&&[`POST`,`PUT`,`PATCH`].includes(o.method)?o.data=i:i&&[`GET`,`DELETE`].includes(o.method)&&(o.params=i),t.request(o)}}},p=e=>{let{requestInstance:t}=e;return new Proxy({},{get(e,n){if(!a(n))return new Proxy({},{get(e,r){if(!a(r))return(e={})=>{let i=`/api/integrations/core/${r}`;n!==`core`&&(i=`/api/integrations/providers/${n}/${r}`);let{payload:a={},option:o={}}=e,s=a instanceof FormData?{...o,headers:{...o.headers,"Content-Type":void 0}}:o;return t.post(i,a,s)}}})}})};let m=null;const h=e=>{if(m)return;let{requestInstance:t}=e,n=async e=>{let n=globalThis?.localStorage?.getItem(`token`);if(n)return;let r=e.token,i=await t.post(`/api/v1/auth/token/exchange`,{platform_token:r});i.status===200&&i.data.token&&(globalThis?.localStorage?.setItem(`token`,i.data.token),window.location.href=`/`)},r=e=>{switch(e.data.type){case`mgx-token-saved`:n(e.data.data);break;default:break}};m={requestInstance:t,handleMessage:r},globalThis?.window?.addEventListener(`message`,r)},g=()=>{let e=(e,t,n,r)=>{if(globalThis?.window===void 0||!globalThis?.window?.top){console.warn(`postMessage: window.top is not available`);return}try{let{targetOrigin:i=`*`,targetName:a=globalThis?.window?.name??``}=n||{},o={type:e,targetName:a,data:t};(r??globalThis?.window?.top)?.postMessage(o,i)}catch(e){console.warn(`Failed to send postMessage:`,e)}};return{postMessage:e}};let _=!1;const v=e=>{h(e);let{postMessage:t}=g(),n=()=>{if(_)return;_=!0;let e=globalThis?.localStorage?.getItem(`token`);e||(t(`mgx-token-request`,{domain:globalThis?.window?.location?.href??``},{},globalThis?.window?.opener),t(`mgx-token-request`,{domain:globalThis?.window?.location?.href??``}))};return n(),{createPage(e){let n=e??globalThis?.window?.location?.pathname??``;t(`mgx-create-page`,{path:n})}}},y=()=>{let{postMessage:e}=g(),t=t=>{if(t){if(globalThis?.window===void 0){console.warn(`openUrl: window is not available`);return}if(c(t)&&s()){e(`mgx-open-url`,{url:t.toString()},{},globalThis?.window?.opener);return}globalThis.window.location.href=t.toString()}};return{openUrl:t}},b=(e={})=>{let t=r({baseURL:`/`,...e}),n=l({requestInstance:t}),i=d({requestInstance:t}),a=f({requestInstance:t}),o=p({requestInstance:t}),s=v({requestInstance:t}),c=y();return{auth:n,entities:i,apiCall:a,integrations:o,frame:s,utils:c}};function x(){let e=`virtual:404-page`,t=`import { Button } from '@/components/ui/button';
1
+ import e from"axios";import t from"qs";import n from"node:fs";import r from"node:path";import*as i from"@babel/parser";import a from"@babel/traverse";import*as o from"@babel/types";const s=e=>{let t=e.response?.status;if(t&&t>=400&&t!==401)try{typeof window<`u`&&window.top&&window.top?.postMessage({type:`mgx-appview-error`,targetName:window.name,data:{errMsg:e.response?.data?.message||e.response?.data?.detail||`Server Error`,stack:JSON.stringify({url:e.response?.config?.url,data:e.response?.data,status:e.response?.status})}},`*`)}catch(e){console.warn(`Failed to notify parent window about API error:`,e)}},c=(n={})=>{let{onUnauthorized:r,...i}=n,a=typeof globalThis<`u`&&`localStorage`in globalThis&&typeof globalThis.localStorage?.getItem==`function`?globalThis.localStorage.getItem(`token`)??void 0:void 0,o={timeout:6e4,paramsSerializer:e=>t.stringify(e,{arrayFormat:`brackets`}),...i,headers:{"Content-Type":`application/json`,"App-Host":globalThis?.window?.location?.origin??``,...a?{Authorization:`Bearer ${a}`}:{},...i.headers}},c=e.create(o);return c.interceptors.request.use(e=>e,e=>Promise.reject(e)),c.interceptors.response.use(e=>e,e=>{let t=e.response?.status;return t===401&&r&&r(),s(e),Promise.reject(e)}),c},l=[`stripe.com`],u=e=>typeof e==`string`?e.startsWith(`_`)||e.startsWith(`$`)||e===`constructor`||e===`toString`||e===`valueOf`||e===`inspect`||e===`toJSON`:!0,d=()=>{let e=window.location?.href??``,t=``;e.startsWith(`/`)?t=e:e&&(t=e.replace(/^[a-z][a-z0-9+.-]*:\/\/[^/]+/i,``));let n=new URLSearchParams({from_url:t});window.location.href=`/api/v1/auth/login?${n.toString()}`},f=()=>globalThis?.window?.name?.includes(`devIframe`),p=e=>e?l.some(t=>e.toString().includes(t)):!1,m=e=>{let{requestInstance:t}=e;return{async login(){let e=new URLSearchParams(window.location.search),t=e.get(`token`);return t&&typeof globalThis<`u`&&`localStorage`in globalThis&&(globalThis.localStorage?.setItem(`token`,t),globalThis.localStorage?.setItem(`isLougOutManual`,`false`),console.log(`login success----`,globalThis.localStorage?.getItem(`token`),globalThis.localStorage?.getItem(`isLougOutManual`)),window.location.href=`/`),t},async me(){return t.get(`/api/v1/auth/me`)},async logout(){typeof globalThis<`u`&&`localStorage`in globalThis&&(globalThis.localStorage?.removeItem(`token`),globalThis.localStorage?.setItem(`isLougOutManual`,`true`),console.log(`logout success----`,globalThis.localStorage?.getItem(`token`),globalThis.localStorage?.getItem(`isLougOutManual`)));let e=await t.get(`/api/v1/auth/logout`);return typeof globalThis<`u`&&`window`in globalThis&&(globalThis.window.opener=null),window.location.href=`/`,e},toLogin:d}},h=e=>{let{requestInstance:t,entityName:n}=e,r=`/api/v1/entities/${n}`,i=e=>{if(!e)return;let t={...e};return e.fields&&Array.isArray(e.fields)&&(t.fields=e.fields.join(`,`)),e.query&&typeof e.query==`object`&&(t.query=JSON.stringify(e.query)),t};return{async query(e){let n=i(e);return t.get(r,{params:n})},async queryAll(e){let n=i(e);return t.get(`${r}/all`,{params:n})},async get(e){let{id:n,...a}=e,o=i(a);return t.get(`${r}/${n}`,{params:o})},async create(e){return t.post(r,e.data)},async update(e){return t.put(`${r}/${e.id}`,e.data)},async delete(e){return t.delete(`${r}/${e.id}`)},async deleteBatch(e){return t.delete(`${r}/batch`,{data:{ids:e.ids}})},async createBatch(e){return t.post(`${r}/batch`,e.data)},async updateBatch(e){return t.put(`${r}/batch`,e.data)}}},g=e=>{let{requestInstance:t}=e,n=new Map;return new Proxy({},{get(e,r){if(!u(r))return n.has(r)||n.set(r,h({requestInstance:t,entityName:r})),n.get(r)}})},_=e=>{let{requestInstance:t}=e;return{async invoke(e){let{url:n,method:r=`GET`,data:i,options:a={}}=e;if(typeof window<`u`&&a?.responseType===`stream`){let e;try{typeof globalThis<`u`&&`localStorage`in globalThis&&typeof globalThis.localStorage?.getItem==`function`&&(e=globalThis.localStorage.getItem(`token`)??void 0)}catch{}let t={"Content-Type":`application/json`,"App-Host":globalThis?.window?.location?.origin??``,...e?{Authorization:`Bearer ${e}`}:{},...a.headers||{}},o;i&&[`POST`,`PUT`,`PATCH`].includes(r.toUpperCase())&&(o=JSON.stringify(i));let s=await fetch(n,{method:r.toUpperCase(),headers:t,body:o});return s}let o={method:r.toUpperCase(),url:n,...a};return i&&[`POST`,`PUT`,`PATCH`].includes(o.method)?o.data=i:i&&[`GET`,`DELETE`].includes(o.method)&&(o.params=i),t.request(o)}}},v=e=>{let{requestInstance:t}=e;return new Proxy({},{get(e,n){if(!u(n))return new Proxy({},{get(e,r){if(!u(r))return(e={})=>{let i=`/api/integrations/core/${r}`;n!==`core`&&(i=`/api/integrations/providers/${n}/${r}`);let{payload:a={},option:o={}}=e,s=a instanceof FormData?{...o,headers:{...o.headers,"Content-Type":void 0}}:o;return t.post(i,a,s)}}})}})};let y=null;const b=e=>{if(y)return;let{requestInstance:t}=e,n=async e=>{let n=globalThis?.localStorage?.getItem(`token`);if(n)return;let r=e.token,i=await t.post(`/api/v1/auth/token/exchange`,{platform_token:r});i.status===200&&i.data.token&&(globalThis?.localStorage?.setItem(`token`,i.data.token),window.location.href=`/`)},r=e=>{switch(e.data.type){case`mgx-token-saved`:n(e.data.data);break;default:break}};y={requestInstance:t,handleMessage:r},globalThis?.window?.addEventListener(`message`,r)},x=()=>{let e=(e,t,n,r)=>{if(globalThis?.window===void 0||!globalThis?.window?.top){console.warn(`postMessage: window.top is not available`);return}try{let{targetOrigin:i=`*`,targetName:a=globalThis?.window?.name??``}=n||{},o={type:e,targetName:a,data:t};(r??globalThis?.window?.top)?.postMessage(o,i)}catch(e){console.warn(`Failed to send postMessage:`,e)}};return{postMessage:e}};let S=!1;const C=e=>{b(e);let{postMessage:t}=x(),n=()=>{if(S)return;S=!0;let e=globalThis?.localStorage?.getItem(`token`),n=globalThis?.localStorage?.getItem(`isLougOutManual`)===`true`,r=window.self!==window.top&&window.name?.includes(`devIframe`);console.log(`init----`,e,n,r),!e&&!n&&r&&(console.log(`init----`,`send mgx-token-request`),t(`mgx-token-request`,{domain:globalThis?.window?.location?.href??``},{},globalThis?.window?.opener),t(`mgx-token-request`,{domain:globalThis?.window?.location?.href??``}))};return n(),{createPage(e){let n=e??globalThis?.window?.location?.pathname??``;t(`mgx-create-page`,{path:n})}}},w=()=>{let{postMessage:e}=x(),t=t=>{if(t){if(globalThis?.window===void 0){console.warn(`openUrl: window is not available`);return}if(p(t)&&f()){e(`mgx-open-url`,{url:t.toString()},{},globalThis?.window?.opener);return}globalThis.window.location.href=t.toString()}};return{openUrl:t}},T=(e={})=>{let t=c({baseURL:`/`,...e});console.log(`createClient----`,t);let n=m({requestInstance:t}),r=g({requestInstance:t}),i=_({requestInstance:t}),a=v({requestInstance:t}),o=C({requestInstance:t}),s=w();return{auth:n,entities:r,apiCall:i,integrations:a,frame:o,utils:s}};function E(){let e=`virtual:404-page`,t=`import { Button } from '@/components/ui/button';
2
2
  import { createClient } from '@metagptx/web-sdk';
3
3
 
4
4
  // Create client instance
@@ -45,4 +45,38 @@ export default function NotFoundPage() {
45
45
  import NotFoundPage from 'virtual:404-page';`),r=!0;else if(/\/\/\s*MODULE_IMPORTS_END/.test(e))e=e.replace(/(\/\/\s*MODULE_IMPORTS_END)/,`$1
46
46
  import NotFoundPage from 'virtual:404-page';`),r=!0;else if(/\/\/\s*MODULE_IMPORTS_START/.test(e))e=e.replace(/(\/\/\s*MODULE_IMPORTS_START)/,`import NotFoundPage from 'virtual:404-page';
47
47
  $1`),r=!0;else{let t=/(^import\s[^;]+;)/gm,n=[...e.matchAll(t)];if(n.length>0){let t=n[n.length-1],i=t.index+t[0].length,a=e.substring(0,i),o=e.substring(i);e=`${a}\nimport NotFoundPage from 'virtual:404-page';${o}`,r=!0}}}let a=/path\s*=\s*["']\*["']/.test(e);if(!a){if(/\/\/\s*MODULE_ROUTES_END/.test(e)){let t=e.match(/(\s*)\/\/\s*MODULE_ROUTES_END/);if(t){let n=t[1];e=e.replace(/(\s*)\/\/\s*MODULE_ROUTES_END/,`${n}<Route path="*" element={<NotFoundPage />} />\n$1// MODULE_ROUTES_END`),r=!0}}else if(/<\/Routes>/.test(e)){let t=e.match(/(\s*)<\/Routes>/);if(t){let n=t[1],i=e.match(/(\s+)<Route\s+path=/),a=i?i[1]:`${n} `;e=e.replace(/(\s*)<\/Routes>/,`${a}<Route path="*" element={<NotFoundPage />} />\n$1</Routes>`),r=!0}}else if(/<Route\s+path=/.test(e)){let t=/<Route\s[^>]*\/>|<Route\s[^>]*>[\s\S]*?<\/Route>/g,n=[...e.matchAll(t)];if(n.length>0){let t=n[n.length-1],i=t.index+t[0].length,a=e.substring(0,i),o=e.substring(i),s=a.split(`
48
- `),c=s[s.length-1],l=c.match(/^(\s*)/)?.[1]||``;e=`${a}\n${l}<Route path="*" element={<NotFoundPage />} />${o}`,r=!0}}}return r?{code:e,map:null}:null}}}export{b as createClient,x as vitePlugin404};
48
+ `),c=s[s.length-1],l=c.match(/^(\s*)/)?.[1]||``;e=`${a}\n${l}<Route path="*" element={<NotFoundPage />} />${o}`,r=!0}}}return r?{code:e,map:null}:null}}}const D=a.default||a;function O(e={}){let{routeFile:t=`src/App.tsx`,entryFile:a=`src/main.tsx`,moduleId:s=`virtual:routes-manifest`,notifyParent:c=!0,messageType:l=`ROUTES_MANIFEST`,excludePaths:u=[`*`]}=e,d=`\0${s}`,f=process.cwd();function p(e,t){for(let n of e)if(o.isJSXAttribute(n)&&o.isJSXIdentifier(n.name,{name:t})&&o.isStringLiteral(n.value))return n.value.value}function m(e){for(let t of e)if(o.isJSXAttribute(t)&&o.isJSXIdentifier(t.name,{name:`element`})){let e=t.value;if(o.isJSXExpressionContainer(e)){let t=e.expression;if(o.isJSXElement(t)){let e=t.openingElement;if(o.isJSXIdentifier(e.name))return e.name.name}}}}function h(e){return e.some(e=>o.isJSXAttribute(e)&&o.isJSXIdentifier(e.name,{name:`element`}))}function g(e){return e.some(e=>o.isJSXAttribute(e)&&o.isJSXIdentifier(e.name,{name:`index`}))}function _(e,t){let n=[];for(let r of e)if(o.isJSXElement(r)){let e=r.openingElement;if(o.isJSXIdentifier(e.name,{name:`Route`})){let e=v(r,t);e&&n.push(e)}}return n}function v(e,t){let n=e.openingElement.attributes,r=p(n,`path`),i=g(n),a=h(n),o=m(n),s;if(i)s=t||`/`;else if(r===void 0)return null;else s=r.startsWith(`/`)?r:t===`/`?`/${r}`:`${t}/${r}`;s=s.replace(/\/+/g,`/`),s!==`/`&&s.endsWith(`/`)&&(s=s.slice(0,-1));let c={path:s,hasElement:a,elementName:o,isWildcard:r===`*`,isIndex:i};if(e.children&&e.children.length>0){let t=_(e.children,s);t.length>0&&(c.children=t)}return c}function y(e,t=[]){for(let n of e)n.hasElement&&t.push({path:n.path,elementName:n.elementName}),n.children&&y(n.children,t);return t}function b(e){let t=0;for(let n of e)t++,n.children&&(t+=b(n.children));return t}function x(e){let t={routeTree:[],routes:[],pageCount:0,total:0,generatedAt:new Date().toISOString()};if(!n.existsSync(e))return console.warn(`[routes-scanner] Route file not found: ${e}`),t;let r=n.readFileSync(e,`utf-8`),a;try{a=i.parse(r,{sourceType:`module`,plugins:[`jsx`,`typescript`]})}catch(e){return console.error(`[routes-scanner] Failed to parse route file:`,e),t}let s=[];D(a,{JSXElement(e){let t=e.node.openingElement;if(o.isJSXIdentifier(t.name,{name:`Routes`})){let t=e.node.children;for(let e of t)if(o.isJSXElement(e)){let t=e.openingElement;if(o.isJSXIdentifier(t.name,{name:`Route`})){let t=v(e,``);t&&s.push(t)}}e.stop()}}});let c=y(s),l=c.filter(e=>!u.some(t=>e.path===t||e.path.match(RegExp(`^${t.replace(`*`,`.*`)}$`))));return{routeTree:s,routes:c,pageCount:l.length,total:b(s),generatedAt:new Date().toISOString()}}return{name:`vite-plugin-routes-scanner`,configResolved(e){f=e.root},resolveId(e){if(e===s)return d},load(e){if(e===d){let e=r.resolve(f,t),n=x(e),i=c?`
49
+ // 向父级 iframe 发送路由信息
50
+ function notifyParentWindow() {
51
+ console.log('[routes-scanner] notifyParentWindow', routesManifest);
52
+ if (typeof window !== 'undefined' && window.parent && window.parent !== window) {
53
+ try {
54
+ window.parent.postMessage({
55
+ type: '${l}',
56
+ payload: routesManifest,
57
+ }, '*');
58
+ } catch (e) {
59
+ console.warn('[routes-scanner] Failed to notify parent window:', e);
60
+ }
61
+ }
62
+ }
63
+
64
+ // 页面加载完成后发送
65
+ if (typeof window !== 'undefined') {
66
+ if (document.readyState === 'complete') {
67
+ notifyParentWindow();
68
+ } else {
69
+ window.addEventListener('load', notifyParentWindow);
70
+ }
71
+ }
72
+
73
+ export { notifyParentWindow };
74
+ `:``;return`
75
+ export const routesManifest = ${JSON.stringify(n,null,2)};
76
+ export const routeTree = routesManifest.routeTree;
77
+ export const routes = routesManifest.routes;
78
+ export const pageCount = routesManifest.pageCount;
79
+ export const total = routesManifest.total;
80
+ ${i}
81
+ export default routesManifest;
82
+ `}},transform(e,t){let n=t.replace(/\\/g,`/`),i=r.resolve(f,a).replace(/\\/g,`/`);if(n===i&&c){let t=`import "${s}";\n`;return e.includes(s)?null:{code:t+e,map:null}}return null},configureServer(e){let n=r.resolve(f,t);e.watcher.add(n),e.watcher.on(`change`,t=>{if(t===n){let t=e.moduleGraph.getModuleById(d);t&&(e.moduleGraph.invalidateModule(t),e.ws.send({type:`full-reload`}))}})}}}export{T as createClient,E as vitePlugin404,O as vitePluginRoutes};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@metagptx/web-sdk",
3
3
  "type": "module",
4
- "version": "0.0.51",
4
+ "version": "0.0.52-beta.11",
5
5
  "packageManager": "pnpm@10.15.0+sha512.486ebc259d3e999a4e8691ce03b5cac4a71cbeca39372a9b762cb500cfdf0873e2cb16abe3d951b1ee2cf012503f027b98b6584e4df22524e0c7450d9ec7aa7b",
6
6
  "description": "TypeScript SDK for interacting with FuncSea API",
7
7
  "author": "MetaGPTX",
@@ -25,7 +25,7 @@
25
25
  "test": "vitest run",
26
26
  "test:coverage": "vitest --coverage run",
27
27
  "typecheck": "tsc --noEmit",
28
- "release": "bumpp && npm publish",
28
+ "release": "bumpp && npm publish --tag beta",
29
29
  "lint": "eslint",
30
30
  "lint:fix": "eslint --fix",
31
31
  "precommit": "npm run typecheck && lint-staged && npm run test:coverage",
@@ -43,6 +43,10 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "@antfu/eslint-config": "^5.4.1",
46
+ "@babel/parser": "^7.28.6",
47
+ "@babel/traverse": "^7.28.6",
48
+ "@babel/types": "^7.28.6",
49
+ "@types/babel__traverse": "^7.28.0",
46
50
  "@types/jest": "^30.0.0",
47
51
  "@types/node": "^22.15.17",
48
52
  "@vitest/coverage-v8": "^3.2.4",