socket 0.14.20 → 0.14.21
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/README.md +2 -1
- package/dist/cli.js +303 -190
- package/dist/npm-cli.js +7 -7
- package/dist/npm-injection.js +224 -117
- package/dist/path-resolve.js +1 -1
- package/package.json +13 -11
package/dist/npm-cli.js
CHANGED
|
@@ -25,24 +25,24 @@ const injectionPath = _nodePath.join(realDirname, 'npm-injection.js');
|
|
|
25
25
|
// Adding the `--quiet` and `--no-progress` flags when the `proc-log` module
|
|
26
26
|
// is found to fix a UX issue when running the command with recent versions of
|
|
27
27
|
// npm (input swallowed by the standard npm spinner)
|
|
28
|
-
|
|
29
|
-
if (
|
|
28
|
+
const npmArgs = process.argv.slice(2);
|
|
29
|
+
if (npmArgs.includes('install') && !npmArgs.includes('--no-progress') && !npmArgs.includes('--quiet')) {
|
|
30
30
|
const npmEntrypoint = (0, _nodeFs.realpathSync)(npmPath);
|
|
31
31
|
const npmRootPath = (0, _pathResolve.findRoot)(_nodePath.dirname(npmEntrypoint));
|
|
32
32
|
if (npmRootPath === undefined) {
|
|
33
33
|
process.exit(127);
|
|
34
34
|
}
|
|
35
35
|
const npmDepPath = _nodePath.join(npmRootPath, 'node_modules');
|
|
36
|
-
let
|
|
36
|
+
let procLog;
|
|
37
37
|
try {
|
|
38
|
-
|
|
38
|
+
procLog = require(_nodePath.join(npmDepPath, 'proc-log/lib/index.js')).log;
|
|
39
39
|
} catch {}
|
|
40
|
-
if (
|
|
41
|
-
npmArgs
|
|
40
|
+
if (procLog) {
|
|
41
|
+
npmArgs.push('--no-progress', '--quiet');
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
process.exitCode = 1;
|
|
45
|
-
const spawnPromise = _promiseSpawn(process.execPath, ['--require', injectionPath, npmPath, ...
|
|
45
|
+
const spawnPromise = _promiseSpawn(process.execPath, ['--require', injectionPath, npmPath, ...npmArgs], {
|
|
46
46
|
stdio: 'inherit'
|
|
47
47
|
});
|
|
48
48
|
spawnPromise.process.on('exit', (code, signal) => {
|
package/dist/npm-injection.js
CHANGED
|
@@ -17,7 +17,6 @@ var require$$1$1 = require('node:net');
|
|
|
17
17
|
var require$$2 = require('node:os');
|
|
18
18
|
var require$$6 = require('../package.json');
|
|
19
19
|
var pathResolve = require('./path-resolve.js');
|
|
20
|
-
var require$$0$1 = require('pacote');
|
|
21
20
|
|
|
22
21
|
var npmInjection$1 = {};
|
|
23
22
|
|
|
@@ -63,12 +62,12 @@ function createNonStandardTTYServer() {
|
|
|
63
62
|
conn.removeListener('data', awaitCapture);
|
|
64
63
|
conn.push(lineBuff.slice(eolIndex + 1));
|
|
65
64
|
const {
|
|
66
|
-
ipc_version: remote_ipc_version,
|
|
67
65
|
capabilities: {
|
|
66
|
+
colorLevel: ipcColorLevel,
|
|
68
67
|
input: hasInput,
|
|
69
|
-
output: hasOutput
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
output: hasOutput
|
|
69
|
+
},
|
|
70
|
+
ipc_version: remote_ipc_version
|
|
72
71
|
} = JSON.parse(lineBuff.slice(0, eolIndex).toString('utf-8'));
|
|
73
72
|
lineBuff = null;
|
|
74
73
|
captured = true;
|
|
@@ -406,47 +405,65 @@ var _objects = sdk.objects;
|
|
|
406
405
|
var _pathResolve = pathResolve.pathResolve;
|
|
407
406
|
var _sdk = sdk.sdk;
|
|
408
407
|
var _settings = sdk.settings;
|
|
409
|
-
const LOOP_SENTINEL = 1_000_000;
|
|
410
408
|
const POTENTIALLY_BUG_ERROR_SNIPPET = 'this is potentially a bug with socket-npm caused by changes to the npm cli';
|
|
411
409
|
const distPath$1 = __dirname;
|
|
412
410
|
const rootPath$1 = _nodePath$1.resolve(distPath$1, '..');
|
|
413
|
-
const
|
|
414
|
-
const npmEntrypoint = (0, _nodeFs$1.realpathSync)(`${process.argv[1]}`);
|
|
411
|
+
const npmEntrypoint = (0, _nodeFs$1.realpathSync)(process.argv[1]);
|
|
415
412
|
const npmRootPath = (0, _pathResolve.findRoot)(_nodePath$1.dirname(npmEntrypoint));
|
|
416
|
-
|
|
417
|
-
const {
|
|
418
|
-
|
|
419
|
-
|
|
413
|
+
function tryRequire(...ids) {
|
|
414
|
+
for (const data of ids) {
|
|
415
|
+
let id;
|
|
416
|
+
let transformer;
|
|
417
|
+
if (Array.isArray(data)) {
|
|
418
|
+
id = data[0];
|
|
419
|
+
transformer = data[1];
|
|
420
|
+
} else {
|
|
421
|
+
id = data;
|
|
422
|
+
transformer = mod => mod;
|
|
423
|
+
}
|
|
424
|
+
try {
|
|
425
|
+
// Check that the transformed value isn't `undefined` because older
|
|
426
|
+
// versions of packages like 'proc-log' may not export a `log` method.
|
|
427
|
+
const exported = transformer(require(id));
|
|
428
|
+
if (exported !== undefined) {
|
|
429
|
+
return exported;
|
|
430
|
+
}
|
|
431
|
+
} catch {}
|
|
432
|
+
}
|
|
433
|
+
return undefined;
|
|
434
|
+
}
|
|
420
435
|
if (npmRootPath === undefined) {
|
|
421
436
|
console.error(`Unable to find npm cli install directory, ${POTENTIALLY_BUG_ERROR_SNIPPET}.`);
|
|
422
437
|
console.error(`Searched parent directories of ${npmEntrypoint}`);
|
|
423
438
|
process.exit(127);
|
|
424
439
|
}
|
|
440
|
+
const LOOP_SENTINEL = 1_000_000;
|
|
441
|
+
const NPM_REGISTRY_URL = 'https://registry.npmjs.org';
|
|
425
442
|
const npmNmPath = _nodePath$1.join(npmRootPath, 'node_modules');
|
|
426
443
|
const arboristClassPath = _nodePath$1.join(npmNmPath, '@npmcli/arborist/lib/arborist/index.js');
|
|
444
|
+
const arboristDepValidPath = _nodePath$1.join(npmNmPath, '@npmcli/arborist/lib/dep-valid.js');
|
|
427
445
|
const arboristEdgeClassPath = _nodePath$1.join(npmNmPath, '@npmcli/arborist/lib/edge.js');
|
|
428
446
|
const arboristNodeClassPath = _nodePath$1.join(npmNmPath, '@npmcli/arborist/lib/node.js');
|
|
429
447
|
const arboristOverrideSetClassPatch = _nodePath$1.join(npmNmPath, '@npmcli/arborist/lib/override-set.js');
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
if (
|
|
435
|
-
try {
|
|
436
|
-
npmlog = require(_nodePath$1.join(npmNmPath, 'npmlog/lib/log.js'));
|
|
437
|
-
} catch {}
|
|
438
|
-
}
|
|
439
|
-
if (npmlog === undefined) {
|
|
448
|
+
const log = tryRequire([_nodePath$1.join(npmNmPath, 'proc-log/lib/index.js'),
|
|
449
|
+
// The proc-log DefinitelyTyped definition is incorrect. The type definition
|
|
450
|
+
// is really that of its export log.
|
|
451
|
+
mod => mod.log], _nodePath$1.join(npmNmPath, 'npmlog/lib/log.js'));
|
|
452
|
+
if (log === undefined) {
|
|
440
453
|
console.error(`Unable to integrate with npm cli logging infrastructure, ${POTENTIALLY_BUG_ERROR_SNIPPET}.`);
|
|
441
454
|
process.exit(127);
|
|
442
455
|
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
tarball
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
|
|
456
|
+
const pacote = tryRequire(_nodePath$1.join(npmNmPath, 'pacote'), 'pacote');
|
|
457
|
+
const {
|
|
458
|
+
tarball
|
|
459
|
+
} = pacote;
|
|
460
|
+
const translations = require(_nodePath$1.join(rootPath$1, 'translations.json'));
|
|
461
|
+
const abortController = new AbortController();
|
|
462
|
+
const {
|
|
463
|
+
signal: abortSignal
|
|
464
|
+
} = abortController;
|
|
449
465
|
const Arborist = require(arboristClassPath);
|
|
466
|
+
const depValid = require(arboristDepValidPath);
|
|
450
467
|
const Edge = require(arboristEdgeClassPath);
|
|
451
468
|
const Node = require(arboristNodeClassPath);
|
|
452
469
|
const OverrideSet = require(arboristOverrideSetClassPatch);
|
|
@@ -456,7 +473,7 @@ const formatter = new _chalkMarkdown.ChalkOrMarkdown(false);
|
|
|
456
473
|
const pubToken = (0, _sdk.getDefaultKey)() ?? _sdk.FREE_API_KEY;
|
|
457
474
|
const ttyServer = (0, _ttyServer.createTTYServer)(_chalk.default.level, (0, _isInteractive.default)({
|
|
458
475
|
stream: process.stdin
|
|
459
|
-
}),
|
|
476
|
+
}), log);
|
|
460
477
|
let _uxLookup;
|
|
461
478
|
async function uxLookup(settings) {
|
|
462
479
|
while (_uxLookup === undefined) {
|
|
@@ -545,7 +562,7 @@ function findSpecificOverrideSet(first, second) {
|
|
|
545
562
|
}
|
|
546
563
|
overrideSet = overrideSet.parent;
|
|
547
564
|
}
|
|
548
|
-
|
|
565
|
+
log.silly('Conflicting override sets', first, second);
|
|
549
566
|
return undefined;
|
|
550
567
|
}
|
|
551
568
|
function maybeReadfileSync(filepath) {
|
|
@@ -747,11 +764,13 @@ class SafeEdge extends Edge {
|
|
|
747
764
|
#safeError;
|
|
748
765
|
#safeExplanation;
|
|
749
766
|
#safeFrom;
|
|
767
|
+
#safeName;
|
|
750
768
|
#safeTo;
|
|
751
769
|
constructor(options) {
|
|
752
770
|
const {
|
|
753
771
|
accept,
|
|
754
|
-
from
|
|
772
|
+
from,
|
|
773
|
+
name
|
|
755
774
|
} = options;
|
|
756
775
|
// Defer to supper to validate options and assign non-private values.
|
|
757
776
|
super(options);
|
|
@@ -761,43 +780,51 @@ class SafeEdge extends Edge {
|
|
|
761
780
|
this.#safeError = null;
|
|
762
781
|
this.#safeExplanation = null;
|
|
763
782
|
this.#safeFrom = from;
|
|
783
|
+
this.#safeName = name;
|
|
764
784
|
this.#safeTo = null;
|
|
765
785
|
this.reload(true);
|
|
766
786
|
}
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
}
|
|
786
|
-
if (this.bundled) {
|
|
787
|
-
explanation.bundled = this.bundled;
|
|
788
|
-
}
|
|
789
|
-
if (this.error) {
|
|
790
|
-
explanation.error = this.error;
|
|
787
|
+
get accept() {
|
|
788
|
+
return this.#safeAccept;
|
|
789
|
+
}
|
|
790
|
+
get bundled() {
|
|
791
|
+
return !!this.#safeFrom?.package?.bundleDependencies?.includes(this.name);
|
|
792
|
+
}
|
|
793
|
+
get error() {
|
|
794
|
+
if (!this.#safeError) {
|
|
795
|
+
if (!this.#safeTo) {
|
|
796
|
+
if (this.optional) {
|
|
797
|
+
this.#safeError = null;
|
|
798
|
+
} else {
|
|
799
|
+
this.#safeError = 'MISSING';
|
|
800
|
+
}
|
|
801
|
+
} else if (this.peer && this.#safeFrom === this.#safeTo.parent && !this.#safeFrom?.isTop) {
|
|
802
|
+
this.#safeError = 'PEER LOCAL';
|
|
803
|
+
} else if (!this.satisfiedBy(this.#safeTo)) {
|
|
804
|
+
this.#safeError = 'INVALID';
|
|
791
805
|
}
|
|
792
|
-
if
|
|
793
|
-
|
|
806
|
+
// Patch adding "else if" condition is based on
|
|
807
|
+
// https://github.com/npm/cli/pull/7025.
|
|
808
|
+
else if (this.overrides && this.#safeTo.edgesOut.size && !findSpecificOverrideSet(this.overrides, this.#safeTo.overrides)) {
|
|
809
|
+
// Any inconsistency between the edge's override set and the target's
|
|
810
|
+
// override set is potentially problematic. But we only say the edge is
|
|
811
|
+
// in error if the override sets are plainly conflicting. Note that if
|
|
812
|
+
// the target doesn't have any dependencies of their own, then this
|
|
813
|
+
// inconsistency is irrelevant.
|
|
814
|
+
this.#safeError = 'INVALID';
|
|
815
|
+
} else {
|
|
816
|
+
this.#safeError = 'OK';
|
|
794
817
|
}
|
|
795
|
-
this.#safeExplanation = explanation;
|
|
796
818
|
}
|
|
797
|
-
|
|
819
|
+
if (this.#safeError === 'OK') {
|
|
820
|
+
return null;
|
|
821
|
+
}
|
|
822
|
+
return this.#safeError;
|
|
798
823
|
}
|
|
799
|
-
|
|
800
|
-
|
|
824
|
+
|
|
825
|
+
// @ts-ignore: Incorrectly typed as a property instead of an accessor.
|
|
826
|
+
get from() {
|
|
827
|
+
return this.#safeFrom;
|
|
801
828
|
}
|
|
802
829
|
|
|
803
830
|
// @ts-ignore: Incorrectly typed as a property instead of an accessor.
|
|
@@ -835,39 +862,55 @@ class SafeEdge extends Edge {
|
|
|
835
862
|
}
|
|
836
863
|
return this.rawSpec;
|
|
837
864
|
}
|
|
838
|
-
|
|
839
|
-
|
|
865
|
+
|
|
866
|
+
// @ts-ignore: Incorrectly typed as a property instead of an accessor.
|
|
867
|
+
get to() {
|
|
868
|
+
return this.#safeTo;
|
|
840
869
|
}
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
870
|
+
detach() {
|
|
871
|
+
this.#safeExplanation = null;
|
|
872
|
+
// Patch replacing
|
|
873
|
+
// if (this.#safeTo) {
|
|
874
|
+
// this.#safeTo.edgesIn.delete(this)
|
|
875
|
+
// }
|
|
876
|
+
// is based on https://github.com/npm/cli/pull/7025.
|
|
877
|
+
this.#safeTo?.deleteEdgeIn(this);
|
|
878
|
+
this.#safeFrom?.edgesOut.delete(this.name);
|
|
879
|
+
this.#safeTo = null;
|
|
880
|
+
this.#safeError = 'DETACHED';
|
|
881
|
+
this.#safeFrom = null;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
// Return the edge data, and an explanation of how that edge came to be here.
|
|
885
|
+
// @ts-ignore: Edge#explain is defined with an unused `seen = []` param.
|
|
886
|
+
explain() {
|
|
887
|
+
if (!this.#safeExplanation) {
|
|
888
|
+
const explanation = {
|
|
889
|
+
type: this.type,
|
|
890
|
+
name: this.name,
|
|
891
|
+
spec: this.spec,
|
|
892
|
+
bundled: false,
|
|
893
|
+
overridden: false,
|
|
894
|
+
error: undefined,
|
|
895
|
+
from: undefined,
|
|
896
|
+
rawSpec: undefined
|
|
897
|
+
};
|
|
898
|
+
if (this.rawSpec !== this.spec) {
|
|
899
|
+
explanation.rawSpec = this.rawSpec;
|
|
900
|
+
explanation.overridden = true;
|
|
853
901
|
}
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
else if (this.overrides && this.#safeTo.edgesOut.size && !findSpecificOverrideSet(this.overrides, this.#safeTo.overrides)) {
|
|
857
|
-
// Any inconsistency between the edge's override set and the target's
|
|
858
|
-
// override set is potentially problematic. But we only say the edge is
|
|
859
|
-
// in error if the override sets are plainly conflicting. Note that if
|
|
860
|
-
// the target doesn't have any dependencies of their own, then this
|
|
861
|
-
// inconsistency is irrelevant.
|
|
862
|
-
this.#safeError = 'INVALID';
|
|
863
|
-
} else {
|
|
864
|
-
this.#safeError = 'OK';
|
|
902
|
+
if (this.bundled) {
|
|
903
|
+
explanation.bundled = this.bundled;
|
|
865
904
|
}
|
|
905
|
+
if (this.error) {
|
|
906
|
+
explanation.error = this.error;
|
|
907
|
+
}
|
|
908
|
+
if (this.#safeFrom) {
|
|
909
|
+
explanation.from = this.#safeFrom.explain();
|
|
910
|
+
}
|
|
911
|
+
this.#safeExplanation = explanation;
|
|
866
912
|
}
|
|
867
|
-
|
|
868
|
-
return null;
|
|
869
|
-
}
|
|
870
|
-
return this.#safeError;
|
|
913
|
+
return this.#safeExplanation;
|
|
871
914
|
}
|
|
872
915
|
reload(hard = false) {
|
|
873
916
|
this.#safeExplanation = null;
|
|
@@ -916,36 +959,100 @@ class SafeEdge extends Edge {
|
|
|
916
959
|
this.#safeTo.updateOverridesEdgeInAdded(newOverrideSet);
|
|
917
960
|
}
|
|
918
961
|
}
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
if (this.#
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
962
|
+
satisfiedBy(node) {
|
|
963
|
+
// Patch replacing
|
|
964
|
+
// if (node.name !== this.#name) {
|
|
965
|
+
// return false
|
|
966
|
+
// }
|
|
967
|
+
// is based on https://github.com/npm/cli/pull/7025.
|
|
968
|
+
if (node.name !== this.#safeName || !this.#safeFrom) {
|
|
969
|
+
return false;
|
|
926
970
|
}
|
|
927
|
-
|
|
928
|
-
|
|
971
|
+
// NOTE: this condition means we explicitly do not support overriding
|
|
972
|
+
// bundled or shrinkwrapped dependencies
|
|
973
|
+
if (node.hasShrinkwrap || node.inShrinkwrap || node.inBundle) {
|
|
974
|
+
return depValid(node, this.rawSpec, this.#safeAccept, this.#safeFrom);
|
|
929
975
|
}
|
|
930
|
-
|
|
931
|
-
this.#
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
976
|
+
// Patch replacing
|
|
977
|
+
// return depValid(node, this.spec, this.#accept, this.#from)
|
|
978
|
+
// is based on https://github.com/npm/cli/pull/7025.
|
|
979
|
+
//
|
|
980
|
+
// If there's no override we just use the spec.
|
|
981
|
+
if (!this.overrides?.keySpec) {
|
|
982
|
+
return depValid(node, this.spec, this.#safeAccept, this.#safeFrom);
|
|
983
|
+
}
|
|
984
|
+
// There's some override. If the target node satisfies the overriding spec
|
|
985
|
+
// then it's okay.
|
|
986
|
+
if (depValid(node, this.spec, this.#safeAccept, this.#safeFrom)) {
|
|
987
|
+
return true;
|
|
988
|
+
}
|
|
989
|
+
// If it doesn't, then it should at least satisfy the original spec.
|
|
990
|
+
if (!depValid(node, this.rawSpec, this.#safeAccept, this.#safeFrom)) {
|
|
991
|
+
return false;
|
|
992
|
+
}
|
|
993
|
+
// It satisfies the original spec, not the overriding spec. We need to make
|
|
994
|
+
// sure it doesn't use the overridden spec.
|
|
995
|
+
// For example, we might have an ^8.0.0 rawSpec, and an override that makes
|
|
996
|
+
// keySpec=8.23.0 and the override value spec=9.0.0.
|
|
997
|
+
// If the node is 9.0.0, then it's okay because it's consistent with spec.
|
|
998
|
+
// If the node is 8.24.0, then it's okay because it's consistent with the rawSpec.
|
|
999
|
+
// If the node is 8.23.0, then it's not okay because even though it's consistent
|
|
1000
|
+
// with the rawSpec, it's also consistent with the keySpec.
|
|
1001
|
+
// So we're looking for ^8.0.0 or 9.0.0 and not 8.23.0.
|
|
1002
|
+
return !depValid(node, this.overrides.keySpec, this.#safeAccept, this.#safeFrom);
|
|
943
1003
|
}
|
|
944
1004
|
}
|
|
945
1005
|
|
|
946
1006
|
// Implementation code not related to patch https://github.com/npm/cli/pull/7025
|
|
947
1007
|
// is based on https://github.com/npm/cli/blob/v10.9.0/workspaces/arborist/lib/node.js:
|
|
948
1008
|
class SafeNode extends Node {
|
|
1009
|
+
// Return true if it's safe to remove this node, because anything that is
|
|
1010
|
+
// depending on it would be fine with the thing that they would resolve to if
|
|
1011
|
+
// it was removed, or nothing is depending on it in the first place.
|
|
1012
|
+
canDedupe(preferDedupe = false) {
|
|
1013
|
+
// Not allowed to mess with shrinkwraps or bundles.
|
|
1014
|
+
if (this.inDepBundle || this.inShrinkwrap) {
|
|
1015
|
+
return false;
|
|
1016
|
+
}
|
|
1017
|
+
// It's a top level pkg, or a dep of one.
|
|
1018
|
+
if (!this.resolveParent || !this.resolveParent.resolveParent) {
|
|
1019
|
+
return false;
|
|
1020
|
+
}
|
|
1021
|
+
// No one wants it, remove it.
|
|
1022
|
+
if (this.edgesIn.size === 0) {
|
|
1023
|
+
return true;
|
|
1024
|
+
}
|
|
1025
|
+
const other = this.resolveParent.resolveParent.resolve(this.name);
|
|
1026
|
+
// Nothing else, need this one.
|
|
1027
|
+
if (!other) {
|
|
1028
|
+
return false;
|
|
1029
|
+
}
|
|
1030
|
+
// If it's the same thing, then always fine to remove.
|
|
1031
|
+
if (other.matches(this)) {
|
|
1032
|
+
return true;
|
|
1033
|
+
}
|
|
1034
|
+
// If the other thing can't replace this, then skip it.
|
|
1035
|
+
if (!other.canReplace(this)) {
|
|
1036
|
+
return false;
|
|
1037
|
+
}
|
|
1038
|
+
// Patch replacing
|
|
1039
|
+
// if (preferDedupe || semver.gte(other.version, this.version)) {
|
|
1040
|
+
// return true
|
|
1041
|
+
// }
|
|
1042
|
+
// is based on https://github.com/npm/cli/pull/7025.
|
|
1043
|
+
//
|
|
1044
|
+
// If we prefer dedupe, or if the version is equal, take the other.
|
|
1045
|
+
if (preferDedupe || _semver.eq(other.version, this.version)) {
|
|
1046
|
+
return true;
|
|
1047
|
+
}
|
|
1048
|
+
// If our current version isn't the result of an override, then prefer to
|
|
1049
|
+
// take the greater version.
|
|
1050
|
+
if (!this.overridden && _semver.gt(other.version, this.version)) {
|
|
1051
|
+
return true;
|
|
1052
|
+
}
|
|
1053
|
+
return false;
|
|
1054
|
+
}
|
|
1055
|
+
|
|
949
1056
|
// Is it safe to replace one node with another? check the edges to
|
|
950
1057
|
// make sure no one will get upset. Note that the node might end up
|
|
951
1058
|
// having its own unmet dependencies, if the new node has new deps.
|
|
@@ -1036,7 +1143,7 @@ class SafeNode extends Node {
|
|
|
1036
1143
|
// overridden, we check whether any edge going in had the rule applied to it,
|
|
1037
1144
|
// in which case its overrides set is different than its source node.
|
|
1038
1145
|
for (const edge of this.edgesIn) {
|
|
1039
|
-
if (
|
|
1146
|
+
if (edge.overrides && edge.overrides.name === this.name && edge.overrides.value === this.version) {
|
|
1040
1147
|
if (!edge.overrides?.isEqual(edge.from?.overrides)) {
|
|
1041
1148
|
return true;
|
|
1042
1149
|
}
|
|
@@ -1123,9 +1230,9 @@ class SafeNode extends Node {
|
|
|
1123
1230
|
this.recalculateOutEdgesOverrides();
|
|
1124
1231
|
return true;
|
|
1125
1232
|
}
|
|
1126
|
-
// This is an error condition. We can only get here if the new override set
|
|
1127
|
-
// in conflict with the existing.
|
|
1128
|
-
|
|
1233
|
+
// This is an error condition. We can only get here if the new override set
|
|
1234
|
+
// is in conflict with the existing.
|
|
1235
|
+
log.silly(`Conflicting override requirements for node ${this.name}`, this);
|
|
1129
1236
|
return false;
|
|
1130
1237
|
}
|
|
1131
1238
|
|
|
@@ -1318,7 +1425,7 @@ class SafeArborist extends Arborist {
|
|
|
1318
1425
|
options['save'] = old.save;
|
|
1319
1426
|
options['saveBundle'] = old.saveBundle;
|
|
1320
1427
|
// Nothing to check, mmm already installed or all private?
|
|
1321
|
-
if (diff.findIndex(c => c.newPackage.repository_url ===
|
|
1428
|
+
if (diff.findIndex(c => c.newPackage.repository_url === NPM_REGISTRY_URL) === -1) {
|
|
1322
1429
|
return await this[kRiskyReify](...args);
|
|
1323
1430
|
}
|
|
1324
1431
|
let proceed = _constants.ENV.UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE;
|
package/dist/path-resolve.js
CHANGED
|
@@ -63,8 +63,8 @@ async function filterGlobResultToSupportedFiles(entries, supportedFiles) {
|
|
|
63
63
|
}
|
|
64
64
|
async function globWithGitIgnore(patterns, options) {
|
|
65
65
|
const {
|
|
66
|
-
socketConfig,
|
|
67
66
|
cwd = process.cwd(),
|
|
67
|
+
socketConfig,
|
|
68
68
|
...additionalOptions
|
|
69
69
|
} = {
|
|
70
70
|
__proto__: null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "socket",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.21",
|
|
4
4
|
"description": "CLI tool for Socket.dev",
|
|
5
5
|
"homepage": "http://github.com/SocketDev/socket-cli",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"check:type-coverage": "type-coverage --detail --strict --at-least 95 --ignore-files 'test/*'",
|
|
29
29
|
"knip:dependencies": "knip --dependencies",
|
|
30
30
|
"knip:exports": "knip --include exports,duplicates",
|
|
31
|
-
"lint": "oxlint -c=./.oxlintrc.json --ignore-path=./.prettierignore --tsconfig=./tsconfig.json .
|
|
31
|
+
"lint": "oxlint -c=./.oxlintrc.json --ignore-path=./.prettierignore --tsconfig=./tsconfig.json .",
|
|
32
32
|
"lint:fix": "npm run lint -- --fix && npm run lint:fix:fast",
|
|
33
33
|
"lint:fix:fast": "prettier --cache --log-level warn --write .",
|
|
34
34
|
"prepare": "husky",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@apideck/better-ajv-errors": "^0.3.6",
|
|
43
|
-
"@cyclonedx/cdxgen": "^10.
|
|
43
|
+
"@cyclonedx/cdxgen": "^10.11.0",
|
|
44
44
|
"@inquirer/prompts": "^7.0.1",
|
|
45
45
|
"@npmcli/package-json": "6.0.1",
|
|
46
46
|
"@npmcli/promise-spawn": "^8.0.2",
|
|
@@ -103,29 +103,31 @@
|
|
|
103
103
|
"@types/micromatch": "^4.0.9",
|
|
104
104
|
"@types/mocha": "^10.0.9",
|
|
105
105
|
"@types/mock-fs": "^4.13.4",
|
|
106
|
-
"@types/node": "^22.8.
|
|
106
|
+
"@types/node": "^22.8.6",
|
|
107
107
|
"@types/npmcli__arborist": "^5.6.11",
|
|
108
108
|
"@types/npmcli__package-json": "^4.0.4",
|
|
109
109
|
"@types/npmcli__promise-spawn": "^6.0.3",
|
|
110
|
+
"@types/proc-log": "^3.0.4",
|
|
110
111
|
"@types/semver": "^7.5.8",
|
|
111
112
|
"@types/update-notifier": "^6.0.8",
|
|
112
113
|
"@types/which": "^3.0.4",
|
|
113
114
|
"@types/yargs-parser": "^21.0.3",
|
|
114
|
-
"@typescript-eslint/eslint-plugin": "^8.12.
|
|
115
|
-
"@typescript-eslint/parser": "^8.12.
|
|
115
|
+
"@typescript-eslint/eslint-plugin": "^8.12.2",
|
|
116
|
+
"@typescript-eslint/parser": "^8.12.2",
|
|
116
117
|
"c8": "^10.1.2",
|
|
117
118
|
"chalk": "^5.3.0",
|
|
118
119
|
"eslint": "^9.13.0",
|
|
119
120
|
"eslint-plugin-depend": "^0.11.0",
|
|
120
|
-
"eslint-plugin-n": "^17.
|
|
121
|
+
"eslint-plugin-n": "^17.12.0",
|
|
122
|
+
"eslint-plugin-sort-destructure-keys": "^2.0.0",
|
|
121
123
|
"eslint-plugin-unicorn": "^56.0.0",
|
|
122
124
|
"husky": "^9.1.6",
|
|
123
125
|
"is-interactive": "^2.0.0",
|
|
124
126
|
"is-unicode-supported": "^2.1.0",
|
|
125
|
-
"knip": "^5.
|
|
127
|
+
"knip": "^5.36.1",
|
|
126
128
|
"magic-string": "^0.30.12",
|
|
127
129
|
"meow": "^13.2.0",
|
|
128
|
-
"mock-fs": "^5.4.
|
|
130
|
+
"mock-fs": "^5.4.1",
|
|
129
131
|
"nock": "^13.5.5",
|
|
130
132
|
"normalize-package-data": "^7.0.0",
|
|
131
133
|
"npm-run-all2": "^7.0.1",
|
|
@@ -134,13 +136,13 @@
|
|
|
134
136
|
"oxlint": "0.10.3",
|
|
135
137
|
"prettier": "3.3.3",
|
|
136
138
|
"read-package-up": "^11.0.0",
|
|
137
|
-
"rollup": "4.24.
|
|
139
|
+
"rollup": "4.24.3",
|
|
138
140
|
"rollup-plugin-ts": "^3.4.5",
|
|
139
141
|
"tap": "^21.0.1",
|
|
140
142
|
"terminal-link": "^3.0.0",
|
|
141
143
|
"type-coverage": "^2.29.7",
|
|
142
144
|
"typescript": "5.4.5",
|
|
143
|
-
"typescript-eslint": "^8.12.
|
|
145
|
+
"typescript-eslint": "^8.12.2",
|
|
144
146
|
"unplugin-purge-polyfills": "^0.0.7",
|
|
145
147
|
"update-notifier": "^7.3.1",
|
|
146
148
|
"validate-npm-package-name": "^6.0.0"
|