ai-debug-local-mcp
Version:
🎯 ENHANCED AI GUIDANCE v4.1.2: Dramatically improved tool descriptions help AI users choose the right tools instead of 'close enough' options. Ultra-fast keyboard automation (10x speed), universal recording, multi-ecosystem debugging support, and compreh
217 lines • 7.53 kB
JavaScript
/**
* Data Collection Module
* Handles collection of monitored data from different meta-frameworks
*/
export class MetaFrameworkDataCollection {
remixLoaderData = [];
astroIslands = [];
viteHMREvents = [];
/**
* Collect Remix loader performance data
*/
async getRemixLoaderData(page) {
const data = await page.evaluate(() => {
return window.__remixLoaderData || [];
});
// Ensure data is an array and properly formatted
if (!Array.isArray(data)) {
return [];
}
return data.map((d) => ({
route: d.route || 'unknown',
loader: d.loader || 'unknown',
duration: Number(d.duration) || 0,
size: Number(d.size) || 0,
cached: Boolean(d.cached),
timestamp: new Date(d.timestamp || Date.now())
}));
}
/**
* Get Remix route modules information
*/
async getRemixRouteModules(page) {
return await page.evaluate(() => {
if (!window.__remixContext?.routeModules) {
return {};
}
const modules = window.__remixContext.routeModules;
const routeInfo = {};
Object.keys(modules).forEach(routeId => {
const module = modules[routeId];
routeInfo[routeId] = {
hasLoader: typeof module.loader === 'function',
hasAction: typeof module.action === 'function',
hasErrorBoundary: typeof module.ErrorBoundary === 'function',
hasCatchBoundary: typeof module.CatchBoundary === 'function',
hasDefault: typeof module.default === 'function'
};
});
return routeInfo;
});
}
/**
* Collect Astro island components data
*/
async getAstroIslands(page) {
const islands = await page.evaluate(() => {
return window.__astroIslands || [];
});
// Ensure islands is an array
if (!Array.isArray(islands)) {
return [];
}
// Ensure proper formatting
return islands.map((island) => ({
component: island.component || 'Unknown',
props: island.props || {},
hydrationDirective: island.hydrationDirective || 'load',
loading: island.loading || 'eager'
}));
}
/**
* Get Nuxt payload and application data
*/
async getNuxtPayload(page) {
return await page.evaluate(() => {
const payload = window.__NUXT__ || {};
const monitorData = window.__nuxtMonitorData || {};
return {
payload,
routes: monitorData.routes || [],
navigationTimes: monitorData.navigationTimes || [],
version: payload.version,
serverRendered: payload.serverRendered,
config: payload.config || {}
};
});
}
/**
* Get Qwik resumability information
*/
async getQwikResumability(page) {
const data = await page.evaluate(() => {
return window.__qwikMonitorData;
});
if (!data) {
return null;
}
return {
serializedState: Number(data.serializedState) || 0,
qrlCount: Number(data.qrlCount) || 0,
symbolsLoaded: Number(data.symbolsLoaded) || 0,
resumeTime: Number(data.resumeTime) || 0
};
}
/**
* Get SolidJS reactivity information
*/
async getSolidJSData(page) {
return await page.evaluate(() => {
const monitorData = window.__solidMonitorData || {};
return {
signals: monitorData.signals || 0,
stores: monitorData.stores || 0,
computations: monitorData.computations || 0,
version: window.Solid?.version,
hydrated: document.querySelector('[data-hk]') !== null
};
});
}
/**
* Get SvelteKit application data
*/
async getSvelteKitData(page) {
return await page.evaluate(() => {
const kit = window.__sveltekit || {};
const monitorData = window.__svelteKitMonitorData || {};
return {
version: kit.version,
navigations: monitorData.navigations || [],
stores: monitorData.stores || [],
updated: kit.updated,
env: kit.env || {}
};
});
}
/**
* Collect Vite HMR events
*/
async getViteHMREvents(page) {
const events = await page.evaluate(() => {
return window.__viteHMREvents || [];
});
// Ensure events is an array
if (!Array.isArray(events)) {
return [];
}
return events.map((event) => ({
type: event.type || 'update',
timestamp: new Date(event.timestamp || Date.now()),
files: event.files || [],
error: event.error
}));
}
/**
* Get general meta-framework information
*/
async getMetaFrameworkInfo(page) {
return await page.evaluate(() => {
const info = {
userAgent: navigator.userAgent,
url: window.location.href,
timestamp: Date.now()
};
// Collect framework-specific info
if (window.__remixContext) {
info.remix = {
version: window.__remixContext.manifest?.version,
routes: Object.keys(window.__remixContext.routeModules || {}),
matches: window.__remixContext.matches?.length || 0
};
}
if (window.__astro) {
info.astro = {
version: window.__astro.version,
islands: document.querySelectorAll('astro-island').length,
components: document.querySelectorAll('[data-astro-component]').length
};
}
if (window.__NUXT__) {
info.nuxt = {
version: window.__NUXT__.version,
serverRendered: window.__NUXT__.serverRendered,
routeData: Object.keys(window.__NUXT__.data || {}).length
};
}
if (window.__qwik) {
info.qwik = {
version: document.querySelector('[q\\:version]')?.getAttribute('q:version'),
containers: document.querySelectorAll('[q\\:container]').length,
objects: document.querySelectorAll('[q\\:obj]').length
};
}
if (window.Solid) {
info.solid = {
version: window.Solid.version,
hydrationKeys: document.querySelectorAll('[data-hk]').length
};
}
if (window.__sveltekit) {
info.sveltekit = {
version: window.__sveltekit.version,
updated: window.__sveltekit.updated
};
}
return info;
});
}
/**
* Clear all collected data
*/
clearCollectedData() {
this.remixLoaderData = [];
this.astroIslands = [];
this.viteHMREvents = [];
}
}
//# sourceMappingURL=meta-framework-data-collection.js.map