Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/metro-file-map/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export type {
// This should be bumped whenever a code change to `metro-file-map` itself
// would cause a change to the cache data structure and/or content (for a given
// filesystem state and build parameters).
const CACHE_BREAKER = '13';
const CACHE_BREAKER = '14';

const CHANGE_INTERVAL = 30;

Expand Down
6 changes: 5 additions & 1 deletion packages/metro-file-map/src/lib/RootPathUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,11 @@ export class RootPathUtils {
// so resolve with node:path. This runs once per symlink, when its node is
// populated, not on traversal.
const normal = this.absoluteToNormal(
path.resolve(this.#rootDir, symlinkNormalPath, '..', readlinkResult),
path.resolve(
this.normalToAbsolute(symlinkNormalPath),
Comment thread
robhogan marked this conversation as resolved.
Resolved
'..',
readlinkResult,
),
);
// Normalization keeps a trailing separator when the result is the root or
// an ancestor of it (e.g. a link to '/'), and readlink itself may return
Expand Down
17 changes: 17 additions & 0 deletions packages/metro-file-map/src/lib/__tests__/RootPathUtils-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,23 @@ describe.each([['win32'], ['posix']])('RootPathUtils on %s', platform => {
).toEqual(expected);
},
);

test.each([
['..\\..\\..\\D:\\store\\a\\link', '..\\b', '..\\..\\..\\D:\\store\\b'],
[
'..\\..\\..\\D:\\store\\.bun\\rn@1\\node_modules\\invariant',
'..\\..\\invariant@2\\node_modules\\invariant',
'..\\..\\..\\D:\\store\\.bun\\invariant@2\\node_modules\\invariant',
],
['..\\..\\..\\D:\\link', 'target', '..\\..\\..\\D:\\target'],
])(
'resolves relative target of cross-drive symlink (%s -> %s) to %s',
(symlinkPath, readlinkResult, expected) => {
expect(
pathUtils.resolveSymlinkToNormal(symlinkPath, readlinkResult),
).toEqual(expected);
},
);
}
});
});
Loading