wordpress-playground
wordpress-playground copied to clipboard
[XDebug Bridge] Exclude file and directory paths from devtools stack and debugging
Motivation for the change, related issues
Based on this comment and pull request.
In Playground CLI, the first line where Xdebug stops in Devtools is the auto_prepend_file.php file located in the internal directory. This pull request aims to ignore what's in the directory by adding a excludedPaths option in the bridge that will be ignored when stacking or stepping.
Implementation details
Added an excludedPath option to the startBridge function. When specified, XdebugCDPBridge will check this option, and the DevTools will step_over any file matching the excluded path, skipping its parsing.
Testing Instructions
With script cli.ts :
import { runCLI } from "./packages/playground/cli/src/run-cli";
const script = `<?php
$test = 42;
echo "Output!\n";
function test() {
echo "Hello Xdebug World!\n";
}
test();
`;
const cliServer = await runCLI({command: 'server', xdebug: true, experimentalDevtools: true});
cliServer.playground.writeFile('xdebug.php', script);
const result = await cliServer.playground.run({scriptPath: `xdebug.php`});
console.log(result.text);
Run command :
node --no-warnings --experimental-wasm-stack-switching --experimental-wasm-jspi --loader=./packages/meta/src/node-es-module-loader/loader.mts cli.ts