File tree Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 45
45
"dev" : {
46
46
"executor" : " nx:run-commands" ,
47
47
"options" : {
48
- "command" : " bun --watch ./packages/php-wasm/cli/src/main.ts" ,
48
+ "command" : " node --no-warnings --experimental-wasm-stack-switching --experimental-wasm-jspi --loader=./packages/meta/src/node-es-module-loader/loader.mts ./packages/php-wasm/cli/src/main.ts" ,
49
49
"tty" : true
50
50
}
51
51
},
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import type { SupportedPHPVersion } from '@php-wasm/universal';
14
14
import { FileLockManagerForNode } from '@php-wasm/node' ;
15
15
import { PHP } from '@php-wasm/universal' ;
16
16
import { loadNodeRuntime , useHostFilesystem } from '@php-wasm/node' ;
17
+ import { startBridge } from '@php-wasm/xdebug-bridge' ;
17
18
import path from 'path' ;
18
19
19
20
let args = process . argv . slice ( 2 ) ;
@@ -43,6 +44,13 @@ async function run() {
43
44
args = args . filter ( ( arg ) => arg !== '--xdebug' ) ;
44
45
}
45
46
47
+ const hasDevtoolsOption = args . some ( ( arg ) =>
48
+ arg . startsWith ( '--experimental-devtools' )
49
+ ) ;
50
+ if ( hasDevtoolsOption ) {
51
+ args = args . filter ( ( arg ) => arg !== '--experimental-devtools' ) ;
52
+ }
53
+
46
54
// npm scripts set the TMPDIR env variable
47
55
// PHP accepts a TMPDIR env variable and expects it to
48
56
// be a writable directory within the PHP filesystem.
@@ -97,6 +105,12 @@ ${process.argv[0]} ${process.execArgv.join(' ')} ${process.argv[1]}
97
105
98
106
useHostFilesystem ( php ) ;
99
107
108
+ if ( hasDevtoolsOption && hasXdebugOption ) {
109
+ const bridge = await startBridge ( { } ) ;
110
+
111
+ bridge . start ( ) ;
112
+ }
113
+
100
114
const hasMinusCOption = args . some ( ( arg ) => arg . startsWith ( '-c' ) ) ;
101
115
if ( ! hasMinusCOption ) {
102
116
args . unshift ( '-c' , defaultPhpIniPath ) ;
Original file line number Diff line number Diff line change @@ -18,12 +18,16 @@ export default defineConfig({
18
18
external : [
19
19
'@php-wasm/node' ,
20
20
'@php-wasm/universal' ,
21
+ 'assert' ,
21
22
'net' ,
22
23
'fs' ,
23
24
'path' ,
24
25
'child_process' ,
25
26
'http' ,
27
+ 'stream' ,
28
+ 'timers' ,
26
29
'tls' ,
30
+ 'url' ,
27
31
'util' ,
28
32
'dns' ,
29
33
'ws' ,
You can’t perform that action at this time.
0 commit comments