(key: string, source: string)
| 251 | // Count UTF-8 bytes (not source.length, which is UTF-16 code units and undercounts multi-byte |
| 252 | // characters) so the limit reflects the real payload shipped into the sandbox envelope. |
| 253 | const addModule = (key: string, source: string): void => { |
| 254 | totalBytes += Buffer.byteLength(source, 'utf8'); |
| 255 | if (totalBytes > MAX_PLUGIN_MODULE_BYTES) { |
| 256 | throw new Error('plugin source exceeds the sandbox size limit'); |
| 257 | } |
| 258 | moduleFiles[key] = source; |
| 259 | fileCount++; |
| 260 | }; |
| 261 | const walk = (dir: string): void => { |
| 262 | for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { |
| 263 | if (entry.name === 'node_modules' || entry.name.startsWith('.')) { |
no outgoing calls
no test coverage detected