"wrangler pages functions build" yields output with different filenames

I’m building my Pages’ functions with the following command
wrangler pages functions build ./functions --sourcemap --compatibility-flags=nodejs_compat --outdir=./dist-functions/

Its output is either
index.js + index.js.map
_worker.js + worker.js.map

Why is that?
How can I ensure it’s output is the same all the time?
How can I make it always be _worker.js + worker.js.map?

I tried to use --outfile option instead of --outdir option, but in this case the sourcemap stops generating.