Repository navigation
Fix broken relative .flyde imports after file moves - #295
Open
schwankeith wants to merge 2 commits into
Open
schwankeith wants to merge 2 commits into
schwankeith wants to merge 2 commits into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This change ensures that relative imports inside
.flydefiles remain valid after the importing file is moved. The import transformer now resolves relative module specifiers to absolute paths based on the source file location, preventing stale relative paths.Changes Made
importToGlobalTransformerto accept an optionalfileNameand resolve relative import specifiers to absolute paths using Node'spathutilities.transpileFileto pass the current file name to the transformer.Why
When a
.flydefile is moved, its stored relative import paths become incorrect, causing the loader to fail to locate the referenced nodes. By converting these paths to absolute paths at transpile time, the imports stay accurate regardless of file moves.Testing
The existing unit tests for import handling continue to pass, and the new logic has been exercised manually by moving files and confirming that imports resolve correctly.
Impact
No breaking changes for existing code; the transformer now optionally receives a file name (default behavior unchanged for callers that don’t provide it).
Fixes #112
/claim #112
Prepared with an AI-assisted workflow; happy to adjust anything in review.