Skip to content

Commit 832bcb6

Browse files
committed
Fixes regexp
1 parent 5b7b86c commit 832bcb6

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pnp"
3-
version = "0.5.3"
3+
version = "0.5.4"
44
edition = "2021"
55
license = "BSD-2-Clause"
66
description = "Resolution primitives for Yarn PnP"

src/fs.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ pub fn split_zip(p_bytes: &[u8]) -> (&[u8], Option<&[u8]>) {
246246

247247
pub fn split_virtual(p_bytes: &[u8]) -> std::io::Result<(usize, Option<(usize, usize)>)> {
248248
lazy_static! {
249-
static ref VIRTUAL_RE: Regex = Regex::new("(?:^|/)((?:\\$\\$virtual|__virtual__)/[a-f0-9]+/([0-9]+)/)").unwrap();
249+
static ref VIRTUAL_RE: Regex = Regex::new("(?:^|/)((?:\\$\\$virtual|__virtual__)/(?:[^/]+)-[a-f0-9]+/([0-9]+)/)").unwrap();
250250
}
251251

252252
if let Some(m) = VIRTUAL_RE.captures(p_bytes) {
@@ -381,24 +381,24 @@ mod tests {
381381
}],
382382
["/a/b/c/foo.zip", null],
383383
["./a/b/c/foo.zip", null],
384-
["./a/b/__virtual__/abcdef/0/c/d", {
384+
["./a/b/__virtual__/foo-abcdef/0/c/d", {
385385
"basePath": "a/b",
386-
"virtualSegments": ["__virtual__/abcdef/0/c/d", "c/d"],
386+
"virtualSegments": ["__virtual__/foo-abcdef/0/c/d", "c/d"],
387387
"zipPath": null
388388
}],
389-
["./a/b/__virtual__/abcdef/1/c/d", {
389+
["./a/b/__virtual__/foo-abcdef/1/c/d", {
390390
"basePath": "a",
391-
"virtualSegments": ["b/__virtual__/abcdef/1/c/d", "c/d"],
391+
"virtualSegments": ["b/__virtual__/foo-abcdef/1/c/d", "c/d"],
392392
"zipPath": null
393393
}],
394-
["./a/b/__virtual__/abcdef/0/c/foo.zip/bar", {
394+
["./a/b/__virtual__/foo-abcdef/0/c/foo.zip/bar", {
395395
"basePath": "a/b",
396-
"virtualSegments": ["__virtual__/abcdef/0/c/foo.zip", "c/foo.zip"],
396+
"virtualSegments": ["__virtual__/foo-abcdef/0/c/foo.zip", "c/foo.zip"],
397397
"zipPath": "bar"
398398
}],
399-
["./a/b/__virtual__/abcdef/1/c/foo.zip/bar", {
399+
["./a/b/__virtual__/foo-abcdef/1/c/foo.zip/bar", {
400400
"basePath": "a",
401-
"virtualSegments": ["b/__virtual__/abcdef/1/c/foo.zip", "c/foo.zip"],
401+
"virtualSegments": ["b/__virtual__/foo-abcdef/1/c/foo.zip", "c/foo.zip"],
402402
"zipPath": "bar"
403403
}],
404404
["./a/b/c/.zip", null],

0 commit comments

Comments
 (0)