fix(compile): support fs.fstatSync on vfs (#34892)
Playing with `deno compile` surfaced `NotSupported` errors that traced
back to `fs.fstatSync` being unimplemented on the embedded virtual file
system.
`FileBackedVfsFile`’s `stat_sync`/`stat_async` (the `deno_io::fs::File`
impl backing an open file descriptor for an embedded module) returned
`Err(FsError::NotSupported)`, so any `fstat`/`fstatSync` on a descriptor
opened against a compiled-in file failed.
This builds a `FileBackedVfsMetadata` from the virtual file (`name`,
`File` type, `offset.len`, `mtime`) and reuses the existing
`as_fs_stat()` — the same metadata path-based `stat_sync` already uses
for embedded files. The implementation matches the fix suggested in the
issue.
Added a `tests/specs/compile/node_fstat` spec test (modeled on the
sibling `node_statfs` test) that compiles a program and exercises
`fstatSync`, `fstatSync({ bigint: true })`, the `fstat` callback form,
and `fs.promises` `FileHandle.stat()` against `import.meta.filename`.
Closes #34862
Closes denoland/divybot#489
Co-authored-by: divybot <divybot@users.noreply.github.com>
Co-authored-by: Divy Srivastava <me@littledivy.com>