Skip to content

Commit

Permalink
Remove special handling of paths containing .zip/
Browse files Browse the repository at this point in the history
Summary:
Removing special handling of paths containing `.zip/` - this was a remnant of partially-implemented early Yarn PnP support.

Changelog:
```
**[Fix]**: Remove special handling of paths containing `.zip/`
```

Reviewed By: huntie

Differential Revision: D52629595

fbshipit-source-id: 0714fd0db6bb7df01016ad8738d3019b78d4bf02
  • Loading branch information
robhogan authored and facebook-github-bot committed Jan 10, 2024
1 parent 139f58c commit 9212156
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions packages/metro/src/node-haste/DependencyGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,14 +248,6 @@ class DependencyGraph extends EventEmitter {
}

getSha1(filename: string): string {
// TODO If it looks like we're trying to get the sha1 from a file located
// within a Zip archive, then we instead compute the sha1 for what looks
// like the Zip archive itself.

const splitIndex = filename.indexOf('.zip/');
const containerName =
splitIndex !== -1 ? filename.slice(0, splitIndex + 4) : filename;

// Prior to unstable_enableSymlinks:
// Calling realpath allows us to get a hash for a given path even when
// it's a symlink to a file, which prevents Metro from crashing in such a
Expand All @@ -266,8 +258,8 @@ class DependencyGraph extends EventEmitter {
//
// This is unnecessary with a symlink-aware fileSystem implementation.
const resolvedPath = this._config.resolver.unstable_enableSymlinks
? containerName
: fs.realpathSync(containerName);
? filename
: fs.realpathSync(filename);

const sha1 = this._fileSystem.getSha1(resolvedPath);

Expand Down

0 comments on commit 9212156

Please sign in to comment.