Skip to content

feat(path): implement node:path.win32 sub-namespace #1162

@TheHypnoo

Description

@TheHypnoo

Context

Perry's node:path runtime implements POSIX semantics (path.basename, path.dirname, path.parse, etc.) but does NOT expose the path.win32 sub-namespace — path.win32.<method> resolves to undefined on every method/property read, so any code path that depends on Windows-style separator handling (\\), drive letters (C:\\…), or UNC paths (\\\\server\\share) crashes or produces wrong output.

Surfaced by the granular node-suite/path/win32/* fixtures added under the per-method parity coverage work — five tests currently fail and are skip-listed in test-parity/known_failures.json pointing at this issue.

Scope

Implement the path.win32 namespace mirror of every POSIX method Perry already supports:

  • path.win32.basename(p, [ext])
  • path.win32.dirname(p)
  • path.win32.extname(p)
  • path.win32.format({root, dir, base, name, ext})
  • path.win32.isAbsolute(p)
  • path.win32.join(...segments)
  • path.win32.normalize(p)
  • path.win32.parse(p){root, dir, base, name, ext}
  • path.win32.relative(from, to)
  • path.win32.resolve(...segments)
  • path.win32.sep (\\) and path.win32.delimiter (;) constants
  • path.win32.toNamespacedPath(p)
  • path.win32.matchesGlob(p, glob)

Plus the Windows-specific rules each method enforces:

  • Drive letters (C:\\foo) are absolute roots; relative-to-drive (C:foo) preserves the drive prefix without making the path absolute.
  • UNC paths (\\\\server\\share\\…) keep the four-character root.
  • \\\\?\\ device prefix paths are passed through normalize / parse intact.
  • Both \\ and / count as separators on Windows.

Acceptance criterion

./run_parity_tests.sh --suite node-suite --module path reports PASS for all five win32 fixtures byte-for-byte against node --experimental-strip-types:

  • node-suite/path/win32/basename-dirname
  • node-suite/path/win32/join-normalize
  • node-suite/path/win32/parse-format
  • node-suite/path/win32/relative-resolve
  • node-suite/path/win32/unc-and-drive

Remove the matching entries from test-parity/known_failures.json once the implementation lands.

Out of scope

path.posix is already wired (see crates/perry-runtime/src/path.rs); only the win32 mirror is missing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions