@socketsecurity/cli-with-sentry 0.14.47 → 0.14.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants.js +2 -2
- package/dist/constants.js.map +1 -1
- package/dist/instrument-with-sentry.js +2 -2
- package/dist/instrument-with-sentry.js.map +1 -1
- package/dist/module-sync/cli.js +4 -4
- package/dist/module-sync/cli.js.map +1 -1
- package/dist/module-sync/edge.d.ts +0 -1
- package/dist/module-sync/index.d.ts +5 -5
- package/dist/module-sync/index.js +114 -131
- package/dist/module-sync/index.js.map +1 -1
- package/dist/module-sync/node.d.ts +5 -3
- package/dist/module-sync/npm-injection.js +2 -2
- package/dist/module-sync/npm-injection.js.map +1 -1
- package/dist/require/cli.js +4 -4
- package/dist/require/cli.js.map +1 -1
- package/package.json +1 -1
|
@@ -41,7 +41,6 @@ declare const Edge: EdgeClass;
|
|
|
41
41
|
declare class SafeEdge extends Edge {
|
|
42
42
|
#private;
|
|
43
43
|
constructor(options: EdgeOptions);
|
|
44
|
-
get accept(): string | undefined;
|
|
45
44
|
get bundled(): boolean;
|
|
46
45
|
get error(): "DETACHED" | "MISSING" | "PEER LOCAL" | "INVALID" | null;
|
|
47
46
|
get from(): SafeNode | null;
|
|
@@ -31,21 +31,21 @@ interface OverrideSetClass {
|
|
|
31
31
|
isEqual(otherOverrideSet: SafeOverrideSet | undefined): boolean;
|
|
32
32
|
}
|
|
33
33
|
declare const OverrideSet: OverrideSetClass;
|
|
34
|
-
// Implementation code not related to patch https://github.com/npm/cli/pull/
|
|
34
|
+
// Implementation code not related to patch https://github.com/npm/cli/pull/8089
|
|
35
35
|
// is based on https://github.com/npm/cli/blob/v11.0.0/workspaces/arborist/lib/override-set.js:
|
|
36
36
|
declare class SafeOverrideSet extends OverrideSet {
|
|
37
37
|
// Patch adding doOverrideSetsConflict is based on
|
|
38
|
-
// https://github.com/npm/cli/pull/
|
|
38
|
+
// https://github.com/npm/cli/pull/8089.
|
|
39
39
|
static doOverrideSetsConflict(first: SafeOverrideSet | undefined, second: SafeOverrideSet | undefined): boolean;
|
|
40
40
|
// Patch adding findSpecificOverrideSet is based on
|
|
41
|
-
// https://github.com/npm/cli/pull/
|
|
41
|
+
// https://github.com/npm/cli/pull/8089.
|
|
42
42
|
static findSpecificOverrideSet(first: SafeOverrideSet | undefined, second: SafeOverrideSet | undefined): SafeOverrideSet | undefined;
|
|
43
43
|
// Patch adding childrenAreEqual is based on
|
|
44
|
-
// https://github.com/npm/cli/pull/
|
|
44
|
+
// https://github.com/npm/cli/pull/8089.
|
|
45
45
|
childrenAreEqual(otherOverrideSet: SafeOverrideSet): boolean;
|
|
46
46
|
getEdgeRule(edge: SafeEdge): SafeOverrideSet;
|
|
47
47
|
// Patch adding isEqual is based on
|
|
48
|
-
// https://github.com/npm/cli/pull/
|
|
48
|
+
// https://github.com/npm/cli/pull/8089.
|
|
49
49
|
isEqual(otherOverrideSet: SafeOverrideSet | undefined): boolean;
|
|
50
50
|
}
|
|
51
51
|
declare const depValid: (child: SafeNode, requested: string, accept: string | undefined, requester: SafeNode) => boolean;
|
|
@@ -270,7 +270,7 @@ async function setupSdk(apiToken = getDefaultToken(), apiBaseUrl = getDefaultApi
|
|
|
270
270
|
}
|
|
271
271
|
|
|
272
272
|
const {
|
|
273
|
-
LOOP_SENTINEL: LOOP_SENTINEL$
|
|
273
|
+
LOOP_SENTINEL: LOOP_SENTINEL$1,
|
|
274
274
|
NPM_REGISTRY_URL: NPM_REGISTRY_URL$1
|
|
275
275
|
} = constants;
|
|
276
276
|
function getUrlOrigin(input) {
|
|
@@ -298,7 +298,7 @@ function getPackagesToQueryFromDiff(diff_, options) {
|
|
|
298
298
|
length: queueLength
|
|
299
299
|
} = queue;
|
|
300
300
|
while (pos < queueLength) {
|
|
301
|
-
if (pos === LOOP_SENTINEL$
|
|
301
|
+
if (pos === LOOP_SENTINEL$1) {
|
|
302
302
|
throw new Error('Detected infinite loop while walking Arborist diff');
|
|
303
303
|
}
|
|
304
304
|
const diff = queue[pos++];
|
|
@@ -779,39 +779,32 @@ function getLogger() {
|
|
|
779
779
|
return _log;
|
|
780
780
|
}
|
|
781
781
|
|
|
782
|
-
const {
|
|
783
|
-
LOOP_SENTINEL: LOOP_SENTINEL$1
|
|
784
|
-
} = constants;
|
|
785
782
|
const OverrideSet = require(npmPaths.getArboristOverrideSetClassPath());
|
|
786
783
|
|
|
787
|
-
// Implementation code not related to patch https://github.com/npm/cli/pull/
|
|
784
|
+
// Implementation code not related to patch https://github.com/npm/cli/pull/8089
|
|
788
785
|
// is based on https://github.com/npm/cli/blob/v11.0.0/workspaces/arborist/lib/override-set.js:
|
|
789
786
|
class SafeOverrideSet extends OverrideSet {
|
|
790
787
|
// Patch adding doOverrideSetsConflict is based on
|
|
791
|
-
// https://github.com/npm/cli/pull/
|
|
788
|
+
// https://github.com/npm/cli/pull/8089.
|
|
792
789
|
static doOverrideSetsConflict(first, second) {
|
|
793
|
-
// If override sets contain one another then we can try to use the more
|
|
794
|
-
// one.
|
|
795
|
-
// in conflict.
|
|
790
|
+
// If override sets contain one another then we can try to use the more
|
|
791
|
+
// specific one. If neither one is more specific, then we consider them to
|
|
792
|
+
// be in conflict.
|
|
796
793
|
return this.findSpecificOverrideSet(first, second) === undefined;
|
|
797
794
|
}
|
|
798
795
|
|
|
799
796
|
// Patch adding findSpecificOverrideSet is based on
|
|
800
|
-
// https://github.com/npm/cli/pull/
|
|
797
|
+
// https://github.com/npm/cli/pull/8089.
|
|
801
798
|
static findSpecificOverrideSet(first, second) {
|
|
802
|
-
let overrideSet = second;
|
|
803
|
-
while (overrideSet) {
|
|
799
|
+
for (let overrideSet = second; overrideSet; overrideSet = overrideSet.parent) {
|
|
804
800
|
if (overrideSet.isEqual(first)) {
|
|
805
801
|
return second;
|
|
806
802
|
}
|
|
807
|
-
overrideSet = overrideSet.parent;
|
|
808
803
|
}
|
|
809
|
-
overrideSet = first;
|
|
810
|
-
while (overrideSet) {
|
|
804
|
+
for (let overrideSet = first; overrideSet; overrideSet = overrideSet.parent) {
|
|
811
805
|
if (overrideSet.isEqual(second)) {
|
|
812
806
|
return first;
|
|
813
807
|
}
|
|
814
|
-
overrideSet = overrideSet.parent;
|
|
815
808
|
}
|
|
816
809
|
// The override sets are incomparable. Neither one contains the other.
|
|
817
810
|
const log = getLogger();
|
|
@@ -820,40 +813,24 @@ class SafeOverrideSet extends OverrideSet {
|
|
|
820
813
|
}
|
|
821
814
|
|
|
822
815
|
// Patch adding childrenAreEqual is based on
|
|
823
|
-
// https://github.com/npm/cli/pull/
|
|
816
|
+
// https://github.com/npm/cli/pull/8089.
|
|
824
817
|
childrenAreEqual(otherOverrideSet) {
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
818
|
+
if (this.children.size !== otherOverrideSet.children.size) {
|
|
819
|
+
return false;
|
|
820
|
+
}
|
|
821
|
+
for (const {
|
|
822
|
+
0: key,
|
|
823
|
+
1: childOverrideSet
|
|
824
|
+
} of this.children) {
|
|
825
|
+
const otherChildOverrideSet = otherOverrideSet.children.get(key);
|
|
826
|
+
if (!otherChildOverrideSet) {
|
|
827
|
+
return false;
|
|
833
828
|
}
|
|
834
|
-
|
|
835
|
-
0: currSet,
|
|
836
|
-
1: currOtherSet
|
|
837
|
-
} = queue[pos++];
|
|
838
|
-
const {
|
|
839
|
-
children
|
|
840
|
-
} = currSet;
|
|
841
|
-
const {
|
|
842
|
-
children: otherChildren
|
|
843
|
-
} = currOtherSet;
|
|
844
|
-
if (children.size !== otherChildren.size) {
|
|
829
|
+
if (childOverrideSet.value !== otherChildOverrideSet.value) {
|
|
845
830
|
return false;
|
|
846
831
|
}
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
return false;
|
|
850
|
-
}
|
|
851
|
-
const child = children.get(key);
|
|
852
|
-
const otherChild = otherChildren.get(key);
|
|
853
|
-
if (child.value !== otherChild.value) {
|
|
854
|
-
return false;
|
|
855
|
-
}
|
|
856
|
-
queue[queueLength++] = [child, otherChild];
|
|
832
|
+
if (!childOverrideSet.childrenAreEqual(otherChildOverrideSet)) {
|
|
833
|
+
return false;
|
|
857
834
|
}
|
|
858
835
|
}
|
|
859
836
|
return true;
|
|
@@ -869,22 +846,23 @@ class SafeOverrideSet extends OverrideSet {
|
|
|
869
846
|
}
|
|
870
847
|
// Patch replacing
|
|
871
848
|
// let spec = npa(`${edge.name}@${edge.spec}`)
|
|
872
|
-
// is based on https://github.com/npm/cli/pull/
|
|
849
|
+
// is based on https://github.com/npm/cli/pull/8089.
|
|
873
850
|
//
|
|
874
851
|
// We need to use the rawSpec here, because the spec has the overrides
|
|
875
|
-
// applied to it already.
|
|
876
|
-
|
|
852
|
+
// applied to it already. The rawSpec can be undefined, so we need to use
|
|
853
|
+
// the fallback value of spec if it is.
|
|
854
|
+
let spec = npa(`${edge.name}@${edge.rawSpec || edge.spec}`);
|
|
877
855
|
if (spec.type === 'alias') {
|
|
878
856
|
spec = spec.subSpec;
|
|
879
857
|
}
|
|
880
858
|
if (spec.type === 'git') {
|
|
881
|
-
if (spec.gitRange &&
|
|
859
|
+
if (spec.gitRange && semver.intersects(spec.gitRange, rule.keySpec)) {
|
|
882
860
|
return rule;
|
|
883
861
|
}
|
|
884
862
|
continue;
|
|
885
863
|
}
|
|
886
864
|
if (spec.type === 'range' || spec.type === 'version') {
|
|
887
|
-
if (
|
|
865
|
+
if (semver.intersects(spec.fetchSpec, rule.keySpec)) {
|
|
888
866
|
return rule;
|
|
889
867
|
}
|
|
890
868
|
continue;
|
|
@@ -898,7 +876,7 @@ class SafeOverrideSet extends OverrideSet {
|
|
|
898
876
|
}
|
|
899
877
|
|
|
900
878
|
// Patch adding isEqual is based on
|
|
901
|
-
// https://github.com/npm/cli/pull/
|
|
879
|
+
// https://github.com/npm/cli/pull/8089.
|
|
902
880
|
isEqual(otherOverrideSet) {
|
|
903
881
|
if (this === otherOverrideSet) {
|
|
904
882
|
return true;
|
|
@@ -921,7 +899,7 @@ class SafeOverrideSet extends OverrideSet {
|
|
|
921
899
|
|
|
922
900
|
const Node = require(npmPaths.getArboristNodeClassPath());
|
|
923
901
|
|
|
924
|
-
// Implementation code not related to patch https://github.com/npm/cli/pull/
|
|
902
|
+
// Implementation code not related to patch https://github.com/npm/cli/pull/8089
|
|
925
903
|
// is based on https://github.com/npm/cli/blob/v11.0.0/workspaces/arborist/lib/node.js:
|
|
926
904
|
class SafeNode extends Node {
|
|
927
905
|
// Return true if it's safe to remove this node, because anything that is
|
|
@@ -957,7 +935,7 @@ class SafeNode extends Node {
|
|
|
957
935
|
// if (preferDedupe || semver.gte(other.version, this.version)) {
|
|
958
936
|
// return true
|
|
959
937
|
// }
|
|
960
|
-
// is based on https://github.com/npm/cli/pull/
|
|
938
|
+
// is based on https://github.com/npm/cli/pull/8089.
|
|
961
939
|
//
|
|
962
940
|
// If we prefer dedupe, or if the version is equal, take the other.
|
|
963
941
|
if (preferDedupe || semver.eq(other.version, this.version)) {
|
|
@@ -988,7 +966,7 @@ class SafeNode extends Node {
|
|
|
988
966
|
// if (node.overrides !== this.overrides) {
|
|
989
967
|
// return false
|
|
990
968
|
// }
|
|
991
|
-
// is based on https://github.com/npm/cli/pull/
|
|
969
|
+
// is based on https://github.com/npm/cli/pull/8089.
|
|
992
970
|
//
|
|
993
971
|
// If this node has no dependencies, then it's irrelevant to check the
|
|
994
972
|
// override rules of the replacement node.
|
|
@@ -1023,7 +1001,7 @@ class SafeNode extends Node {
|
|
|
1023
1001
|
return result;
|
|
1024
1002
|
}
|
|
1025
1003
|
|
|
1026
|
-
// Patch adding deleteEdgeIn is based on https://github.com/npm/cli/pull/
|
|
1004
|
+
// Patch adding deleteEdgeIn is based on https://github.com/npm/cli/pull/8089.
|
|
1027
1005
|
deleteEdgeIn(edge) {
|
|
1028
1006
|
this.edgesIn.delete(edge);
|
|
1029
1007
|
const {
|
|
@@ -1038,7 +1016,7 @@ class SafeNode extends Node {
|
|
|
1038
1016
|
// if (edge.overrides) {
|
|
1039
1017
|
// this.overrides = edge.overrides
|
|
1040
1018
|
// }
|
|
1041
|
-
// is based on https://github.com/npm/cli/pull/
|
|
1019
|
+
// is based on https://github.com/npm/cli/pull/8089.
|
|
1042
1020
|
//
|
|
1043
1021
|
// We need to handle the case where the new edge in has an overrides field
|
|
1044
1022
|
// which is different from the current value.
|
|
@@ -1054,26 +1032,51 @@ class SafeNode extends Node {
|
|
|
1054
1032
|
get overridden() {
|
|
1055
1033
|
// Patch replacing
|
|
1056
1034
|
// return !!(this.overrides && this.overrides.value && this.overrides.name === this.name)
|
|
1057
|
-
// is based on https://github.com/npm/cli/pull/
|
|
1035
|
+
// is based on https://github.com/npm/cli/pull/8089.
|
|
1058
1036
|
if (!this.overrides || !this.overrides.value || this.overrides.name !== this.name) {
|
|
1059
1037
|
return false;
|
|
1060
1038
|
}
|
|
1061
|
-
// The overrides rule is for a package with this name, but some override
|
|
1062
|
-
// only apply to specific versions. To make sure this package was
|
|
1063
|
-
// overridden, we check whether any edge going in had the rule
|
|
1064
|
-
// in which case its overrides set is different than its
|
|
1039
|
+
// The overrides rule is for a package with this name, but some override
|
|
1040
|
+
// rules only apply to specific versions. To make sure this package was
|
|
1041
|
+
// actually overridden, we check whether any edge going in had the rule
|
|
1042
|
+
// applied to it, in which case its overrides set is different than its
|
|
1043
|
+
// source node.
|
|
1065
1044
|
for (const edge of this.edgesIn) {
|
|
1066
1045
|
if (edge.overrides && edge.overrides.name === this.name && edge.overrides.value === this.version) {
|
|
1067
|
-
if (!edge.overrides
|
|
1046
|
+
if (!edge.overrides.isEqual(edge.from?.overrides)) {
|
|
1068
1047
|
return true;
|
|
1069
1048
|
}
|
|
1070
1049
|
}
|
|
1071
1050
|
}
|
|
1072
1051
|
return false;
|
|
1073
1052
|
}
|
|
1053
|
+
set parent(newParent) {
|
|
1054
|
+
// Patch removing
|
|
1055
|
+
// if (parent.overrides) {
|
|
1056
|
+
// this.overrides = parent.overrides.getNodeRule(this)
|
|
1057
|
+
// }
|
|
1058
|
+
// is based on https://github.com/npm/cli/pull/8089.
|
|
1059
|
+
//
|
|
1060
|
+
// The "parent" setter is a really large and complex function. To satisfy
|
|
1061
|
+
// the patch we hold on to the old overrides value and set `this.overrides`
|
|
1062
|
+
// to `undefined` so that the condition we want to remove is not hit.
|
|
1063
|
+
const {
|
|
1064
|
+
overrides
|
|
1065
|
+
} = this;
|
|
1066
|
+
if (overrides) {
|
|
1067
|
+
this.overrides = undefined;
|
|
1068
|
+
}
|
|
1069
|
+
try {
|
|
1070
|
+
super.parent = newParent;
|
|
1071
|
+
this.overrides = overrides;
|
|
1072
|
+
} catch (e) {
|
|
1073
|
+
this.overrides = overrides;
|
|
1074
|
+
throw e;
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1074
1077
|
|
|
1075
1078
|
// Patch adding recalculateOutEdgesOverrides is based on
|
|
1076
|
-
// https://github.com/npm/cli/pull/
|
|
1079
|
+
// https://github.com/npm/cli/pull/8089.
|
|
1077
1080
|
recalculateOutEdgesOverrides() {
|
|
1078
1081
|
// For each edge out propagate the new overrides through.
|
|
1079
1082
|
for (const edge of this.edgesOut.values()) {
|
|
@@ -1090,13 +1093,11 @@ class SafeNode extends Node {
|
|
|
1090
1093
|
// if (!this.overrides && this.parent && this.parent.overrides) {
|
|
1091
1094
|
// this.overrides = this.parent.overrides.getNodeRule(this)
|
|
1092
1095
|
// }
|
|
1093
|
-
// is based on https://github.com/npm/cli/pull/
|
|
1096
|
+
// is based on https://github.com/npm/cli/pull/8089.
|
|
1094
1097
|
//
|
|
1095
1098
|
// The "root" setter is a really large and complex function. To satisfy the
|
|
1096
1099
|
// patch we add a dummy value to `this.overrides` so that the condition we
|
|
1097
|
-
// want to remove
|
|
1098
|
-
// if (!this.overrides && this.parent && this.parent.overrides) {
|
|
1099
|
-
// , is not hit.
|
|
1100
|
+
// want to remove is not hit.
|
|
1100
1101
|
if (!this.overrides) {
|
|
1101
1102
|
this.overrides = new SafeOverrideSet({
|
|
1102
1103
|
overrides: ''
|
|
@@ -1197,7 +1198,7 @@ const Edge = require(npmPaths.getArboristEdgeClassPath());
|
|
|
1197
1198
|
// The Edge class makes heavy use of private properties which subclasses do NOT
|
|
1198
1199
|
// have access to. So we have to recreate any functionality that relies on those
|
|
1199
1200
|
// private properties and use our own "safe" prefixed non-conflicting private
|
|
1200
|
-
// properties. Implementation code not related to patch https://github.com/npm/cli/pull/
|
|
1201
|
+
// properties. Implementation code not related to patch https://github.com/npm/cli/pull/8089
|
|
1201
1202
|
// is based on https://github.com/npm/cli/blob/v11.0.0/workspaces/arborist/lib/edge.js.
|
|
1202
1203
|
//
|
|
1203
1204
|
// The npm application
|
|
@@ -1206,39 +1207,26 @@ const Edge = require(npmPaths.getArboristEdgeClassPath());
|
|
|
1206
1207
|
//
|
|
1207
1208
|
// An edge in the dependency graph.
|
|
1208
1209
|
// Represents a dependency relationship of some kind.
|
|
1209
|
-
const initializedSafeEdges = new WeakSet();
|
|
1210
1210
|
class SafeEdge extends Edge {
|
|
1211
|
-
#safeAccept;
|
|
1212
1211
|
#safeError;
|
|
1213
1212
|
#safeExplanation;
|
|
1214
1213
|
#safeFrom;
|
|
1215
|
-
#safeName;
|
|
1216
1214
|
#safeTo;
|
|
1217
1215
|
constructor(options) {
|
|
1218
1216
|
const {
|
|
1219
|
-
|
|
1220
|
-
from,
|
|
1221
|
-
name
|
|
1217
|
+
from
|
|
1222
1218
|
} = options;
|
|
1223
1219
|
// Defer to supper to validate options and assign non-private values.
|
|
1224
1220
|
super(options);
|
|
1225
|
-
if (accept !== undefined) {
|
|
1226
|
-
this.#safeAccept = accept || '*';
|
|
1227
|
-
}
|
|
1228
1221
|
if (from.constructor !== SafeNode) {
|
|
1229
1222
|
Reflect.setPrototypeOf(from, SafeNode.prototype);
|
|
1230
1223
|
}
|
|
1231
1224
|
this.#safeError = null;
|
|
1232
1225
|
this.#safeExplanation = null;
|
|
1233
1226
|
this.#safeFrom = from;
|
|
1234
|
-
this.#safeName = name;
|
|
1235
1227
|
this.#safeTo = null;
|
|
1236
|
-
initializedSafeEdges.add(this);
|
|
1237
1228
|
this.reload(true);
|
|
1238
1229
|
}
|
|
1239
|
-
get accept() {
|
|
1240
|
-
return this.#safeAccept;
|
|
1241
|
-
}
|
|
1242
1230
|
get bundled() {
|
|
1243
1231
|
return !!this.#safeFrom?.package?.bundleDependencies?.includes(this.name);
|
|
1244
1232
|
}
|
|
@@ -1250,13 +1238,16 @@ class SafeEdge extends Edge {
|
|
|
1250
1238
|
} else {
|
|
1251
1239
|
this.#safeError = 'MISSING';
|
|
1252
1240
|
}
|
|
1253
|
-
} else if (this.peer && this.#safeFrom === this.#safeTo.parent &&
|
|
1241
|
+
} else if (this.peer && this.#safeFrom === this.#safeTo.parent &&
|
|
1242
|
+
// Patch adding "?." use based on
|
|
1243
|
+
// https://github.com/npm/cli/pull/8089.
|
|
1244
|
+
!this.#safeFrom?.isTop) {
|
|
1254
1245
|
this.#safeError = 'PEER LOCAL';
|
|
1255
1246
|
} else if (!this.satisfiedBy(this.#safeTo)) {
|
|
1256
1247
|
this.#safeError = 'INVALID';
|
|
1257
1248
|
}
|
|
1258
1249
|
// Patch adding "else if" condition is based on
|
|
1259
|
-
// https://github.com/npm/cli/pull/
|
|
1250
|
+
// https://github.com/npm/cli/pull/8089.
|
|
1260
1251
|
else if (this.overrides && this.#safeTo.edgesOut.size && SafeOverrideSet.doOverrideSetsConflict(this.overrides, this.#safeTo.overrides)) {
|
|
1261
1252
|
// Any inconsistency between the edge's override set and the target's
|
|
1262
1253
|
// override set is potentially problematic. But we only say the edge is
|
|
@@ -1282,20 +1273,14 @@ class SafeEdge extends Edge {
|
|
|
1282
1273
|
// @ts-ignore: Incorrectly typed as a property instead of an accessor.
|
|
1283
1274
|
get spec() {
|
|
1284
1275
|
if (this.overrides?.value && this.overrides.value !== '*' && this.overrides.name === this.name) {
|
|
1285
|
-
// Patch adding "if" condition is based on
|
|
1286
|
-
// https://github.com/npm/cli/pull/7025.
|
|
1287
|
-
//
|
|
1288
|
-
// If this edge has the same overrides field as the source, then we're not
|
|
1289
|
-
// applying an override for this edge.
|
|
1290
|
-
if (this.overrides === this.#safeFrom?.overrides) {
|
|
1291
|
-
// The Edge rawSpec getter will retrieve the private Edge #spec property.
|
|
1292
|
-
return this.rawSpec;
|
|
1293
|
-
}
|
|
1294
1276
|
if (this.overrides.value.startsWith('$')) {
|
|
1295
1277
|
const ref = this.overrides.value.slice(1);
|
|
1296
1278
|
// We may be a virtual root, if we are we want to resolve reference
|
|
1297
1279
|
// overrides from the real root, not the virtual one.
|
|
1298
|
-
|
|
1280
|
+
//
|
|
1281
|
+
// Patch adding "?." use based on
|
|
1282
|
+
// https://github.com/npm/cli/pull/8089.
|
|
1283
|
+
const pkg = this.#safeFrom?.sourceReference ? this.#safeFrom?.sourceReference.root.package : this.#safeFrom?.root?.package;
|
|
1299
1284
|
if (pkg?.devDependencies?.[ref]) {
|
|
1300
1285
|
return pkg.devDependencies[ref];
|
|
1301
1286
|
}
|
|
@@ -1322,10 +1307,11 @@ class SafeEdge extends Edge {
|
|
|
1322
1307
|
detach() {
|
|
1323
1308
|
this.#safeExplanation = null;
|
|
1324
1309
|
// Patch replacing
|
|
1325
|
-
// if (this.#
|
|
1326
|
-
// this.#
|
|
1310
|
+
// if (this.#to) {
|
|
1311
|
+
// this.#to.edgesIn.delete(this)
|
|
1327
1312
|
// }
|
|
1328
|
-
//
|
|
1313
|
+
// this.#from.edgesOut.delete(this.#name)
|
|
1314
|
+
// is based on https://github.com/npm/cli/pull/8089.
|
|
1329
1315
|
this.#safeTo?.deleteEdgeIn(this);
|
|
1330
1316
|
this.#safeFrom?.edgesOut.delete(this.name);
|
|
1331
1317
|
this.#safeTo = null;
|
|
@@ -1365,38 +1351,34 @@ class SafeEdge extends Edge {
|
|
|
1365
1351
|
return this.#safeExplanation;
|
|
1366
1352
|
}
|
|
1367
1353
|
reload(hard = false) {
|
|
1368
|
-
if (!initializedSafeEdges.has(this)) {
|
|
1369
|
-
// Skip if called during super constructor.
|
|
1370
|
-
return;
|
|
1371
|
-
}
|
|
1372
1354
|
this.#safeExplanation = null;
|
|
1373
|
-
// Patch
|
|
1374
|
-
//
|
|
1355
|
+
// Patch replacing
|
|
1356
|
+
// if (this.#from.overrides) {
|
|
1357
|
+
// is based on https://github.com/npm/cli/pull/8089.
|
|
1358
|
+
let needToUpdateOverrideSet = false;
|
|
1375
1359
|
let newOverrideSet;
|
|
1376
1360
|
let oldOverrideSet;
|
|
1377
1361
|
if (this.#safeFrom?.overrides) {
|
|
1378
|
-
|
|
1379
|
-
// this.overrides = this.#safeFrom.overrides.getEdgeRule(this)
|
|
1380
|
-
// is based on https://github.com/npm/cli/pull/7025.
|
|
1381
|
-
const newOverrideSet = this.#safeFrom.overrides.getEdgeRule(this);
|
|
1362
|
+
newOverrideSet = this.#safeFrom.overrides.getEdgeRule(this);
|
|
1382
1363
|
if (newOverrideSet && !newOverrideSet.isEqual(this.overrides)) {
|
|
1383
1364
|
// If there's a new different override set we need to propagate it to
|
|
1384
1365
|
// the nodes. If we're deleting the override set then there's no point
|
|
1385
1366
|
// propagating it right now since it will be filled with another value
|
|
1386
1367
|
// later.
|
|
1368
|
+
needToUpdateOverrideSet = true;
|
|
1387
1369
|
oldOverrideSet = this.overrides;
|
|
1388
1370
|
this.overrides = newOverrideSet;
|
|
1389
1371
|
}
|
|
1390
1372
|
} else {
|
|
1391
1373
|
this.overrides = undefined;
|
|
1392
1374
|
}
|
|
1375
|
+
// Patch adding "?." use based on
|
|
1376
|
+
// https://github.com/npm/cli/pull/8089.
|
|
1393
1377
|
const newTo = this.#safeFrom?.resolve(this.name);
|
|
1394
1378
|
if (newTo !== this.#safeTo) {
|
|
1395
1379
|
// Patch replacing
|
|
1396
|
-
//
|
|
1397
|
-
//
|
|
1398
|
-
// }
|
|
1399
|
-
// is based on https://github.com/npm/cli/pull/7025.
|
|
1380
|
+
// this.#to.edgesIn.delete(this)
|
|
1381
|
+
// is based on https://github.com/npm/cli/pull/8089.
|
|
1400
1382
|
this.#safeTo?.deleteEdgeIn(this);
|
|
1401
1383
|
this.#safeTo = newTo ?? null;
|
|
1402
1384
|
this.#safeError = null;
|
|
@@ -1405,8 +1387,8 @@ class SafeEdge extends Edge {
|
|
|
1405
1387
|
this.#safeError = null;
|
|
1406
1388
|
}
|
|
1407
1389
|
// Patch adding "else if" condition based on
|
|
1408
|
-
// https://github.com/npm/cli/pull/
|
|
1409
|
-
else if (
|
|
1390
|
+
// https://github.com/npm/cli/pull/8089.
|
|
1391
|
+
else if (needToUpdateOverrideSet && this.#safeTo) {
|
|
1410
1392
|
// Propagate the new override set to the target node.
|
|
1411
1393
|
this.#safeTo.updateOverridesEdgeInRemoved(oldOverrideSet);
|
|
1412
1394
|
this.#safeTo.updateOverridesEdgeInAdded(newOverrideSet);
|
|
@@ -1417,42 +1399,43 @@ class SafeEdge extends Edge {
|
|
|
1417
1399
|
// if (node.name !== this.#name) {
|
|
1418
1400
|
// return false
|
|
1419
1401
|
// }
|
|
1420
|
-
// is based on https://github.com/npm/cli/pull/
|
|
1421
|
-
if (node.name !== this
|
|
1402
|
+
// is based on https://github.com/npm/cli/pull/8089.
|
|
1403
|
+
if (node.name !== this.name || !this.#safeFrom) {
|
|
1422
1404
|
return false;
|
|
1423
1405
|
}
|
|
1424
1406
|
// NOTE: this condition means we explicitly do not support overriding
|
|
1425
1407
|
// bundled or shrinkwrapped dependencies
|
|
1426
1408
|
if (node.hasShrinkwrap || node.inShrinkwrap || node.inBundle) {
|
|
1427
|
-
return depValid(node, this.rawSpec, this
|
|
1409
|
+
return depValid(node, this.rawSpec, this.accept, this.#safeFrom);
|
|
1428
1410
|
}
|
|
1429
1411
|
// Patch replacing
|
|
1430
1412
|
// return depValid(node, this.spec, this.#accept, this.#from)
|
|
1431
|
-
// is based on https://github.com/npm/cli/pull/
|
|
1413
|
+
// is based on https://github.com/npm/cli/pull/8089.
|
|
1432
1414
|
//
|
|
1433
1415
|
// If there's no override we just use the spec.
|
|
1434
1416
|
if (!this.overrides?.keySpec) {
|
|
1435
|
-
return depValid(node, this.spec, this
|
|
1417
|
+
return depValid(node, this.spec, this.accept, this.#safeFrom);
|
|
1436
1418
|
}
|
|
1437
1419
|
// There's some override. If the target node satisfies the overriding spec
|
|
1438
1420
|
// then it's okay.
|
|
1439
|
-
if (depValid(node, this.spec, this
|
|
1421
|
+
if (depValid(node, this.spec, this.accept, this.#safeFrom)) {
|
|
1440
1422
|
return true;
|
|
1441
1423
|
}
|
|
1442
1424
|
// If it doesn't, then it should at least satisfy the original spec.
|
|
1443
|
-
if (!depValid(node, this.rawSpec, this
|
|
1425
|
+
if (!depValid(node, this.rawSpec, this.accept, this.#safeFrom)) {
|
|
1444
1426
|
return false;
|
|
1445
1427
|
}
|
|
1446
1428
|
// It satisfies the original spec, not the overriding spec. We need to make
|
|
1447
1429
|
// sure it doesn't use the overridden spec.
|
|
1448
|
-
// For example
|
|
1449
|
-
//
|
|
1450
|
-
//
|
|
1451
|
-
//
|
|
1452
|
-
//
|
|
1453
|
-
//
|
|
1454
|
-
//
|
|
1455
|
-
|
|
1430
|
+
// For example:
|
|
1431
|
+
// we might have an ^8.0.0 rawSpec, and an override that makes
|
|
1432
|
+
// keySpec=8.23.0 and the override value spec=9.0.0.
|
|
1433
|
+
// If the node is 9.0.0, then it's okay because it's consistent with spec.
|
|
1434
|
+
// If the node is 8.24.0, then it's okay because it's consistent with the rawSpec.
|
|
1435
|
+
// If the node is 8.23.0, then it's not okay because even though it's consistent
|
|
1436
|
+
// with the rawSpec, it's also consistent with the keySpec.
|
|
1437
|
+
// So we're looking for ^8.0.0 or 9.0.0 and not 8.23.0.
|
|
1438
|
+
return !depValid(node, this.overrides.keySpec, this.accept, this.#safeFrom);
|
|
1456
1439
|
}
|
|
1457
1440
|
}
|
|
1458
1441
|
|
|
@@ -1875,5 +1858,5 @@ exports.safeReadFile = safeReadFile;
|
|
|
1875
1858
|
exports.setupSdk = setupSdk;
|
|
1876
1859
|
exports.updateNode = updateNode;
|
|
1877
1860
|
exports.updateSetting = updateSetting;
|
|
1878
|
-
//# debugId=
|
|
1861
|
+
//# debugId=ef8c61fe-d663-4083-9f0b-171ef78dda81
|
|
1879
1862
|
//# sourceMappingURL=index.js.map
|