You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 468550f
Browse filesBrowse the repository at this point in the historyBrowse files
Michael Smith
committed
fix: refactor #failureNode, adjust tests and safety
// Pacote also enforces these inside FetcherBase.get() as defense-in-depth, but the symlink branch never reaches pacote, and the manifest cache here would bypass pacote on a cached hit.
654
663
// Throws the same { code: EALLOW${TYPE}} shape pacote uses, so callers and downstream consumers stay consistent.
// Builds a Node representing a spec we failed to load (allow-* gate, network failure, ENOTARGET, etc.) and records it in #loadFailures so #pruneFailedOptional can later decide whether the failure is fatal or silently dropped for optional deps.
687
+
#failureNode (name,parent,error,edge){
688
+
error.requiredBy=edge?.from?.location||'.'
689
+
constn=newNode({
690
+
name,
691
+
parent,
692
+
error,
693
+
installLinks: this.installLinks,
694
+
legacyPeerDeps: this.legacyPeerDeps,
695
+
})
696
+
this.#loadFailures.add(n)
697
+
returnn
698
+
}
699
+
683
700
#queueNamedUpdates (){
684
701
// ignore top nodes, since they are not loaded the same way, and
685
702
// probably have their own project associated with them.
@@ -1291,16 +1308,7 @@ This is a one-time fix-up, please be patient...
1291
1308
try{
1292
1309
this.#checkAllow(spec,edge)
1293
1310
}catch(error){
1294
-
error.requiredBy=edge?.from?.location||'.'
1295
-
constn=newNode({
1296
-
name,
1297
-
parent,
1298
-
error,
1299
-
installLinks: this.installLinks,
1300
-
legacyPeerDeps: this.legacyPeerDeps,
1301
-
})
1302
-
this.#loadFailures.add(n)
1303
-
returnn
1311
+
returnthis.#failureNode(name,parent,error,edge)
1304
1312
}
1305
1313
1306
1314
// pacote will slap integrity on its options, so we have to clone the object so it doesn't get mutated.
@@ -1358,22 +1366,10 @@ This is a one-time fix-up, please be patient...
1358
1366
// spec isn't a directory, and either isn't a workspace or the workspace we have
1359
1367
// doesn't satisfy the edge. try to fetch a manifest and build a node from that.
0 commit comments