Skip to content

Commit 6148788

Browse files
committed
test: debug4 upload pnpn.cjs
1 parent 892354d commit 6148788

2 files changed

Lines changed: 23 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: CI
33
on:
44
workflow_dispatch:
55
pull_request:
6-
types: [opened, synchronize]
6+
types: [ opened, synchronize ]
77
paths-ignore:
88
- '**/*.md'
99
- '!.github/workflows/ci.yml'
@@ -42,4 +42,12 @@ jobs:
4242
with:
4343
cache-key: warm
4444
- run: find fixtures/pnp
45+
- uses: actions/upload-artifact@v4
46+
name: pnp.cjs upload
47+
with:
48+
name: pnp-${{ matrix.os }}.cjs
49+
path: |
50+
./fixtures/pnp/.pnp.cjs
51+
if-no-files-found: error
52+
include-hidden-files: true
4553
- run: cargo test --all-features pnp -- --nocapture

src/lib.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ use crate::{
9595
tsconfig::{ProjectReference, TsConfig},
9696
};
9797
use futures::future::{try_join_all, BoxFuture};
98+
use pnp::{Error, Manifest};
9899

99100
type ResolveResult = Result<Option<CachedPath>, ResolveError>;
100101

@@ -825,15 +826,21 @@ impl<Fs: FileSystem + Send + Sync> ResolverGeneric<Fs> {
825826
println!("find_pnp_manifest: failed");
826827
}
827828

828-
829829
let cache_key = cached_manifest_path.as_ref().unwrap_or(cached_path);
830830

831831
println!("the cache key is {:?}", cache_key.path());
832832

833-
let entry = self
834-
.pnp_manifest_content_cache
835-
.entry(cache_key.clone())
836-
.or_insert_with(|| pnp::load_pnp_manifest(cache_key.path()).ok());
833+
let entry = self.pnp_manifest_content_cache.entry(cache_key.clone()).or_insert_with(|| {
834+
let x = pnp::load_pnp_manifest(cache_key.path());
835+
836+
match x {
837+
Ok(m) => Some(m),
838+
Err(e) => {
839+
println!("load manfiest with error {:?}", e);
840+
None
841+
}
842+
}
843+
});
837844
if entry.is_none() {
838845
println!("load pnpm manifest: failed");
839846
}
@@ -856,7 +863,7 @@ impl<Fs: FileSystem + Send + Sync> ResolverGeneric<Fs> {
856863
// `resolve_to_unqualified` requires a trailing slash
857864
let mut path = cached_path.to_path_buf();
858865

859-
dbg!(&path);
866+
dbg!(&path);
860867

861868
path.push("");
862869

@@ -896,7 +903,7 @@ impl<Fs: FileSystem + Send + Sync> ResolverGeneric<Fs> {
896903
Err(_) => Err(ResolveError::NotFound(specifier.to_string())),
897904
}
898905
} else {
899-
println!("try load pnp_manifest:failed");
906+
println!("try load pnp_manifest:failed");
900907

901908
Ok(None)
902909
}

0 commit comments

Comments
 (0)