Skip to content

Improves sourcemap path handling with pathdiff#1217

Merged
Dekkonot merged 18 commits intorojo-rbx:masterfrom
Ivanmatthew:fix/sourcemap
Feb 13, 2026
Merged

Improves sourcemap path handling with pathdiff#1217
Dekkonot merged 18 commits intorojo-rbx:masterfrom
Ivanmatthew:fix/sourcemap

Conversation

@Ivanmatthew
Copy link
Copy Markdown
Contributor

@Ivanmatthew Ivanmatthew commented Jan 24, 2026

Replaces manual path stripping logic in sourcemap generation with the pathdiff crate to reliably calculate relative paths from the project root. This change ensures more robust handling of file paths when generating sourcemaps, particularly when dealing with complex directory structures.
This PR closes #1212 which was originally caused due to #1201 changing how paths are internally stored on Windows.
With the modification of how the relative paths are calculated, the issue disappears.

This update also introduces new tests for both relative and absolute path mapping in sourcemap generation, which ensures these kinds of issues arise during the testing phase instead of only after manual testing.

Major changes

  • Introduces the pathdiff dependency to accurately calculate relative paths between the project root and file paths during sourcemap construction.
  • Adds json feature to the insta test dependency.
  • Updates SourcemapNode to derive Deserialize and adds default attribute usage for optional fields.
  • Adds new integration tests (maps_relative_paths and maps_absolute_paths) to validate correct path generation in sourcemaps. (Closes Add tests for sourcemap command #1087)

@ari-party
Copy link
Copy Markdown
Contributor

Fix seems to work!

Copy link
Copy Markdown
Member

@kennethloeffler kennethloeffler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR also closes #1087; please edit the description to reflect this.

Code looks overall good, but I'll dig in and complete my review tomorrow. Thanks for the contributions!

Copy link
Copy Markdown
Member

@kennethloeffler kennethloeffler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some nits, looking good!

@Ivanmatthew
Copy link
Copy Markdown
Contributor Author

Anything still required to get this merged? @kennethloeffler

Copy link
Copy Markdown
Member

@Dekkonot Dekkonot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me. I let a nitpick but it's more just a note for you in the future rather than a blocker for this being merged.

I'm able to verify that it works locally, and the test seems fine to me.

Comment on lines +322 to +323
assert_eq!(fs_err::canonicalize(path).is_ok(), true, "path was not valid");
assert_eq!(Path::new(path).is_absolute(), true, "path was not absolute");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: Why not just use assert! here?

@Dekkonot Dekkonot merged commit a2adf2b into rojo-rbx:master Feb 13, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed to create relative paths for project file Add tests for sourcemap command

4 participants