Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(lockfiles): support Yarn 4 patches #6974

Merged
merged 4 commits into from
Jan 10, 2024
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# This file is generated by running "yarn install" inside your project.
# Manual changes might be lost - proceed with caution!

__metadata:
version: 8
cacheKey: 10

"a@workspace:packages/a":
version: 0.0.0-use.local
resolution: "a@workspace:packages/a"
dependencies:
is-odd: "patch:is-odd@npm%3A3.0.1#~/.yarn/patches/is-odd-npm-3.0.1-93c3c3f41b.patch"
languageName: unknown
linkType: soft

"b@workspace:packages/b":
version: 0.0.0-use.local
resolution: "b@workspace:packages/b"
dependencies:
is-even: "npm:^1.0.0"
languageName: unknown
linkType: soft

"is-even@npm:^1.0.0":
version: 1.0.0
resolution: "is-even@npm:1.0.0"
dependencies:
is-odd: "npm:^0.1.2"
checksum: 0267545d7cb6724aee249e88942cf22f6263aa006cd9bf83c2ddbb2a1d47280e8c4d72b2d50e38bd3575df717c993904b44153cc1772a55dabca250ca40cc4f7
languageName: node
linkType: hard

"is-number@npm:^3.0.0":
version: 3.0.0
resolution: "is-number@npm:3.0.0"
checksum: 0c62bf8e9d72c4dd203a74d8cfc751c746e75513380fef420cda8237e619a988ee43e678ddb23c87ac24d91ac0fe9f22e4ffb1301a50310c697e9d73ca3994e9
languageName: node
linkType: hard

"is-number@npm:^6.0.0":
version: 6.0.0
resolution: "is-number@npm:6.0.0"
checksum: 8668b49747649ee0878e0a6d9e35e1c95bab58c5dd1a2b698df34989512ec553cfd090fa7af247d590afe4b12ec996e735b9a670c2cf0efbaefe7fb2c2457615
languageName: node
linkType: hard

"is-odd@npm:3.0.1":
version: 3.0.1
resolution: "is-odd@npm:3.0.1"
dependencies:
is-number: "npm:^6.0.0"
checksum: c9d35c336c0c0ada0bfaf1f4564f354a222c4ffb9c3b42fac353767c9b8f0af844d3ddf16fbf7b12d6ecf57ee4d2fbeb9e456e8c9d68a78bb44e91bb43fdfd56
languageName: node
linkType: hard

"is-odd@npm:^0.1.2":
version: 0.1.2
resolution: "is-odd@npm:0.1.2"
dependencies:
is-number: "npm:^3.0.0"
checksum: 146069d7622c991c75c17ca63bccf5470cd730c24082874e53e797a10ff38a896197d6ce34ad137a2f422dcc614b10ff24d31fe93dcdb29f0cb758f2d924f477
languageName: node
linkType: hard

"is-odd@patch:is-odd@npm%3A3.0.1#~/.yarn/patches/is-odd-npm-3.0.1-93c3c3f41b.patch":
version: 3.0.1
resolution: "is-odd@patch:is-odd@npm%3A3.0.1#~/.yarn/patches/is-odd-npm-3.0.1-93c3c3f41b.patch::version=3.0.1&hash=496de7"
dependencies:
is-number: "npm:^6.0.0"
checksum: 8da62f4b41d59d4c15e90b7dc619b1312668421b982908c3792324bb0622128c1b8d484b96ccd15c05eab50dcdef64c169686c2dba92b925914c4c85ce4300f9
languageName: node
linkType: hard

"small-yarn4@workspace:.":
version: 0.0.0-use.local
resolution: "small-yarn4@workspace:."
languageName: unknown
linkType: soft
60 changes: 60 additions & 0 deletions crates/turborepo-lockfiles/fixtures/yarn4-patch.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# This file is generated by running "yarn install" inside your project.
# Manual changes might be lost - proceed with caution!

__metadata:
version: 8
cacheKey: 10c0

"a@workspace:packages/a":
version: 0.0.0-use.local
resolution: "a@workspace:packages/a"
dependencies:
c: "workspace:*"
languageName: unknown
linkType: soft

"b@workspace:packages/b":
version: 0.0.0-use.local
resolution: "b@workspace:packages/b"
dependencies:
c: "workspace:*"
is-odd: "patch:is-odd@npm%3A3.0.1#~/.yarn/patches/is-odd-npm-3.0.1-93c3c3f41b.patch"
languageName: unknown
linkType: soft

"c@workspace:*, c@workspace:packages/c":
version: 0.0.0-use.local
resolution: "c@workspace:packages/c"
languageName: unknown
linkType: soft

"is-number@npm:^6.0.0":
version: 6.0.0
resolution: "is-number@npm:6.0.0"
checksum: 5da4c68401529675c575878d2760d66f18eaef4b014858577f6003daf66488d7fe4eae684b1e8574e3fa1bb447c6c6c56b8491d2b4b3239da2d32e5f6f218008
languageName: node
linkType: hard

"is-odd@npm:3.0.1":
version: 3.0.1
resolution: "is-odd@npm:3.0.1"
dependencies:
is-number: "npm:^6.0.0"
checksum: 89ee2e353c5a3f3bd400c79db1c307a5b3506198ee8169d521e533a9b1d8a08fc95f21a919c084e98845b4286d7ffe309778da03744dfe66c3c1763ab1a030c6
languageName: node
linkType: hard

"is-odd@patch:is-odd@npm%3A3.0.1#~/.yarn/patches/is-odd-npm-3.0.1-93c3c3f41b.patch":
version: 3.0.1
resolution: "is-odd@patch:is-odd@npm%3A3.0.1#~/.yarn/patches/is-odd-npm-3.0.1-93c3c3f41b.patch::version=3.0.1&hash=9b90ad"
dependencies:
is-number: "npm:^6.0.0"
checksum: 4cd944e688e02e147969d6c1784bad1156f6084edbbd4d688f6a37b5fc764671aa99679494fc0bfaf623919bea2779e724fffc31c6ee0432b7c91f174526e5fe
languageName: node
linkType: hard

"yarn4-patch@workspace:.":
version: 0.0.0-use.local
resolution: "yarn4-patch@workspace:."
languageName: unknown
linkType: soft
7 changes: 5 additions & 2 deletions crates/turborepo-lockfiles/src/berry/identifiers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn multikey() -> &'static Regex {

fn builtin() -> &'static Regex {
static RE: OnceLock<Regex> = OnceLock::new();
RE.get_or_init(|| Regex::new(r"^builtin<([^>]+)>$").unwrap())
RE.get_or_init(|| Regex::new(r"^(?:optional!)?builtin<([^>]+)>$").unwrap())
}

#[derive(Debug, Error)]
Expand Down Expand Up @@ -243,7 +243,10 @@ impl<'a> Locator<'a> {
.and_then(|caps| caps.get(2))
.map(|m| {
let s = m.as_str();
s.strip_prefix("./").unwrap_or(s)
s.strip_prefix("./")
// Yarn 4 uses ~ to indicate the yarn root
.or_else(|| s.strip_prefix("~/"))
.unwrap_or(s)
})
}

Expand Down
Loading
Loading