UNPKG

@remotion/renderer

Version:

Render Remotion videos using Node.js or Bun

105 lines (104 loc) 3.55 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parseChromeLogLocation = exports.formatChromeMessage = exports.parseBrowserLogMessage = exports.shouldLogBrowserMessage = void 0; const shouldLogBrowserMessage = (message) => { // Not relevant for the user if (message.startsWith('DevTools listening on')) { return false; } // In Ubuntu GitHub Action if (message.includes('Falling back to ALSA for audio output')) { return false; } // In Ubuntu GitHub Action if (message.includes('Floss manager not present, cannot set Floss enable/disable')) { return false; } // Noisy but harmless warning if (message.includes('Failed to send GpuControl.CreateCommandBuffer')) { return false; } if (message.includes('CreatePlatformSocket() failed: Address family not supported by protocol')) { return false; } if (message.includes('Fontconfig error: No writable cache directories')) { return false; } if (message.includes('AttributionReportingCrossAppWeb cannot be enabled in this configuration')) { return false; } if (message.includes('Trying to Produce a Memory representation from a non-existent mailbox.')) { return false; } if (message.includes('Received HEADERS for invalid stream')) { return false; } if (message.includes('CVDisplayLinkCreateWithCGDisplay failed')) { return false; } if (message.includes('Falling back to ALSA for audio output')) { return false; } if (message.includes('VizNullHypothesis is disabled')) { return false; } return true; }; exports.shouldLogBrowserMessage = shouldLogBrowserMessage; const parseBrowserLogMessage = (input) => { const format = /^\[([0-9]{4})\/([0-9]{6})\.([0-9]{6}):([A-Z]+):(.*)\(([0-9]+)\)\](.*)/; const match = input.match(format); if (!match) { return null; } const date = match[1]; const day = parseInt(date.slice(0, 2), 10); const month = parseInt(date.slice(2, 4), 10); const time = match[2]; const hour = parseInt(time.slice(0, 2), 10); const minute = parseInt(time.slice(2, 4), 10); const seconds = parseInt(time.slice(4, 6), 10); const microseconds = parseInt(match[3], 10); const level = match[4]; const location = match[5]; const lineNumber = parseInt(match[6], 10); const message = match[7].trim(); return { day, month, hour, minute, seconds, microseconds, level, location, lineNumber, message, }; }; exports.parseBrowserLogMessage = parseBrowserLogMessage; const formatChromeMessage = (input) => { const parsed = (0, exports.parseBrowserLogMessage)(input); if (!parsed) { return { output: input, tag: 'chrome' }; } const { location, lineNumber, message } = parsed; // Don't print console.log's, these are handled through the WebSocket if (location === 'CONSOLE') { return null; } return { output: `${location}:${lineNumber}: ${message}`, tag: 'chrome' }; }; exports.formatChromeMessage = formatChromeMessage; const parseChromeLogLocation = (message) => { const regex = /(.*), source: (.*) \(([0-9]+)\)/; const match = message.match(regex); if (!match) { return null; } return { lineNumber: parseInt(match[3], 10), location: match[2], }; }; exports.parseChromeLogLocation = parseChromeLogLocation;