Skip to content

Commit b5ce433

Browse files
stormslowlyCopilot
andauthored
feat(pnp)!: support yarn PnP global cache (#174)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 80a8924 commit b5ce433

File tree

13 files changed

+258
-77
lines changed

13 files changed

+258
-77
lines changed

.github/actions/pnpm/action.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Pnpm
22

3-
description: Install pnpm
3+
description: Set up pnpm and install dependencies (including yarn fixture installs)
44

55
inputs:
66
node-version:
@@ -35,6 +35,8 @@ runs:
3535
run: |
3636
cd fixtures/pnp
3737
yarn install
38+
cd ../pnp-global-cache-enabled
39+
yarn install
3840
3941
- name: pnpm
4042
shell: bash

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
fixtures/tsconfig/tsconfig_broken.json
22
fixtures/enhanced_resolve/test/fixtures/incorrect-package/pack1/package.json
3-
pnpm-lock.yaml
3+
pnpm-lock.yaml
4+
**/.pnp.cjs

Cargo.lock

Lines changed: 19 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ thiserror = "2.0.17"
9393

9494
pnp = { version = "0.12.5", optional = true }
9595

96+
arc-swap = { version = "1.8.2", optional = true }
9697
async-trait = "0.1.89"
9798
document-features = { version = "0.2.8", optional = true }
9899
futures = "0.3.31"
@@ -118,7 +119,7 @@ default = ["yarn_pnp"]
118119
## which returns the `package.json` with `serde_json::Value`.
119120
package_json_raw_json_api = []
120121
## [Yarn Plug'n'Play](https://yarnpkg.com/features/pnp)
121-
yarn_pnp = ["pnp"]
122+
yarn_pnp = ["pnp", "arc-swap"]
122123
# For remove tracing calls in release build
123124
enable_instrument = []
124125

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
install-state.gz
2+
.pnp.cjs
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
enableGlobalCache: true
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "pnp",
3+
"packageManager": "yarn@4.3.1",
4+
"dependencies": {
5+
"is-odd": "^1.0.0",
6+
"path-to-regexp": "1.9.0"
7+
}
8+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# This file is generated by running "yarn install" inside your project.
2+
# Manual changes might be lost - proceed with caution!
3+
4+
__metadata:
5+
version: 8
6+
cacheKey: 10c0
7+
8+
"is-buffer@npm:^1.1.5":
9+
version: 1.1.6
10+
resolution: "is-buffer@npm:1.1.6"
11+
checksum: 10c0/ae18aa0b6e113d6c490ad1db5e8df9bdb57758382b313f5a22c9c61084875c6396d50bbf49315f5b1926d142d74dfb8d31b40d993a383e0a158b15fea7a82234
12+
languageName: node
13+
linkType: hard
14+
15+
"is-number@npm:^3.0.0":
16+
version: 3.0.0
17+
resolution: "is-number@npm:3.0.0"
18+
dependencies:
19+
kind-of: "npm:^3.0.2"
20+
checksum: 10c0/e639c54640b7f029623df24d3d103901e322c0c25ea5bde97cd723c2d0d4c05857a8364ab5c58d963089dbed6bf1d0ffe975cb6aef917e2ad0ccbca653d31b4f
21+
languageName: node
22+
linkType: hard
23+
24+
"is-odd@npm:^1.0.0":
25+
version: 1.0.0
26+
resolution: "is-odd@npm:1.0.0"
27+
dependencies:
28+
is-number: "npm:^3.0.0"
29+
checksum: 10c0/4016c9a72931167f447fbc464d6da3b6c08eab7c07d2b264c43331d116f021596615da6255f121bbc29413a7be65c548528610e15a2c8b4e58d11d99b89a5c0d
30+
languageName: node
31+
linkType: hard
32+
33+
"isarray@npm:0.0.1":
34+
version: 0.0.1
35+
resolution: "isarray@npm:0.0.1"
36+
checksum: 10c0/ed1e62da617f71fe348907c71743b5ed550448b455f8d269f89a7c7ddb8ae6e962de3dab6a74a237b06f5eb7f6ece7a45ada8ce96d87fe972926530f91ae3311
37+
languageName: node
38+
linkType: hard
39+
40+
"kind-of@npm:^3.0.2":
41+
version: 3.2.2
42+
resolution: "kind-of@npm:3.2.2"
43+
dependencies:
44+
is-buffer: "npm:^1.1.5"
45+
checksum: 10c0/7e34bc29d4b02c997f92f080de34ebb92033a96736bbb0bb2410e033a7e5ae6571f1fa37b2d7710018f95361473b816c604234197f4f203f9cf149d8ef1574d9
46+
languageName: node
47+
linkType: hard
48+
49+
"path-to-regexp@npm:1.9.0":
50+
version: 1.9.0
51+
resolution: "path-to-regexp@npm:1.9.0"
52+
dependencies:
53+
isarray: "npm:0.0.1"
54+
checksum: 10c0/de9ddb01b84d9c2c8e2bed18630d8d039e2d6f60a6538595750fa08c7a6482512257464c8da50616f266ab2cdd2428387e85f3b089e4c3f25d0c537e898a0751
55+
languageName: node
56+
linkType: hard
57+
58+
"pnp@workspace:.":
59+
version: 0.0.0-use.local
60+
resolution: "pnp@workspace:."
61+
dependencies:
62+
is-odd: "npm:^1.0.0"
63+
path-to-regexp: "npm:1.9.0"
64+
languageName: unknown
65+
linkType: soft

napi/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ impl ResolverFactory {
215215
symlinks: op.symlinks.unwrap_or(default.symlinks),
216216
builtin_modules: op.builtin_modules.unwrap_or(default.builtin_modules),
217217
enable_pnp: op.enable_pnp.unwrap_or_default(),
218-
pnp_manifest: op.pnp_manifest.map(PathBuf::from),
219218
}
220219
}
221220
}

napi/src/options.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,6 @@ pub struct NapiResolveOptions {
157157
///
158158
/// Default `false`
159159
pub enable_pnp: Option<bool>,
160-
161-
/// Path to yarn Plug'n'Play manifest file.
162-
///
163-
/// Default `None`
164-
pub pnp_manifest: Option<String>,
165160
}
166161

167162
#[napi]

0 commit comments

Comments
 (0)