Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@inertiajs/core

Package Overview
Dependencies
Maintainers
3
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@inertiajs/core - npm Package Compare versions

Comparing version
3.0.3
to
3.1.0
+6
types/partialReload.d.ts
import { ActiveVisit } from './types';
type VisitFilter = Pick<ActiveVisit, 'only' | 'except'>;
export declare const isPathOrSubPath: (path: string, candidate: string) => boolean;
export declare const partialReloadRequestsProp: (visit: VisitFilter, prop: string) => boolean;
export declare const partialReloadRequestsSomeProps: (visit: VisitFilter, props: string[]) => boolean;
export {};
+2
-2

@@ -242,3 +242,3 @@ // src/server.ts

const opts = typeof options === "number" ? { port: options } : options;
const { port = 13714, cluster: useCluster = false, formatErrors = true } = opts ?? {};
const { port = 13714, host = "0.0.0.0", cluster: useCluster = false, formatErrors = true } = opts ?? {};
const log = (message) => {

@@ -307,3 +307,3 @@ console.log(

response.end();
}).listen(port, () => log("Inertia SSR server started."));
}).listen({ port, host }, () => log("Inertia SSR server started."));
log(`Starting SSR server on port ${port}...`);

@@ -310,0 +310,0 @@ return render;

{
"version": 3,
"sources": ["../src/server.ts", "../src/ssrErrors.ts"],
"sourcesContent": ["import { originalPositionFor, TraceMap } from '@jridgewell/trace-mapping'\nimport { createServer, IncomingMessage, ServerResponse } from 'http'\nimport cluster from 'node:cluster'\nimport { existsSync, readFileSync } from 'node:fs'\nimport { availableParallelism } from 'node:os'\nimport path from 'node:path'\nimport * as process from 'process'\nimport { classifySSRError, formatConsoleError, setSourceMapResolver } from './ssrErrors'\nimport { InertiaAppResponse, Page } from './types'\n\n// Cache parsed sourcemaps for performance\nconst sourceMaps = new Map<string, TraceMap>()\n\nsetSourceMapResolver((file: string, line: number, column: number) => {\n // Only resolve for bundled SSR files\n if (!file.includes('/ssr/') || !file.endsWith('.js')) {\n return null\n }\n\n const mapFile = file + '.map'\n\n if (!existsSync(mapFile)) {\n return null\n }\n\n let traceMap = sourceMaps.get(mapFile)\n\n if (!traceMap) {\n try {\n const mapContent = readFileSync(mapFile, 'utf-8')\n traceMap = new TraceMap(mapContent)\n sourceMaps.set(mapFile, traceMap)\n } catch {\n return null\n }\n }\n\n const original = originalPositionFor(traceMap, { line, column })\n\n if (original.source) {\n // Resolve the source path relative to the sourcemap location\n const mapDir = path.dirname(mapFile)\n const resolvedPath = path.resolve(mapDir, original.source)\n\n return {\n file: resolvedPath,\n line: original.line ?? line,\n column: original.column ?? column,\n }\n }\n\n return null\n})\n\ntype AppCallback = (page: Page) => InertiaAppResponse\ntype RouteHandler = (request: IncomingMessage, response: ServerResponse) => Promise<unknown>\ntype ServerOptions = {\n port?: number\n cluster?: boolean\n formatErrors?: boolean\n}\ntype Port = number\n\nconst readableToString: (readable: IncomingMessage) => Promise<string> = (readable) =>\n new Promise((resolve, reject) => {\n let data = ''\n readable.on('data', (chunk) => (data += chunk))\n readable.on('end', () => resolve(data))\n readable.on('error', (err) => reject(err))\n })\n\nexport default (render: AppCallback, options?: Port | ServerOptions): AppCallback => {\n const opts = typeof options === 'number' ? { port: options } : options\n const { port = 13714, cluster: useCluster = false, formatErrors = true } = opts ?? {}\n\n const log = (message: string) => {\n console.log(\n useCluster && !cluster.isPrimary\n ? `[${cluster.worker?.id ?? 'N/A'} / ${cluster.worker?.process?.pid ?? 'N/A'}] ${message}`\n : message,\n )\n }\n\n if (useCluster && cluster.isPrimary) {\n log('Primary Inertia SSR server process started...')\n\n for (let i = 0; i < availableParallelism(); i++) {\n cluster.fork()\n }\n\n cluster.on('message', (_worker, message) => {\n if (message === 'shutdown') {\n for (const id in cluster.workers) {\n cluster.workers[id]?.kill()\n }\n\n process.exit()\n }\n })\n\n return render\n }\n\n const handleRender = async (request: IncomingMessage, response: ServerResponse) => {\n const page: Page = JSON.parse(await readableToString(request))\n\n // Suppress framework warnings during render (they clutter the output)\n const originalWarn = console.warn\n\n if (formatErrors) {\n console.warn = () => {}\n }\n\n try {\n const result = await render(page)\n\n response.writeHead(200, { 'Content-Type': 'application/json', Server: 'Inertia.js SSR' })\n response.write(JSON.stringify(result))\n } catch (e) {\n const error = e as Error\n\n if (!formatErrors) {\n throw error\n }\n\n const classified = classifySSRError(error, page.component, page.url)\n console.error(formatConsoleError(classified))\n\n response.writeHead(500, { 'Content-Type': 'application/json', Server: 'Inertia.js SSR' })\n response.write(JSON.stringify(classified))\n } finally {\n console.warn = originalWarn\n }\n }\n\n const routes: Record<string, RouteHandler> = {\n '/health': async () => ({ status: 'OK', timestamp: Date.now() }),\n '/shutdown': async () => {\n if (cluster.isWorker) {\n process.send?.('shutdown')\n }\n\n process.exit()\n },\n '/render': handleRender,\n '/404': async () => ({ status: 'NOT_FOUND', timestamp: Date.now() }),\n }\n\n createServer(async (request, response) => {\n const dispatchRoute = routes[request.url as string] ?? routes['/404']\n const result = await dispatchRoute(request, response)\n\n if (!response.headersSent) {\n response.writeHead(200, { 'Content-Type': 'application/json', Server: 'Inertia.js SSR' })\n response.write(JSON.stringify(result))\n }\n\n response.end()\n }).listen(port, () => log('Inertia SSR server started.'))\n\n log(`Starting SSR server on port ${port}...`)\n\n // Return the render callback so it can be exported for Vite SSR dev mode\n return render\n}\n", "/**\n * SSR Error Classification\n *\n * This module detects common SSR errors and provides helpful hints\n * to developers on how to fix them. The most common issue is using\n * browser-specific APIs (like window, document) that don't exist\n * in the Node.js server environment.\n */\n\nexport type SSRErrorType = 'browser-api' | 'component-resolution' | 'render' | 'unknown'\n\ntype SourceMapResolver = (\n file: string,\n line: number,\n column: number,\n) => { file: string; line: number; column: number } | null\n\nlet sourceMapResolver: SourceMapResolver | null = null\n\nexport function setSourceMapResolver(resolver: SourceMapResolver | null): void {\n sourceMapResolver = resolver\n}\n\nexport interface ClassifiedSSRError {\n error: string\n type: SSRErrorType\n component?: string\n url?: string\n browserApi?: string\n hint: string\n stack?: string\n sourceLocation?: string\n timestamp: string\n}\n\nconst BROWSER_APIS: Record<string, string> = {\n // Global objects\n window: 'The global window object',\n document: 'The DOM document object',\n navigator: 'The navigator object',\n location: 'The location object',\n history: 'The browser history API',\n screen: 'The screen object',\n localStorage: 'Browser local storage',\n sessionStorage: 'Browser session storage',\n\n // Viewport properties (accessed via window.X)\n innerWidth: 'Browser viewport width',\n innerHeight: 'Browser viewport height',\n outerWidth: 'Browser window width',\n outerHeight: 'Browser window height',\n scrollX: 'Horizontal scroll position',\n scrollY: 'Vertical scroll position',\n devicePixelRatio: 'The device pixel ratio',\n matchMedia: 'The matchMedia function',\n\n // Observers (commonly instantiated at module level)\n IntersectionObserver: 'The IntersectionObserver API',\n ResizeObserver: 'The ResizeObserver API',\n MutationObserver: 'The MutationObserver API',\n\n // Timing functions (commonly called at module level)\n requestAnimationFrame: 'The requestAnimationFrame function',\n requestIdleCallback: 'The requestIdleCallback function',\n\n // Constructors that might be used at module level\n Image: 'The Image constructor',\n Audio: 'The Audio constructor',\n Worker: 'The Worker constructor',\n BroadcastChannel: 'The BroadcastChannel constructor',\n\n // Network (older Node.js versions)\n fetch: 'The fetch API',\n XMLHttpRequest: 'The XMLHttpRequest API',\n}\n\nfunction detectBrowserApi(error: Error): string | null {\n const message = error.message.toLowerCase()\n\n for (const api of Object.keys(BROWSER_APIS)) {\n const patterns = [\n `${api.toLowerCase()} is not defined`,\n `'${api.toLowerCase()}' is not defined`,\n `\"${api.toLowerCase()}\" is not defined`,\n `cannot read properties of undefined (reading '${api.toLowerCase()}')`,\n `cannot read property '${api.toLowerCase()}'`,\n ]\n\n if (patterns.some((pattern) => message.includes(pattern))) {\n return api\n }\n }\n\n return null\n}\n\nfunction isComponentResolutionError(error: Error): boolean {\n const message = error.message.toLowerCase()\n\n return (\n message.includes('cannot find module') ||\n message.includes('failed to resolve') ||\n message.includes('module not found') ||\n message.includes('could not resolve')\n )\n}\n\nconst LIFECYCLE_HOOKS = 'onMounted/useEffect/onMount'\n\nfunction getBrowserApiHint(api: string): string {\n const apiDescription = BROWSER_APIS[api] || `The \"${api}\" object`\n\n if (['localStorage', 'sessionStorage'].includes(api)) {\n return (\n `${apiDescription} doesn't exist in Node.js. ` +\n `Check \"typeof ${api} !== 'undefined'\" before using it, ` +\n `or move the code to a ${LIFECYCLE_HOOKS} lifecycle hook.`\n )\n }\n\n if (['window', 'document'].includes(api)) {\n return (\n `${apiDescription} doesn't exist in Node.js. ` +\n `Wrap browser-specific code in a ${LIFECYCLE_HOOKS} lifecycle hook, ` +\n `or check \"typeof ${api} !== 'undefined'\" before using it.`\n )\n }\n\n if (['IntersectionObserver', 'ResizeObserver', 'MutationObserver'].includes(api)) {\n return (\n `${apiDescription} doesn't exist in Node.js. ` +\n `Create observers inside a ${LIFECYCLE_HOOKS} lifecycle hook, not at the module level.`\n )\n }\n\n if (['fetch', 'XMLHttpRequest'].includes(api)) {\n return (\n `${apiDescription} may not be available in all Node.js versions. ` +\n `For SSR, ensure data fetching happens on the server (in your controller) ` +\n `and is passed as props, or use a ${LIFECYCLE_HOOKS} hook for client-side fetching.`\n )\n }\n\n return (\n `${apiDescription} doesn't exist in Node.js. ` +\n `Move this code to a ${LIFECYCLE_HOOKS} lifecycle hook, or guard it with ` +\n `\"typeof ${api} !== 'undefined'\".`\n )\n}\n\nfunction getComponentResolutionHint(component?: string): string {\n const componentPart = component ? ` \"${component}\"` : ''\n\n return (\n `Could not resolve component${componentPart}. ` +\n `Check that the file exists and the path is correct. ` +\n `Ensure the component name matches the file name exactly (case-sensitive).`\n )\n}\n\nfunction getRenderErrorHint(): string {\n return (\n 'An error occurred while rendering the component. ' +\n 'Check the component for browser-specific code that runs during initialization. ' +\n 'Move any code that accesses browser APIs to a lifecycle hook.'\n )\n}\n\nfunction extractSourceLocation(stack?: string): string | undefined {\n if (!stack) {\n return undefined\n }\n\n for (const line of stack.split('\\n')) {\n if (!line.includes('at ')) {\n continue\n }\n\n if (line.includes('node_modules') || line.includes('node:')) {\n continue\n }\n\n let match = line.match(/\\(([^)]+):(\\d+):(\\d+)\\)/)\n\n if (!match) {\n match = line.match(/at\\s+(?:file:\\/\\/)?(.+):(\\d+):(\\d+)\\s*$/)\n }\n\n if (match) {\n const file = match[1].replace(/^file:\\/\\//, '')\n const lineNum = parseInt(match[2], 10)\n const colNum = parseInt(match[3], 10)\n\n if (sourceMapResolver) {\n const resolved = sourceMapResolver(file, lineNum, colNum)\n\n if (resolved) {\n return `${resolved.file}:${resolved.line}:${resolved.column}`\n }\n }\n\n return `${file}:${lineNum}:${colNum}`\n }\n }\n\n return undefined\n}\n\nexport function classifySSRError(error: Error, component?: string, url?: string): ClassifiedSSRError {\n const timestamp = new Date().toISOString()\n const base = {\n error: error.message,\n component,\n url,\n stack: error.stack,\n sourceLocation: extractSourceLocation(error.stack),\n timestamp,\n }\n\n const browserApi = detectBrowserApi(error)\n\n if (browserApi) {\n return {\n ...base,\n type: 'browser-api',\n browserApi,\n hint: getBrowserApiHint(browserApi),\n }\n }\n\n if (isComponentResolutionError(error)) {\n return {\n ...base,\n type: 'component-resolution',\n hint: getComponentResolutionHint(component),\n }\n }\n\n return {\n ...base,\n type: 'render',\n hint: getRenderErrorHint(),\n }\n}\n\nconst colors = {\n reset: '\\x1b[0m',\n red: '\\x1b[31m',\n yellow: '\\x1b[33m',\n cyan: '\\x1b[36m',\n dim: '\\x1b[2m',\n bold: '\\x1b[1m',\n bgRed: '\\x1b[41m',\n white: '\\x1b[37m',\n}\n\nfunction makeRelative(path: string, root?: string): string {\n const base = root ?? process.cwd()\n\n if (path.startsWith(base + '/')) {\n return path.slice(base.length + 1)\n }\n\n return path\n}\n\nexport function formatConsoleError(\n classified: ClassifiedSSRError,\n root?: string,\n formatErrors: boolean = true,\n suppressedWarnings: string[] = [],\n): string {\n if (!formatErrors) {\n const component = classified.component ? `[${classified.component}]` : ''\n return `SSR Error ${component}: ${classified.error}`\n }\n\n const componentPart = classified.component ? ` ${colors.cyan}${classified.component}${colors.reset}` : ''\n\n const lines = [\n '',\n ` ${colors.bgRed}${colors.white}${colors.bold} SSR ERROR ${colors.reset}${componentPart}`,\n '',\n ` ${classified.error}`,\n ]\n\n if (classified.sourceLocation) {\n const relativePath = makeRelative(classified.sourceLocation, root)\n lines.push(` ${colors.dim}Source: ${relativePath}${colors.reset}`)\n }\n\n if (classified.url) {\n lines.push(` ${colors.dim}URL: ${classified.url}${colors.reset}`)\n }\n\n lines.push('', ` ${colors.yellow}Hint${colors.reset} ${classified.hint}`, '')\n\n if (classified.stack) {\n lines.push(` ${colors.dim}${classified.stack.split('\\n').join('\\n ')}${colors.reset}`, '')\n }\n\n if (suppressedWarnings.length > 0) {\n lines.push(` ${colors.dim}Suppressed ${suppressedWarnings.length} framework warning(s).${colors.reset}`, '')\n }\n\n return lines.join('\\n')\n}\n"],
"mappings": ";AAAA,SAAS,qBAAqB,gBAAgB;AAC9C,SAAS,oBAAqD;AAC9D,OAAO,aAAa;AACpB,SAAS,YAAY,oBAAoB;AACzC,SAAS,4BAA4B;AACrC,OAAO,UAAU;AACjB,YAAYA,cAAa;;;ACWzB,IAAI,oBAA8C;AAE3C,SAAS,qBAAqB,UAA0C;AAC7E,sBAAoB;AACtB;AAcA,IAAM,eAAuC;AAAA;AAAA,EAE3C,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,WAAW;AAAA,EACX,UAAU;AAAA,EACV,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,gBAAgB;AAAA;AAAA,EAGhB,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,SAAS;AAAA,EACT,SAAS;AAAA,EACT,kBAAkB;AAAA,EAClB,YAAY;AAAA;AAAA,EAGZ,sBAAsB;AAAA,EACtB,gBAAgB;AAAA,EAChB,kBAAkB;AAAA;AAAA,EAGlB,uBAAuB;AAAA,EACvB,qBAAqB;AAAA;AAAA,EAGrB,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,kBAAkB;AAAA;AAAA,EAGlB,OAAO;AAAA,EACP,gBAAgB;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AEA,aAAS,IAAI;AAAA,EACf,CAAC,EAAE,OAAO,MAAM,MAAM,IAAI,6BAA6B,CAAC;AAExD,MAAI,+BAA+B,IAAI,KAAK;AAG5C,SAAO;AACT;",
"sourcesContent": ["import { originalPositionFor, TraceMap } from '@jridgewell/trace-mapping'\nimport { createServer, IncomingMessage, ServerResponse } from 'http'\nimport cluster from 'node:cluster'\nimport { existsSync, readFileSync } from 'node:fs'\nimport { availableParallelism } from 'node:os'\nimport path from 'node:path'\nimport * as process from 'process'\nimport { classifySSRError, formatConsoleError, setSourceMapResolver } from './ssrErrors'\nimport { InertiaAppResponse, Page } from './types'\n\n// Cache parsed sourcemaps for performance\nconst sourceMaps = new Map<string, TraceMap>()\n\nsetSourceMapResolver((file: string, line: number, column: number) => {\n // Only resolve for bundled SSR files\n if (!file.includes('/ssr/') || !file.endsWith('.js')) {\n return null\n }\n\n const mapFile = file + '.map'\n\n if (!existsSync(mapFile)) {\n return null\n }\n\n let traceMap = sourceMaps.get(mapFile)\n\n if (!traceMap) {\n try {\n const mapContent = readFileSync(mapFile, 'utf-8')\n traceMap = new TraceMap(mapContent)\n sourceMaps.set(mapFile, traceMap)\n } catch {\n return null\n }\n }\n\n const original = originalPositionFor(traceMap, { line, column })\n\n if (original.source) {\n // Resolve the source path relative to the sourcemap location\n const mapDir = path.dirname(mapFile)\n const resolvedPath = path.resolve(mapDir, original.source)\n\n return {\n file: resolvedPath,\n line: original.line ?? line,\n column: original.column ?? column,\n }\n }\n\n return null\n})\n\ntype AppCallback = (page: Page) => InertiaAppResponse\ntype RouteHandler = (request: IncomingMessage, response: ServerResponse) => Promise<unknown>\ntype ServerOptions = {\n port?: number\n host?: string\n cluster?: boolean\n formatErrors?: boolean\n}\ntype Port = number\n\nconst readableToString: (readable: IncomingMessage) => Promise<string> = (readable) =>\n new Promise((resolve, reject) => {\n let data = ''\n readable.on('data', (chunk) => (data += chunk))\n readable.on('end', () => resolve(data))\n readable.on('error', (err) => reject(err))\n })\n\nexport default (render: AppCallback, options?: Port | ServerOptions): AppCallback => {\n const opts = typeof options === 'number' ? { port: options } : options\n const { port = 13714, host = '0.0.0.0', cluster: useCluster = false, formatErrors = true } = opts ?? {}\n\n const log = (message: string) => {\n console.log(\n useCluster && !cluster.isPrimary\n ? `[${cluster.worker?.id ?? 'N/A'} / ${cluster.worker?.process?.pid ?? 'N/A'}] ${message}`\n : message,\n )\n }\n\n if (useCluster && cluster.isPrimary) {\n log('Primary Inertia SSR server process started...')\n\n for (let i = 0; i < availableParallelism(); i++) {\n cluster.fork()\n }\n\n cluster.on('message', (_worker, message) => {\n if (message === 'shutdown') {\n for (const id in cluster.workers) {\n cluster.workers[id]?.kill()\n }\n\n process.exit()\n }\n })\n\n return render\n }\n\n const handleRender = async (request: IncomingMessage, response: ServerResponse) => {\n const page: Page = JSON.parse(await readableToString(request))\n\n // Suppress framework warnings during render (they clutter the output)\n const originalWarn = console.warn\n\n if (formatErrors) {\n console.warn = () => {}\n }\n\n try {\n const result = await render(page)\n\n response.writeHead(200, { 'Content-Type': 'application/json', Server: 'Inertia.js SSR' })\n response.write(JSON.stringify(result))\n } catch (e) {\n const error = e as Error\n\n if (!formatErrors) {\n throw error\n }\n\n const classified = classifySSRError(error, page.component, page.url)\n console.error(formatConsoleError(classified))\n\n response.writeHead(500, { 'Content-Type': 'application/json', Server: 'Inertia.js SSR' })\n response.write(JSON.stringify(classified))\n } finally {\n console.warn = originalWarn\n }\n }\n\n const routes: Record<string, RouteHandler> = {\n '/health': async () => ({ status: 'OK', timestamp: Date.now() }),\n '/shutdown': async () => {\n if (cluster.isWorker) {\n process.send?.('shutdown')\n }\n\n process.exit()\n },\n '/render': handleRender,\n '/404': async () => ({ status: 'NOT_FOUND', timestamp: Date.now() }),\n }\n\n createServer(async (request, response) => {\n const dispatchRoute = routes[request.url as string] ?? routes['/404']\n const result = await dispatchRoute(request, response)\n\n if (!response.headersSent) {\n response.writeHead(200, { 'Content-Type': 'application/json', Server: 'Inertia.js SSR' })\n response.write(JSON.stringify(result))\n }\n\n response.end()\n }).listen({ port, host }, () => log('Inertia SSR server started.'))\n\n log(`Starting SSR server on port ${port}...`)\n\n // Return the render callback so it can be exported for Vite SSR dev mode\n return render\n}\n", "/**\n * SSR Error Classification\n *\n * This module detects common SSR errors and provides helpful hints\n * to developers on how to fix them. The most common issue is using\n * browser-specific APIs (like window, document) that don't exist\n * in the Node.js server environment.\n */\n\nexport type SSRErrorType = 'browser-api' | 'component-resolution' | 'render' | 'unknown'\n\ntype SourceMapResolver = (\n file: string,\n line: number,\n column: number,\n) => { file: string; line: number; column: number } | null\n\nlet sourceMapResolver: SourceMapResolver | null = null\n\nexport function setSourceMapResolver(resolver: SourceMapResolver | null): void {\n sourceMapResolver = resolver\n}\n\nexport interface ClassifiedSSRError {\n error: string\n type: SSRErrorType\n component?: string\n url?: string\n browserApi?: string\n hint: string\n stack?: string\n sourceLocation?: string\n timestamp: string\n}\n\nconst BROWSER_APIS: Record<string, string> = {\n // Global objects\n window: 'The global window object',\n document: 'The DOM document object',\n navigator: 'The navigator object',\n location: 'The location object',\n history: 'The browser history API',\n screen: 'The screen object',\n localStorage: 'Browser local storage',\n sessionStorage: 'Browser session storage',\n\n // Viewport properties (accessed via window.X)\n innerWidth: 'Browser viewport width',\n innerHeight: 'Browser viewport height',\n outerWidth: 'Browser window width',\n outerHeight: 'Browser window height',\n scrollX: 'Horizontal scroll position',\n scrollY: 'Vertical scroll position',\n devicePixelRatio: 'The device pixel ratio',\n matchMedia: 'The matchMedia function',\n\n // Observers (commonly instantiated at module level)\n IntersectionObserver: 'The IntersectionObserver API',\n ResizeObserver: 'The ResizeObserver API',\n MutationObserver: 'The MutationObserver API',\n\n // Timing functions (commonly called at module level)\n requestAnimationFrame: 'The requestAnimationFrame function',\n requestIdleCallback: 'The requestIdleCallback function',\n\n // Constructors that might be used at module level\n Image: 'The Image constructor',\n Audio: 'The Audio constructor',\n Worker: 'The Worker constructor',\n BroadcastChannel: 'The BroadcastChannel constructor',\n\n // Network (older Node.js versions)\n fetch: 'The fetch API',\n XMLHttpRequest: 'The XMLHttpRequest API',\n}\n\nfunction detectBrowserApi(error: Error): string | null {\n const message = error.message.toLowerCase()\n\n for (const api of Object.keys(BROWSER_APIS)) {\n const patterns = [\n `${api.toLowerCase()} is not defined`,\n `'${api.toLowerCase()}' is not defined`,\n `\"${api.toLowerCase()}\" is not defined`,\n `cannot read properties of undefined (reading '${api.toLowerCase()}')`,\n `cannot read property '${api.toLowerCase()}'`,\n ]\n\n if (patterns.some((pattern) => message.includes(pattern))) {\n return api\n }\n }\n\n return null\n}\n\nfunction isComponentResolutionError(error: Error): boolean {\n const message = error.message.toLowerCase()\n\n return (\n message.includes('cannot find module') ||\n message.includes('failed to resolve') ||\n message.includes('module not found') ||\n message.includes('could not resolve')\n )\n}\n\nconst LIFECYCLE_HOOKS = 'onMounted/useEffect/onMount'\n\nfunction getBrowserApiHint(api: string): string {\n const apiDescription = BROWSER_APIS[api] || `The \"${api}\" object`\n\n if (['localStorage', 'sessionStorage'].includes(api)) {\n return (\n `${apiDescription} doesn't exist in Node.js. ` +\n `Check \"typeof ${api} !== 'undefined'\" before using it, ` +\n `or move the code to a ${LIFECYCLE_HOOKS} lifecycle hook.`\n )\n }\n\n if (['window', 'document'].includes(api)) {\n return (\n `${apiDescription} doesn't exist in Node.js. ` +\n `Wrap browser-specific code in a ${LIFECYCLE_HOOKS} lifecycle hook, ` +\n `or check \"typeof ${api} !== 'undefined'\" before using it.`\n )\n }\n\n if (['IntersectionObserver', 'ResizeObserver', 'MutationObserver'].includes(api)) {\n return (\n `${apiDescription} doesn't exist in Node.js. ` +\n `Create observers inside a ${LIFECYCLE_HOOKS} lifecycle hook, not at the module level.`\n )\n }\n\n if (['fetch', 'XMLHttpRequest'].includes(api)) {\n return (\n `${apiDescription} may not be available in all Node.js versions. ` +\n `For SSR, ensure data fetching happens on the server (in your controller) ` +\n `and is passed as props, or use a ${LIFECYCLE_HOOKS} hook for client-side fetching.`\n )\n }\n\n return (\n `${apiDescription} doesn't exist in Node.js. ` +\n `Move this code to a ${LIFECYCLE_HOOKS} lifecycle hook, or guard it with ` +\n `\"typeof ${api} !== 'undefined'\".`\n )\n}\n\nfunction getComponentResolutionHint(component?: string): string {\n const componentPart = component ? ` \"${component}\"` : ''\n\n return (\n `Could not resolve component${componentPart}. ` +\n `Check that the file exists and the path is correct. ` +\n `Ensure the component name matches the file name exactly (case-sensitive).`\n )\n}\n\nfunction getRenderErrorHint(): string {\n return (\n 'An error occurred while rendering the component. ' +\n 'Check the component for browser-specific code that runs during initialization. ' +\n 'Move any code that accesses browser APIs to a lifecycle hook.'\n )\n}\n\nfunction extractSourceLocation(stack?: string): string | undefined {\n if (!stack) {\n return undefined\n }\n\n for (const line of stack.split('\\n')) {\n if (!line.includes('at ')) {\n continue\n }\n\n if (line.includes('node_modules') || line.includes('node:')) {\n continue\n }\n\n let match = line.match(/\\(([^)]+):(\\d+):(\\d+)\\)/)\n\n if (!match) {\n match = line.match(/at\\s+(?:file:\\/\\/)?(.+):(\\d+):(\\d+)\\s*$/)\n }\n\n if (match) {\n const file = match[1].replace(/^file:\\/\\//, '')\n const lineNum = parseInt(match[2], 10)\n const colNum = parseInt(match[3], 10)\n\n if (sourceMapResolver) {\n const resolved = sourceMapResolver(file, lineNum, colNum)\n\n if (resolved) {\n return `${resolved.file}:${resolved.line}:${resolved.column}`\n }\n }\n\n return `${file}:${lineNum}:${colNum}`\n }\n }\n\n return undefined\n}\n\nexport function classifySSRError(error: Error, component?: string, url?: string): ClassifiedSSRError {\n const timestamp = new Date().toISOString()\n const base = {\n error: error.message,\n component,\n url,\n stack: error.stack,\n sourceLocation: extractSourceLocation(error.stack),\n timestamp,\n }\n\n const browserApi = detectBrowserApi(error)\n\n if (browserApi) {\n return {\n ...base,\n type: 'browser-api',\n browserApi,\n hint: getBrowserApiHint(browserApi),\n }\n }\n\n if (isComponentResolutionError(error)) {\n return {\n ...base,\n type: 'component-resolution',\n hint: getComponentResolutionHint(component),\n }\n }\n\n return {\n ...base,\n type: 'render',\n hint: getRenderErrorHint(),\n }\n}\n\nconst colors = {\n reset: '\\x1b[0m',\n red: '\\x1b[31m',\n yellow: '\\x1b[33m',\n cyan: '\\x1b[36m',\n dim: '\\x1b[2m',\n bold: '\\x1b[1m',\n bgRed: '\\x1b[41m',\n white: '\\x1b[37m',\n}\n\nfunction makeRelative(path: string, root?: string): string {\n const base = root ?? process.cwd()\n\n if (path.startsWith(base + '/')) {\n return path.slice(base.length + 1)\n }\n\n return path\n}\n\nexport function formatConsoleError(\n classified: ClassifiedSSRError,\n root?: string,\n formatErrors: boolean = true,\n suppressedWarnings: string[] = [],\n): string {\n if (!formatErrors) {\n const component = classified.component ? `[${classified.component}]` : ''\n return `SSR Error ${component}: ${classified.error}`\n }\n\n const componentPart = classified.component ? ` ${colors.cyan}${classified.component}${colors.reset}` : ''\n\n const lines = [\n '',\n ` ${colors.bgRed}${colors.white}${colors.bold} SSR ERROR ${colors.reset}${componentPart}`,\n '',\n ` ${classified.error}`,\n ]\n\n if (classified.sourceLocation) {\n const relativePath = makeRelative(classified.sourceLocation, root)\n lines.push(` ${colors.dim}Source: ${relativePath}${colors.reset}`)\n }\n\n if (classified.url) {\n lines.push(` ${colors.dim}URL: ${classified.url}${colors.reset}`)\n }\n\n lines.push('', ` ${colors.yellow}Hint${colors.reset} ${classified.hint}`, '')\n\n if (classified.stack) {\n lines.push(` ${colors.dim}${classified.stack.split('\\n').join('\\n ')}${colors.reset}`, '')\n }\n\n if (suppressedWarnings.length > 0) {\n lines.push(` ${colors.dim}Suppressed ${suppressedWarnings.length} framework warning(s).${colors.reset}`, '')\n }\n\n return lines.join('\\n')\n}\n"],
"mappings": ";AAAA,SAAS,qBAAqB,gBAAgB;AAC9C,SAAS,oBAAqD;AAC9D,OAAO,aAAa;AACpB,SAAS,YAAY,oBAAoB;AACzC,SAAS,4BAA4B;AACrC,OAAO,UAAU;AACjB,YAAYA,cAAa;;;ACWzB,IAAI,oBAA8C;AA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AO;AAAA,IACjB;AAAA,EACF;AAEA,QAAM,SAAuC;AAAA,IAC3C,WAAW,aAAa,EAAE,QAAQ,MAAM,WAAW,KAAK,IAAI,EAAE;AAAA,IAC9D,aAAa,YAAY;AACvB,UAAI,QAAQ,UAAU;AACpB,QAAQ,gBAAO,UAAU;AAAA,MAC3B;AAEA,MAAQ,cAAK;AAAA,IACf;AAAA,IACA,WAAW;AAAA,IACX,QAAQ,aAAa,EAAE,QAAQ,aAAa,WAAW,KAAK,IAAI,EAAE;AAAA,EACpE;AAEA,eAAa,OAAO,SAAS,aAAa;AACxC,UAAM,gBAAgB,OAAO,QAAQ,GAAa,KAAK,OAAO,MAAM;AACpE,UAAM,SAAS,MAAM,cAAc,SAAS,QAAQ;AAEpD,QAAI,CAAC,SAAS,aAAa;AACzB,eAAS,UAAU,KAAK,EAAE,gBAAgB,oBAAoB,QAAQ,iBAAiB,CAAC;AACxF,eAAS,MAAM,KAAK,UAAU,MAAM,CAAC;AAAA,IACvC;AAEA,aAAS,IAAI;AAAA,EACf,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,GAAG,MAAM,IAAI,6BAA6B,CAAC;AAElE,MAAI,+BAA+B,IAAI,KAAK;AAG5C,SAAO;AACT;",
"names": ["process", "path"]
}
{
"name": "@inertiajs/core",
"version": "3.0.3",
"version": "3.1.0",
"license": "MIT",

@@ -57,3 +57,3 @@ "description": "A framework for creating server-driven single page apps.",

"peerDependencies": {
"axios": "^1.13.2"
"axios": "^1.15.2"
},

@@ -67,3 +67,3 @@ "peerDependenciesMeta": {

"@types/node": "^24.10.13",
"axios": "^1.13.5",
"axios": "^1.15.2",
"es-check": "^9.6.4",

@@ -70,0 +70,0 @@ "esbuild": "^0.27.3",

@@ -16,2 +16,3 @@ import { Config } from './config';

export { shouldIntercept, shouldNavigate } from './navigationEvents';
export { isPathOrSubPath, partialReloadRequestsProp, partialReloadRequestsSomeProps } from './partialReload';
export { progress, default as setupProgress } from './progress';

@@ -18,0 +19,0 @@ export { FormComponentResetSymbol, resetFormFields } from './resetFormFields';

@@ -36,2 +36,3 @@ import { RequestParams } from './requestParams';

protected mergeProps(pageResponse: Page): void;
protected mergeRescuedProps(pageResponse: Page): string[];
/**

@@ -38,0 +39,0 @@ * By default, the Laravel adapter shares validation errors via Inertia::always(),

@@ -5,2 +5,3 @@ import { InertiaAppResponse, Page } from './types';

port?: number;
host?: string;
cluster?: boolean;

@@ -7,0 +8,0 @@ formatErrors?: boolean;

@@ -143,2 +143,3 @@ import { NamedInputEvent, ValidationConfig, Validator } from 'laravel-precognition';

initialDeferredProps?: Record<string, NonNullable<VisitOptions['only']>>;
rescuedProps: string[];
mergeProps?: string[];

@@ -399,2 +400,3 @@ prependProps?: string[];

title?: HeadManagerTitleCallback;
nonce?: string;
defaults?: FirstLevelOptional<InertiaAppConfig & TAdditionalInertiaAppConfig>;

@@ -430,2 +432,3 @@ /** HTTP client or options to use for requests. Defaults to XhrHttpClient. */

progress?: ProgressOptions | false;
nonce?: string;
defaults?: FirstLevelOptional<InertiaAppConfig & TAdditionalInertiaAppConfig>;

@@ -461,2 +464,3 @@ /** HTTP client or options to use for requests. Defaults to XhrHttpClient. */

};
nonce?: string;
visitOptions?: (href: string, options: VisitOptions) => VisitOptions;

@@ -463,0 +467,0 @@ };

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display