Repository navigation
Commit 518a84f
* Start fix for #1611
Assisted-by: Claude Code:claude-opus-5-5
* Read .env.yarn when expanding yarnrc variables
Yarn 4 loads the files named by injectEnvironmentFiles (.env.yarn by
default) before it expands ${NAME} in .yarnrc.yml, and a value from
those files wins over an exported variable. socket-patch expanded the
references from its own environment only, so a project that picks its
nodeLinker through .env.yarn was misread: vendored mode refused a
node-modules project as Plug'n'Play, and agent mode missed a live PnP
project, skipping the package as not installed with exit 0.
The linker probe, the yarn pnpm-store gate and the hosted upstream
registry reader now expand with the injected files applied. The file
list follows yarn: YARN_INJECT_ENVIRONMENT_FILES, else the nearest rc
file that sets it (relative to that file), else .env.yarn in the
project; an emptied list loads nothing and a later file wins.
Fixes #1611
Assisted-by: Claude Code:claude-opus-5-5
* Document .env.yarn in the yarn linker rules
Assisted-by: Claude Code:claude-opus-5-5
* Match yarn on .env.yarn values and list parsing
Review follow-ups for the .env.yarn fix:
- Expand ${NAME} inside .env.yarn values as yarn does, against the
values injected so far and then the environment, so a linker set
through a chained variable resolves the way yarn resolves it.
- Read injectEnvironmentFiles through the same YAML walk as every
other setting, so a file yarn refuses (a list root, two documents,
a doubled BOM) sets no list here either.
- Load the env files only when a ${NAME} is actually expanded, and
reuse the same lookup in the hosted registry reader.
Assisted-by: Claude Code:claude-opus-5-5
* Merge injectEnvironmentFiles across rc files
Yarn 4 concatenates the injectEnvironmentFiles list of every rc file
it reads instead of taking the nearest one: the home rc file's
entries load first, then each ancestor's from the farthest to the
nearest, each against its own folder. A nearer [] adds nothing and
clears nothing. Taking only the nearest list could drop a parent's
env file, misreading nodeLinker the same way #1611 did. Checked
against yarn 4.9.1.
Assisted-by: Claude Code:claude-opus-5-5
* Honour onConflict reset in env file lists
Yarn 4 stops merging injectEnvironmentFiles across rc files at a list
written as {onConflict: reset, value: [...]} (kept) or hardReset
(dropped too), and a list given as a string replaces the others
outright. Without that, a nearer reset still let a parent folder's
env file pick nodeLinker. The YAML walk now reads the onConflict
wrapper. Checked against yarn 4.9.1.
Assisted-by: Claude Code:claude-opus-5-5
* Read env file lists the way yarn parses them
Three cases where socket-patch picked a different .env file than
yarn 4, so the nodeLinker it worked out could differ:
- A list given as a string now resolves against the folder yarn runs
in, not the rc file's folder, since yarn's string items carry no
source file.
- ${NAME} in an entry now expands with no variable set: yarn reads
this list before it loads any environment, so only the fallback
applies.
- Comma-split items keep their spaces, as yarn's split does.
Checked against yarn 4.9.1.
Assisted-by: Claude Code:claude-opus-5-5
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 3114a28 commit 518a84f
8 files changed
Lines changed: 831 additions & 21 deletions
File tree
- crates
- socket-patch-cli/tests
- socket-patch-core/src
- crawlers
- formats/yarn
- patch
- redirect/upstream
- vendor
- docs/testing
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1304 | 1304 | | |
1305 | 1305 | | |
1306 | 1306 | | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
1307 | 1369 | | |
1308 | 1370 | | |
1309 | 1371 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1520 | 1520 | | |
1521 | 1521 | | |
1522 | 1522 | | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
1523 | 1568 | | |
1524 | 1569 | | |
1525 | 1570 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
179 | 193 | | |
180 | 194 | | |
181 | 195 | | |
| |||
189 | 203 | | |
190 | 204 | | |
191 | 205 | | |
| 206 | + | |
192 | 207 | | |
193 | 208 | | |
194 | 209 | | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
195 | 258 | | |
196 | 259 | | |
197 | 260 | | |
| |||
202 | 265 | | |
203 | 266 | | |
204 | 267 | | |
| 268 | + | |
205 | 269 | | |
206 | 270 | | |
207 | 271 | | |
208 | | - | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
209 | 283 | | |
210 | 284 | | |
211 | 285 | | |
| |||
274 | 348 | | |
275 | 349 | | |
276 | 350 | | |
277 | | - | |
| 351 | + | |
278 | 352 | | |
279 | 353 | | |
280 | 354 | | |
| |||
708 | 782 | | |
709 | 783 | | |
710 | 784 | | |
| 785 | + | |
711 | 786 | | |
712 | 787 | | |
713 | 788 | | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
714 | 877 | | |
715 | 878 | | |
716 | 879 | | |
| |||
0 commit comments