@vltpkg/query 0.0.0-6 → 0.0.0-8
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 +47 -3
- package/dist/esm/attribute.js +3 -1
- package/dist/esm/attribute.js.map +1 -1
- package/dist/esm/class.d.ts.map +1 -1
- package/dist/esm/class.js +4 -1
- package/dist/esm/class.js.map +1 -1
- package/dist/esm/combinator.d.ts.map +1 -1
- package/dist/esm/combinator.js +4 -1
- package/dist/esm/combinator.js.map +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +11 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/pseudo/abandoned.d.ts +3 -1
- package/dist/esm/pseudo/abandoned.d.ts.map +1 -1
- package/dist/esm/pseudo/confused.d.ts +3 -1
- package/dist/esm/pseudo/confused.d.ts.map +1 -1
- package/dist/esm/pseudo/cve.d.ts +12 -0
- package/dist/esm/pseudo/cve.d.ts.map +1 -0
- package/dist/esm/pseudo/cve.js +44 -0
- package/dist/esm/pseudo/cve.js.map +1 -0
- package/dist/esm/pseudo/cwe.d.ts +12 -0
- package/dist/esm/pseudo/cwe.d.ts.map +1 -0
- package/dist/esm/pseudo/cwe.js +43 -0
- package/dist/esm/pseudo/cwe.js.map +1 -0
- package/dist/esm/pseudo/debug.d.ts +3 -1
- package/dist/esm/pseudo/debug.d.ts.map +1 -1
- package/dist/esm/pseudo/deprecated.d.ts +3 -1
- package/dist/esm/pseudo/deprecated.d.ts.map +1 -1
- package/dist/esm/pseudo/dynamic.d.ts +3 -1
- package/dist/esm/pseudo/dynamic.d.ts.map +1 -1
- package/dist/esm/pseudo/entropic.d.ts +3 -1
- package/dist/esm/pseudo/entropic.d.ts.map +1 -1
- package/dist/esm/pseudo/env.d.ts +3 -1
- package/dist/esm/pseudo/env.d.ts.map +1 -1
- package/dist/esm/pseudo/eval.d.ts +3 -1
- package/dist/esm/pseudo/eval.d.ts.map +1 -1
- package/dist/esm/pseudo/fs.d.ts +3 -1
- package/dist/esm/pseudo/fs.d.ts.map +1 -1
- package/dist/esm/pseudo/helpers.d.ts +9 -1
- package/dist/esm/pseudo/helpers.d.ts.map +1 -1
- package/dist/esm/pseudo/helpers.js +10 -3
- package/dist/esm/pseudo/helpers.js.map +1 -1
- package/dist/esm/pseudo/license.d.ts +12 -0
- package/dist/esm/pseudo/license.d.ts.map +1 -0
- package/dist/esm/pseudo/license.js +58 -0
- package/dist/esm/pseudo/license.js.map +1 -0
- package/dist/esm/pseudo/malware.d.ts +12 -0
- package/dist/esm/pseudo/malware.d.ts.map +1 -0
- package/dist/esm/pseudo/malware.js +57 -0
- package/dist/esm/pseudo/malware.js.map +1 -0
- package/dist/esm/pseudo/minified.d.ts +3 -1
- package/dist/esm/pseudo/minified.d.ts.map +1 -1
- package/dist/esm/pseudo/native.d.ts +3 -1
- package/dist/esm/pseudo/native.d.ts.map +1 -1
- package/dist/esm/pseudo/network.d.ts +3 -1
- package/dist/esm/pseudo/network.d.ts.map +1 -1
- package/dist/esm/pseudo/obfuscated.d.ts +3 -1
- package/dist/esm/pseudo/obfuscated.d.ts.map +1 -1
- package/dist/esm/pseudo/scanned.d.ts +7 -0
- package/dist/esm/pseudo/scanned.d.ts.map +1 -0
- package/dist/esm/pseudo/scanned.js +12 -0
- package/dist/esm/pseudo/scanned.js.map +1 -0
- package/dist/esm/pseudo/scripts.d.ts +3 -1
- package/dist/esm/pseudo/scripts.d.ts.map +1 -1
- package/dist/esm/pseudo/severity.d.ts +12 -0
- package/dist/esm/pseudo/severity.d.ts.map +1 -0
- package/dist/esm/pseudo/severity.js +57 -0
- package/dist/esm/pseudo/severity.js.map +1 -0
- package/dist/esm/pseudo/shell.d.ts +3 -1
- package/dist/esm/pseudo/shell.d.ts.map +1 -1
- package/dist/esm/pseudo/shrinkwrap.d.ts +3 -1
- package/dist/esm/pseudo/shrinkwrap.d.ts.map +1 -1
- package/dist/esm/pseudo/squat.d.ts +12 -0
- package/dist/esm/pseudo/squat.d.ts.map +1 -0
- package/dist/esm/pseudo/squat.js +54 -0
- package/dist/esm/pseudo/squat.js.map +1 -0
- package/dist/esm/pseudo/suspicious.d.ts +3 -1
- package/dist/esm/pseudo/suspicious.d.ts.map +1 -1
- package/dist/esm/pseudo/tracker.d.ts +3 -1
- package/dist/esm/pseudo/tracker.d.ts.map +1 -1
- package/dist/esm/pseudo/trivial.d.ts +3 -1
- package/dist/esm/pseudo/trivial.d.ts.map +1 -1
- package/dist/esm/pseudo/undesirable.d.ts +3 -1
- package/dist/esm/pseudo/undesirable.d.ts.map +1 -1
- package/dist/esm/pseudo/unknown.d.ts +3 -1
- package/dist/esm/pseudo/unknown.d.ts.map +1 -1
- package/dist/esm/pseudo/unmaintained.d.ts +3 -1
- package/dist/esm/pseudo/unmaintained.d.ts.map +1 -1
- package/dist/esm/pseudo/unpopular.d.ts +3 -1
- package/dist/esm/pseudo/unpopular.d.ts.map +1 -1
- package/dist/esm/pseudo/unstable.d.ts +3 -1
- package/dist/esm/pseudo/unstable.d.ts.map +1 -1
- package/dist/esm/pseudo.d.ts.map +1 -1
- package/dist/esm/pseudo.js +18 -1
- package/dist/esm/pseudo.js.map +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { error } from '@vltpkg/error-cause';
|
|
2
|
+
import { asPostcssNodeWithChildren, asStringNode, asTagNode, isStringNode, isTagNode, } from "../types.js";
|
|
3
|
+
import { assertSecurityArchive, removeDanglingEdges, removeNode, removeQuotes, } from "./helpers.js";
|
|
4
|
+
const kindsMap = new Map([
|
|
5
|
+
['critical', 'didYouMean'],
|
|
6
|
+
['medium', 'gptDidYouMean'],
|
|
7
|
+
['0', 'didYouMean'],
|
|
8
|
+
['2', 'gptDidYouMean'],
|
|
9
|
+
[undefined, undefined],
|
|
10
|
+
]);
|
|
11
|
+
const kinds = new Set(kindsMap.keys());
|
|
12
|
+
export const isSquatKind = (value) => kinds.has(value);
|
|
13
|
+
export const asSquatKind = (value) => {
|
|
14
|
+
if (!isSquatKind(value)) {
|
|
15
|
+
throw error('Expected a valid squat kind', {
|
|
16
|
+
found: value,
|
|
17
|
+
validOptions: Array.from(kinds),
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return value;
|
|
21
|
+
};
|
|
22
|
+
export const parseInternals = (nodes) => {
|
|
23
|
+
let kind;
|
|
24
|
+
if (isStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])) {
|
|
25
|
+
kind = asSquatKind(removeQuotes(asStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])
|
|
26
|
+
.value));
|
|
27
|
+
}
|
|
28
|
+
else if (isTagNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])) {
|
|
29
|
+
kind = asSquatKind(asTagNode(asPostcssNodeWithChildren(nodes[0]).nodes[0]).value);
|
|
30
|
+
}
|
|
31
|
+
return { kind };
|
|
32
|
+
};
|
|
33
|
+
export const squat = async (state) => {
|
|
34
|
+
assertSecurityArchive(state, 'squat');
|
|
35
|
+
let internals;
|
|
36
|
+
try {
|
|
37
|
+
internals = parseInternals(asPostcssNodeWithChildren(state.current).nodes);
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
throw error('Failed to parse :squat selector', { cause: err });
|
|
41
|
+
}
|
|
42
|
+
const { kind } = internals;
|
|
43
|
+
const alertName = kindsMap.get(kind);
|
|
44
|
+
for (const node of state.partial.nodes) {
|
|
45
|
+
const report = state.securityArchive.get(node.id);
|
|
46
|
+
const exclude = !report?.alerts.some(alert => alert.type === alertName);
|
|
47
|
+
if (exclude) {
|
|
48
|
+
removeNode(state, node);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
removeDanglingEdges(state);
|
|
52
|
+
return state;
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=squat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"squat.js","sourceRoot":"","sources":["../../../src/pseudo/squat.ts"],"names":[],"mapp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,CAAA;QACD,IAAI,OAAO,EAAE,CAAC;YACZ,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;QACzB,CAAC;IACH,CAAC;IAED,mBAAmB,CAAC,KAAK,CAAC,CAAA;IAE1B,OAAO,KAAK,CAAA;AACd,CAAC,CAAA","sourcesContent":["import { error } from '@vltpkg/error-cause'\nimport {\n asPostcssNodeWithChildren,\n asStringNode,\n asTagNode,\n isStringNode,\n isTagNode,\n} from '../types.ts'\nimport type { ParserState, PostcssNode } from '../types.ts'\nimport {\n assertSecurityArchive,\n removeDanglingEdges,\n removeNode,\n removeQuotes,\n} from './helpers.ts'\n\nexport type SquatKinds = '0' | '2' | 'critical' | 'medium' | undefined\n\nexport type SquatAlertTypes =\n | 'didYouMean'\n | 'gptDidYouMean'\n | undefined\n\nconst kindsMap = new Map<SquatKinds, SquatAlertTypes>([\n ['critical', 'didYouMean'],\n ['medium', 'gptDidYouMean'],\n ['0', 'didYouMean'],\n ['2', 'gptDidYouMean'],\n [undefined, undefined],\n])\nconst kinds = new Set(kindsMap.keys())\n\nexport const isSquatKind = (value?: string): value is SquatKinds =>\n kinds.has(value as SquatKinds)\n\nexport const asSquatKind = (value?: string): SquatKinds => {\n if (!isSquatKind(value)) {\n throw error('Expected a valid squat kind', {\n found: value,\n validOptions: Array.from(kinds),\n })\n }\n return value\n}\n\nexport const parseInternals = (\n nodes: PostcssNode[],\n): { kind: SquatKinds } => {\n let kind: SquatKinds\n\n if (isStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])) {\n kind = asSquatKind(\n removeQuotes(\n asStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])\n .value,\n ),\n )\n } else if (\n isTagNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])\n ) {\n kind = asSquatKind(\n asTagNode(asPostcssNodeWithChildren(nodes[0]).nodes[0]).value,\n )\n }\n\n return { kind }\n}\n\nexport const squat = async (state: ParserState) => {\n assertSecurityArchive(state, 'squat')\n\n let internals\n try {\n internals = parseInternals(\n asPostcssNodeWithChildren(state.current).nodes,\n )\n } catch (err) {\n throw error('Failed to parse :squat selector', { cause: err })\n }\n\n const { kind } = internals\n const alertName = kindsMap.get(kind)\n for (const node of state.partial.nodes) {\n const report = state.securityArchive.get(node.id)\n const exclude = !report?.alerts.some(\n alert => alert.type === alertName,\n )\n if (exclude) {\n removeNode(state, node)\n }\n }\n\n removeDanglingEdges(state)\n\n return state\n}\n"]}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Filters out any node that does not have a **suspiciousStarActivity** report alert.
|
|
3
3
|
*/
|
|
4
|
-
export declare const suspicious: (state: import("../types.ts").ParserState) => Promise<import("../types.ts").ParserState
|
|
4
|
+
export declare const suspicious: (state: import("../types.ts").ParserState) => Promise<import("../types.ts").ParserState & {
|
|
5
|
+
securityArchive: NonNullable<import("../types.ts").ParserState["securityArchive"]>;
|
|
6
|
+
}>;
|
|
5
7
|
//# sourceMappingURL=suspicious.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suspicious.d.ts","sourceRoot":"","sources":["../../../src/pseudo/suspicious.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"suspicious.d.ts","sourceRoot":"","sources":["../../../src/pseudo/suspicious.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,UAAU;;EAGtB,CAAA"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Filters out any node that does not have a **telemetry** report alert.
|
|
3
3
|
*/
|
|
4
|
-
export declare const tracker: (state: import("../types.ts").ParserState) => Promise<import("../types.ts").ParserState
|
|
4
|
+
export declare const tracker: (state: import("../types.ts").ParserState) => Promise<import("../types.ts").ParserState & {
|
|
5
|
+
securityArchive: NonNullable<import("../types.ts").ParserState["securityArchive"]>;
|
|
6
|
+
}>;
|
|
5
7
|
//# sourceMappingURL=tracker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracker.d.ts","sourceRoot":"","sources":["../../../src/pseudo/tracker.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"tracker.d.ts","sourceRoot":"","sources":["../../../src/pseudo/tracker.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,OAAO;;EAGnB,CAAA"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Filters out any node that does not have a **trivialPackage** report alert.
|
|
3
3
|
*/
|
|
4
|
-
export declare const trivial: (state: import("../types.ts").ParserState) => Promise<import("../types.ts").ParserState
|
|
4
|
+
export declare const trivial: (state: import("../types.ts").ParserState) => Promise<import("../types.ts").ParserState & {
|
|
5
|
+
securityArchive: NonNullable<import("../types.ts").ParserState["securityArchive"]>;
|
|
6
|
+
}>;
|
|
5
7
|
//# sourceMappingURL=trivial.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trivial.d.ts","sourceRoot":"","sources":["../../../src/pseudo/trivial.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"trivial.d.ts","sourceRoot":"","sources":["../../../src/pseudo/trivial.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,OAAO;;EAGnB,CAAA"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Filters out any node that does not have a **troll** report alert.
|
|
3
3
|
*/
|
|
4
|
-
export declare const undesirable: (state: import("../types.ts").ParserState) => Promise<import("../types.ts").ParserState
|
|
4
|
+
export declare const undesirable: (state: import("../types.ts").ParserState) => Promise<import("../types.ts").ParserState & {
|
|
5
|
+
securityArchive: NonNullable<import("../types.ts").ParserState["securityArchive"]>;
|
|
6
|
+
}>;
|
|
5
7
|
//# sourceMappingURL=undesirable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"undesirable.d.ts","sourceRoot":"","sources":["../../../src/pseudo/undesirable.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"undesirable.d.ts","sourceRoot":"","sources":["../../../src/pseudo/undesirable.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,WAAW;;EAGvB,CAAA"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Filters out any node that does not have a **newAuthor** report alert.
|
|
3
3
|
*/
|
|
4
|
-
export declare const unknown: (state: import("../types.ts").ParserState) => Promise<import("../types.ts").ParserState
|
|
4
|
+
export declare const unknown: (state: import("../types.ts").ParserState) => Promise<import("../types.ts").ParserState & {
|
|
5
|
+
securityArchive: NonNullable<import("../types.ts").ParserState["securityArchive"]>;
|
|
6
|
+
}>;
|
|
5
7
|
//# sourceMappingURL=unknown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unknown.d.ts","sourceRoot":"","sources":["../../../src/pseudo/unknown.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"unknown.d.ts","sourceRoot":"","sources":["../../../src/pseudo/unknown.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,OAAO;;EAGnB,CAAA"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Filters out any node that does not have a **unmaintained** report alert.
|
|
3
3
|
*/
|
|
4
|
-
export declare const unmaintained: (state: import("../types.ts").ParserState) => Promise<import("../types.ts").ParserState
|
|
4
|
+
export declare const unmaintained: (state: import("../types.ts").ParserState) => Promise<import("../types.ts").ParserState & {
|
|
5
|
+
securityArchive: NonNullable<import("../types.ts").ParserState["securityArchive"]>;
|
|
6
|
+
}>;
|
|
5
7
|
//# sourceMappingURL=unmaintained.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unmaintained.d.ts","sourceRoot":"","sources":["../../../src/pseudo/unmaintained.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"unmaintained.d.ts","sourceRoot":"","sources":["../../../src/pseudo/unmaintained.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,YAAY;;EAGxB,CAAA"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Filters out any node that does not have a **unpopularPackage** report alert.
|
|
3
3
|
*/
|
|
4
|
-
export declare const unpopular: (state: import("../types.ts").ParserState) => Promise<import("../types.ts").ParserState
|
|
4
|
+
export declare const unpopular: (state: import("../types.ts").ParserState) => Promise<import("../types.ts").ParserState & {
|
|
5
|
+
securityArchive: NonNullable<import("../types.ts").ParserState["securityArchive"]>;
|
|
6
|
+
}>;
|
|
5
7
|
//# sourceMappingURL=unpopular.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unpopular.d.ts","sourceRoot":"","sources":["../../../src/pseudo/unpopular.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"unpopular.d.ts","sourceRoot":"","sources":["../../../src/pseudo/unpopular.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,SAAS;;EAGrB,CAAA"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Filters out any node that does not have a **unstableOwnership** report alert.
|
|
3
3
|
*/
|
|
4
|
-
export declare const unstable: (state: import("../types.ts").ParserState) => Promise<import("../types.ts").ParserState
|
|
4
|
+
export declare const unstable: (state: import("../types.ts").ParserState) => Promise<import("../types.ts").ParserState & {
|
|
5
|
+
securityArchive: NonNullable<import("../types.ts").ParserState["securityArchive"]>;
|
|
6
|
+
}>;
|
|
5
7
|
//# sourceMappingURL=unstable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unstable.d.ts","sourceRoot":"","sources":["../../../src/pseudo/unstable.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"unstable.d.ts","sourceRoot":"","sources":["../../../src/pseudo/unstable.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,QAAQ;;EAGpB,CAAA"}
|
package/dist/esm/pseudo.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pseudo.d.ts","sourceRoot":"","sources":["../../src/pseudo.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAY,WAAW,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"pseudo.d.ts","sourceRoot":"","sources":["../../src/pseudo.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAY,WAAW,EAAE,MAAM,YAAY,CAAA;AAoYvD;;GAEG;AACH,eAAO,MAAM,MAAM,UAAiB,WAAW,yBAiB9C,CAAA"}
|
package/dist/esm/pseudo.js
CHANGED
|
@@ -7,6 +7,8 @@ import { asPostcssNodeWithChildren, asPseudoNode, asTagNode, isSelectorNode, } f
|
|
|
7
7
|
import { abandoned } from "./pseudo/abandoned.js";
|
|
8
8
|
import { attr } from "./pseudo/attr.js";
|
|
9
9
|
import { confused } from "./pseudo/confused.js";
|
|
10
|
+
import { cve } from "./pseudo/cve.js";
|
|
11
|
+
import { cwe } from "./pseudo/cwe.js";
|
|
10
12
|
import { debug } from "./pseudo/debug.js";
|
|
11
13
|
import { deprecated } from "./pseudo/deprecated.js";
|
|
12
14
|
import { dynamic } from "./pseudo/dynamic.js";
|
|
@@ -14,15 +16,20 @@ import { entropic } from "./pseudo/entropic.js";
|
|
|
14
16
|
import { env } from "./pseudo/env.js";
|
|
15
17
|
import { evalParser } from "./pseudo/eval.js";
|
|
16
18
|
import { fs } from "./pseudo/fs.js";
|
|
19
|
+
import { license } from "./pseudo/license.js";
|
|
20
|
+
import { malware } from "./pseudo/malware.js";
|
|
17
21
|
import { minified } from "./pseudo/minified.js";
|
|
18
22
|
import { nativeParser } from "./pseudo/native.js";
|
|
19
23
|
import { network } from "./pseudo/network.js";
|
|
20
24
|
import { obfuscated } from "./pseudo/obfuscated.js";
|
|
21
25
|
import { outdated } from "./pseudo/outdated.js";
|
|
26
|
+
import { scanned } from "./pseudo/scanned.js";
|
|
22
27
|
import { scripts } from "./pseudo/scripts.js";
|
|
23
28
|
import { shell } from "./pseudo/shell.js";
|
|
24
29
|
import { semverParser as semver } from "./pseudo/semver.js";
|
|
30
|
+
import { severity } from "./pseudo/severity.js";
|
|
25
31
|
import { shrinkwrap } from "./pseudo/shrinkwrap.js";
|
|
32
|
+
import { squat } from "./pseudo/squat.js";
|
|
26
33
|
import { suspicious } from "./pseudo/suspicious.js";
|
|
27
34
|
import { tracker } from "./pseudo/tracker.js";
|
|
28
35
|
import { trivial } from "./pseudo/trivial.js";
|
|
@@ -313,6 +320,8 @@ const pseudoSelectors = new Map(Object.entries({
|
|
|
313
320
|
abandoned,
|
|
314
321
|
attr,
|
|
315
322
|
confused,
|
|
323
|
+
cve,
|
|
324
|
+
cwe,
|
|
316
325
|
debug,
|
|
317
326
|
deprecated,
|
|
318
327
|
dynamic,
|
|
@@ -324,6 +333,8 @@ const pseudoSelectors = new Map(Object.entries({
|
|
|
324
333
|
has,
|
|
325
334
|
is,
|
|
326
335
|
// TODO: link
|
|
336
|
+
license,
|
|
337
|
+
malware,
|
|
327
338
|
minified,
|
|
328
339
|
missing,
|
|
329
340
|
native: nativeParser,
|
|
@@ -335,11 +346,15 @@ const pseudoSelectors = new Map(Object.entries({
|
|
|
335
346
|
private: privateFn,
|
|
336
347
|
project,
|
|
337
348
|
root,
|
|
349
|
+
scanned,
|
|
338
350
|
scope,
|
|
339
351
|
scripts,
|
|
340
352
|
semver,
|
|
353
|
+
sev: severity,
|
|
354
|
+
severity,
|
|
341
355
|
shell,
|
|
342
356
|
shrinkwrap,
|
|
357
|
+
squat,
|
|
343
358
|
suspicious,
|
|
344
359
|
tracker,
|
|
345
360
|
trivial,
|
|
@@ -361,7 +376,9 @@ export const pseudo = async (state) => {
|
|
|
361
376
|
if (state.loose) {
|
|
362
377
|
return state;
|
|
363
378
|
}
|
|
364
|
-
throw
|
|
379
|
+
throw error(`Unsupported pseudo-class: ${state.current.value}`, {
|
|
380
|
+
found: state.current,
|
|
381
|
+
});
|
|
365
382
|
}
|
|
366
383
|
return parserFn(state);
|
|
367
384
|
};
|
package/dist/esm/pseudo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pseudo.js","sourceRoot":"","sources":["../../src/pseudo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrE,OAAO,EACL,yBAAyB,EACzB,YAAY,EACZ,SAAS,EACT,cAAc,GACf,MAAM,YAAY,CAAA;AAGnB,4BAA4B;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,O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,CACH,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,EAAE,KAAkB,EAAE,EAAE;IACjD,MAAM,KAAK,CAAC,WAAW,EAAE,CAAA;IAEzB,MAAM,IAAI,GAAG,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACxC,MAAM,QAAQ,GACZ,IAAI,CAAC,KAAK,IAAI,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;IAExD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YAChB,OAAO,KAAK,CAAA;QACd,CAAC;QAED,MAAM,IAAI,KAAK,CACb,6BAA6B,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,CACnD,CAAA;IACH,CAAC;IACD,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAA;AACxB,CAAC,CAAA","sourcesContent":["import { splitDepID } from '@vltpkg/dep-id/browser'\nimport { error } from '@vltpkg/error-cause'\nimport type { EdgeLike, NodeLike } from '@vltpkg/graph'\nimport { asManifest } from '@vltpkg/types'\n\nimport { removeDanglingEdges, removeNode } from './pseudo/helpers.ts'\nimport {\n asPostcssNodeWithChildren,\n asPseudoNode,\n asTagNode,\n isSelectorNode,\n} from './types.ts'\nimport type { ParserFn, ParserState } from './types.ts'\n\n// imported pseudo selectors\nimport { abandoned } from './pseudo/abandoned.ts'\nimport { attr } from './pseudo/attr.ts'\nimport { confused } from './pseudo/confused.ts'\nimport { debug } from './pseudo/debug.ts'\nimport { deprecated } from './pseudo/deprecated.ts'\nimport { dynamic } from './pseudo/dynamic.ts'\nimport { entropic } from './pseudo/entropic.ts'\nimport { env } from './pseudo/env.ts'\nimport { evalParser } from './pseudo/eval.ts'\nimport { fs } from './pseudo/fs.ts'\nimport { minified } from './pseudo/minified.ts'\nimport { nativeParser } from './pseudo/native.ts'\nimport { network } from './pseudo/network.ts'\nimport { obfuscated } from './pseudo/obfuscated.ts'\nimport { outdated } from './pseudo/outdated.ts'\nimport { scripts } from './pseudo/scripts.ts'\nimport { shell } from './pseudo/shell.ts'\nimport { semverParser as semver } from './pseudo/semver.ts'\nimport { shrinkwrap } from './pseudo/shrinkwrap.ts'\nimport { suspicious } from './pseudo/suspicious.ts'\nimport { tracker } from './pseudo/tracker.ts'\nimport { trivial } from './pseudo/trivial.ts'\nimport { undesirable } from './pseudo/undesirable.ts'\nimport { unknown } from './pseudo/unknown.ts'\nimport { unmaintained } from './pseudo/unmaintained.ts'\nimport { unpopular } from './pseudo/unpopular.ts'\nimport { unstable } from './pseudo/unstable.ts'\n\n/**\n * :empty Pseudo-Selector, matches only nodes that have no children.\n */\nconst empty = async (state: ParserState) => {\n for (const node of state.partial.nodes) {\n if (node.edgesOut.size > 0) {\n removeNode(state, node)\n }\n }\n return state\n}\n\n/**\n * :has Pseudo-Selector, matches only nodes that have valid results\n * for its nested selector expressions.\n */\nconst has = async (state: ParserState) => {\n const top = asPostcssNodeWithChildren(state.current)\n const collectNodes = new Set<NodeLike>()\n const collectEdges = new Set<EdgeLike>()\n\n for (const node of top.nodes) {\n if (isSelectorNode(node)) {\n const nestedState = await state.walk({\n cancellable: state.cancellable,\n initial: {\n edges: new Set(state.initial.edges),\n nodes: new Set(state.initial.nodes),\n },\n current: node,\n walk: state.walk,\n collect: {\n edges: new Set(),\n nodes: new Set(),\n },\n partial: {\n edges: new Set(state.partial.edges),\n nodes: new Set(state.partial.nodes),\n },\n securityArchive: state.securityArchive,\n specOptions: state.specOptions,\n })\n for (const n of nestedState.collect.nodes) {\n collectNodes.add(n)\n }\n for (const e of nestedState.partial.edges) {\n collectEdges.add(e)\n }\n }\n }\n\n // if the nested selector did not match anything, that means\n // no current node has any matches\n if (collectNodes.size === 0) {\n state.partial.edges.clear()\n state.partial.nodes.clear()\n return state\n }\n\n // handles transitive dependencies\n // compareNodes collects a list of all ancestor nodes\n // from the resulting nodes of the nested selector\n const compareNodes = new Set<NodeLike>()\n const traverse = new Set(collectNodes)\n for (const node of traverse) {\n for (const edge of node.edgesIn) {\n compareNodes.add(edge.from)\n if (edge.from.edgesIn.size) {\n traverse.add(edge.from)\n }\n }\n }\n\n // for each node in the current list checks to see if\n // it has a node in the resulting nested state that is\n // a transitive dependency / children.\n nodesLoop: for (const node of state.partial.nodes) {\n if (node.edgesOut.size === 0 || !compareNodes.has(node)) {\n removeNode(state, node)\n continue\n }\n\n for (const edge of node.edgesOut.values()) {\n if (collectEdges.has(edge)) {\n continue nodesLoop\n }\n }\n removeNode(state, node)\n }\n\n removeDanglingEdges(state)\n\n return state\n}\n\n/**\n * :is Pseudo-selector, acts as a shortcut for writing more compact expressions\n * by allowing multiple nested selectors to match on the previous results.\n *\n * It also enables the loose parsing mode, skipping instead of erroring usage\n * of non-existing classes, identifiers, pseudo-classes, etc.\n */\nconst is = async (state: ParserState) => {\n const top = asPostcssNodeWithChildren(state.current)\n const collect = new Set()\n for (const node of top.nodes) {\n if (isSelectorNode(node)) {\n const nestedState = await state.walk({\n cancellable: state.cancellable,\n collect: {\n edges: new Set(),\n nodes: new Set(),\n },\n current: node,\n initial: state.initial,\n loose: true,\n partial: {\n nodes: new Set(state.partial.nodes),\n edges: new Set(state.partial.edges),\n },\n walk: state.walk,\n securityArchive: state.securityArchive,\n specOptions: state.specOptions,\n })\n for (const n of nestedState.collect.nodes) {\n collect.add(n)\n }\n }\n }\n for (const node of state.partial.nodes) {\n if (!collect.has(node)) {\n removeNode(state, node)\n }\n }\n return state\n}\n\n/**\n * :missing Pseudo-Selector, matches only\n * edges that are not linked to any node.\n */\nconst missing = async (state: ParserState) => {\n for (const edge of state.partial.edges) {\n if (edge.to) {\n state.partial.edges.delete(edge)\n }\n }\n state.partial.nodes.clear()\n return state\n}\n\n/**\n * :not Pseudo-class, serves to create negate expressions, anything that\n * matches selectors declared inside the `:not()` expression is going to be\n * filtered out in the final result.\n */\nconst not = async (state: ParserState) => {\n const top = asPostcssNodeWithChildren(state.current)\n const collect = new Set()\n for (const node of top.nodes) {\n if (isSelectorNode(node)) {\n const nestedState = await state.walk({\n cancellable: state.cancellable,\n collect: {\n edges: new Set(),\n nodes: new Set(),\n },\n current: node,\n initial: state.initial,\n partial: {\n nodes: new Set(state.partial.nodes),\n edges: new Set(state.partial.edges),\n },\n walk: state.walk,\n securityArchive: state.securityArchive,\n specOptions: state.specOptions,\n })\n for (const n of nestedState.collect.nodes) {\n collect.add(n)\n }\n /* c8 ignore start - should be impossible */\n } else {\n throw error('Error parsing :not() selectors', {\n wanted: { type: 'selector' },\n found: node,\n })\n }\n /* c8 ignore stop */\n }\n for (const node of state.partial.nodes) {\n if (collect.has(node)) {\n removeNode(state, node)\n }\n }\n return state\n}\n\n/**\n * :private Pseudo-Selector will only match packages that have\n * a `private: true` key set in their `package.json` metadata.\n */\nconst privateFn = async (state: ParserState) => {\n for (const node of state.partial.nodes) {\n if (!node.manifest || !asManifest(node.manifest).private) {\n removeNode(state, node)\n }\n }\n\n removeDanglingEdges(state)\n\n return state\n}\n\n/**\n * :root Pseudo-Element will return the project root node for the graph.\n */\nconst root = async (state: ParserState) => {\n const [anyNode] = state.initial.nodes.values()\n const mainImporter = anyNode?.graph.mainImporter\n if (!mainImporter) {\n throw error(':root pseudo-element works on local graphs only')\n }\n for (const edge of state.partial.edges) {\n if (edge.to !== mainImporter) {\n state.partial.edges.delete(edge)\n }\n }\n state.partial.nodes.clear()\n state.partial.nodes.add(mainImporter)\n return state\n}\n\n/**\n * :project Pseudo-Element, returns all graph importers (e.g: the\n * root node along with any configured workspace)\n */\nconst project = async (state: ParserState) => {\n const [anyNode] = state.initial.nodes.values()\n const importers = anyNode?.graph.importers\n if (!importers?.size) {\n throw error(':project pseudo-element works on local graphs only')\n }\n\n // make a list of all edges that are coming from importers\n // so that we can filter out any edges that are not direct\n // dependencies of the importers\n const importersEdgesIn = new Set<EdgeLike>()\n for (const importer of importers) {\n for (const edge of importer.edgesIn) {\n importersEdgesIn.add(edge)\n }\n }\n\n for (const edge of state.partial.edges) {\n if (!edge.to || !importersEdgesIn.has(edge)) {\n state.partial.edges.delete(edge)\n }\n }\n state.partial.nodes.clear()\n for (const importer of importers) {\n state.partial.nodes.add(importer)\n }\n return state\n}\n\n/**\n * :scope Pseudo-Element, returns the original scope of items\n * at the start of a given selector.\n */\nconst scope = async (state: ParserState) => {\n state.partial.edges.clear()\n state.partial.nodes.clear()\n for (const edge of state.initial.edges) {\n state.partial.edges.add(edge)\n }\n for (const node of state.initial.nodes) {\n state.partial.nodes.add(node)\n }\n return state\n}\n\n/**\n * :type(str) Pseudo-Element will match only nodes that are of\n * the same type as the value used\n */\nconst typeFn = async (state: ParserState) => {\n const type = asPostcssNodeWithChildren(state.current)\n const selector = asPostcssNodeWithChildren(type.nodes[0])\n const name = asTagNode(selector.nodes[0]).value\n for (const node of state.partial.nodes) {\n const nodeType = splitDepID(node.id)[0]\n if (nodeType !== name) {\n removeNode(state, node)\n }\n }\n return state\n}\n\nconst pseudoSelectors = new Map<string, ParserFn>(\n Object.entries({\n abandoned,\n attr,\n confused,\n debug,\n deprecated,\n dynamic,\n eval: evalParser,\n empty,\n entropic,\n env,\n fs,\n has,\n is,\n // TODO: link\n minified,\n missing,\n native: nativeParser,\n network,\n not,\n obfuscated,\n outdated,\n // TODO: overridden\n private: privateFn,\n project,\n root,\n scope,\n scripts,\n semver,\n shell,\n shrinkwrap,\n suspicious,\n tracker,\n trivial,\n type: typeFn,\n undesirable,\n unknown,\n unmaintained,\n unpopular,\n unstable,\n }),\n)\n\n/**\n * Parsers the `pseudo` node types.\n */\nexport const pseudo = async (state: ParserState) => {\n await state.cancellable()\n\n const curr = asPseudoNode(state.current)\n const parserFn =\n curr.value && pseudoSelectors.get(curr.value.slice(1))\n\n if (!parserFn) {\n if (state.loose) {\n return state\n }\n\n throw new Error(\n `Unsupported pseudo-class: ${state.current.value}`,\n )\n }\n return parserFn(state)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"pseud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C,MAAM,MAAM,GAAG,KAAK,EAAE,KAAkB,EAAE,EAAE;IACjD,MAAM,KAAK,CAAC,WAAW,EAAE,CAAA;IAEzB,MAAM,IAAI,GAAG,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACxC,MAAM,QAAQ,GACZ,IAAI,CAAC,KAAK,IAAI,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;IAExD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YAChB,OAAO,KAAK,CAAA;QACd,CAAC;QAED,MAAM,KAAK,CAAC,6BAA6B,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE;YAC9D,KAAK,EAAE,KAAK,CAAC,OAAO;SACrB,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAA;AACxB,CAAC,CAAA","sourcesContent":["import { splitDepID } from '@vltpkg/dep-id/browser'\nimport { error } from '@vltpkg/error-cause'\nimport type { EdgeLike, NodeLike } from '@vltpkg/graph'\nimport { asManifest } from '@vltpkg/types'\n\nimport { removeDanglingEdges, removeNode } from './pseudo/helpers.ts'\nimport {\n asPostcssNodeWithChildren,\n asPseudoNode,\n asTagNode,\n isSelectorNode,\n} from './types.ts'\nimport type { ParserFn, ParserState } from './types.ts'\n\n// imported pseudo selectors\nimport { abandoned } from './pseudo/abandoned.ts'\nimport { attr } from './pseudo/attr.ts'\nimport { confused } from './pseudo/confused.ts'\nimport { cve } from './pseudo/cve.ts'\nimport { cwe } from './pseudo/cwe.ts'\nimport { debug } from './pseudo/debug.ts'\nimport { deprecated } from './pseudo/deprecated.ts'\nimport { dynamic } from './pseudo/dynamic.ts'\nimport { entropic } from './pseudo/entropic.ts'\nimport { env } from './pseudo/env.ts'\nimport { evalParser } from './pseudo/eval.ts'\nimport { fs } from './pseudo/fs.ts'\nimport { license } from './pseudo/license.ts'\nimport { malware } from './pseudo/malware.ts'\nimport { minified } from './pseudo/minified.ts'\nimport { nativeParser } from './pseudo/native.ts'\nimport { network } from './pseudo/network.ts'\nimport { obfuscated } from './pseudo/obfuscated.ts'\nimport { outdated } from './pseudo/outdated.ts'\nimport { scanned } from './pseudo/scanned.ts'\nimport { scripts } from './pseudo/scripts.ts'\nimport { shell } from './pseudo/shell.ts'\nimport { semverParser as semver } from './pseudo/semver.ts'\nimport { severity } from './pseudo/severity.ts'\nimport { shrinkwrap } from './pseudo/shrinkwrap.ts'\nimport { squat } from './pseudo/squat.ts'\nimport { suspicious } from './pseudo/suspicious.ts'\nimport { tracker } from './pseudo/tracker.ts'\nimport { trivial } from './pseudo/trivial.ts'\nimport { undesirable } from './pseudo/undesirable.ts'\nimport { unknown } from './pseudo/unknown.ts'\nimport { unmaintained } from './pseudo/unmaintained.ts'\nimport { unpopular } from './pseudo/unpopular.ts'\nimport { unstable } from './pseudo/unstable.ts'\n\n/**\n * :empty Pseudo-Selector, matches only nodes that have no children.\n */\nconst empty = async (state: ParserState) => {\n for (const node of state.partial.nodes) {\n if (node.edgesOut.size > 0) {\n removeNode(state, node)\n }\n }\n return state\n}\n\n/**\n * :has Pseudo-Selector, matches only nodes that have valid results\n * for its nested selector expressions.\n */\nconst has = async (state: ParserState) => {\n const top = asPostcssNodeWithChildren(state.current)\n const collectNodes = new Set<NodeLike>()\n const collectEdges = new Set<EdgeLike>()\n\n for (const node of top.nodes) {\n if (isSelectorNode(node)) {\n const nestedState = await state.walk({\n cancellable: state.cancellable,\n initial: {\n edges: new Set(state.initial.edges),\n nodes: new Set(state.initial.nodes),\n },\n current: node,\n walk: state.walk,\n collect: {\n edges: new Set(),\n nodes: new Set(),\n },\n partial: {\n edges: new Set(state.partial.edges),\n nodes: new Set(state.partial.nodes),\n },\n securityArchive: state.securityArchive,\n specOptions: state.specOptions,\n })\n for (const n of nestedState.collect.nodes) {\n collectNodes.add(n)\n }\n for (const e of nestedState.partial.edges) {\n collectEdges.add(e)\n }\n }\n }\n\n // if the nested selector did not match anything, that means\n // no current node has any matches\n if (collectNodes.size === 0) {\n state.partial.edges.clear()\n state.partial.nodes.clear()\n return state\n }\n\n // handles transitive dependencies\n // compareNodes collects a list of all ancestor nodes\n // from the resulting nodes of the nested selector\n const compareNodes = new Set<NodeLike>()\n const traverse = new Set(collectNodes)\n for (const node of traverse) {\n for (const edge of node.edgesIn) {\n compareNodes.add(edge.from)\n if (edge.from.edgesIn.size) {\n traverse.add(edge.from)\n }\n }\n }\n\n // for each node in the current list checks to see if\n // it has a node in the resulting nested state that is\n // a transitive dependency / children.\n nodesLoop: for (const node of state.partial.nodes) {\n if (node.edgesOut.size === 0 || !compareNodes.has(node)) {\n removeNode(state, node)\n continue\n }\n\n for (const edge of node.edgesOut.values()) {\n if (collectEdges.has(edge)) {\n continue nodesLoop\n }\n }\n removeNode(state, node)\n }\n\n removeDanglingEdges(state)\n\n return state\n}\n\n/**\n * :is Pseudo-selector, acts as a shortcut for writing more compact expressions\n * by allowing multiple nested selectors to match on the previous results.\n *\n * It also enables the loose parsing mode, skipping instead of erroring usage\n * of non-existing classes, identifiers, pseudo-classes, etc.\n */\nconst is = async (state: ParserState) => {\n const top = asPostcssNodeWithChildren(state.current)\n const collect = new Set()\n for (const node of top.nodes) {\n if (isSelectorNode(node)) {\n const nestedState = await state.walk({\n cancellable: state.cancellable,\n collect: {\n edges: new Set(),\n nodes: new Set(),\n },\n current: node,\n initial: state.initial,\n loose: true,\n partial: {\n nodes: new Set(state.partial.nodes),\n edges: new Set(state.partial.edges),\n },\n walk: state.walk,\n securityArchive: state.securityArchive,\n specOptions: state.specOptions,\n })\n for (const n of nestedState.collect.nodes) {\n collect.add(n)\n }\n }\n }\n for (const node of state.partial.nodes) {\n if (!collect.has(node)) {\n removeNode(state, node)\n }\n }\n return state\n}\n\n/**\n * :missing Pseudo-Selector, matches only\n * edges that are not linked to any node.\n */\nconst missing = async (state: ParserState) => {\n for (const edge of state.partial.edges) {\n if (edge.to) {\n state.partial.edges.delete(edge)\n }\n }\n state.partial.nodes.clear()\n return state\n}\n\n/**\n * :not Pseudo-class, serves to create negate expressions, anything that\n * matches selectors declared inside the `:not()` expression is going to be\n * filtered out in the final result.\n */\nconst not = async (state: ParserState) => {\n const top = asPostcssNodeWithChildren(state.current)\n const collect = new Set()\n for (const node of top.nodes) {\n if (isSelectorNode(node)) {\n const nestedState = await state.walk({\n cancellable: state.cancellable,\n collect: {\n edges: new Set(),\n nodes: new Set(),\n },\n current: node,\n initial: state.initial,\n partial: {\n nodes: new Set(state.partial.nodes),\n edges: new Set(state.partial.edges),\n },\n walk: state.walk,\n securityArchive: state.securityArchive,\n specOptions: state.specOptions,\n })\n for (const n of nestedState.collect.nodes) {\n collect.add(n)\n }\n /* c8 ignore start - should be impossible */\n } else {\n throw error('Error parsing :not() selectors', {\n wanted: { type: 'selector' },\n found: node,\n })\n }\n /* c8 ignore stop */\n }\n for (const node of state.partial.nodes) {\n if (collect.has(node)) {\n removeNode(state, node)\n }\n }\n return state\n}\n\n/**\n * :private Pseudo-Selector will only match packages that have\n * a `private: true` key set in their `package.json` metadata.\n */\nconst privateFn = async (state: ParserState) => {\n for (const node of state.partial.nodes) {\n if (!node.manifest || !asManifest(node.manifest).private) {\n removeNode(state, node)\n }\n }\n\n removeDanglingEdges(state)\n\n return state\n}\n\n/**\n * :root Pseudo-Element will return the project root node for the graph.\n */\nconst root = async (state: ParserState) => {\n const [anyNode] = state.initial.nodes.values()\n const mainImporter = anyNode?.graph.mainImporter\n if (!mainImporter) {\n throw error(':root pseudo-element works on local graphs only')\n }\n for (const edge of state.partial.edges) {\n if (edge.to !== mainImporter) {\n state.partial.edges.delete(edge)\n }\n }\n state.partial.nodes.clear()\n state.partial.nodes.add(mainImporter)\n return state\n}\n\n/**\n * :project Pseudo-Element, returns all graph importers (e.g: the\n * root node along with any configured workspace)\n */\nconst project = async (state: ParserState) => {\n const [anyNode] = state.initial.nodes.values()\n const importers = anyNode?.graph.importers\n if (!importers?.size) {\n throw error(':project pseudo-element works on local graphs only')\n }\n\n // make a list of all edges that are coming from importers\n // so that we can filter out any edges that are not direct\n // dependencies of the importers\n const importersEdgesIn = new Set<EdgeLike>()\n for (const importer of importers) {\n for (const edge of importer.edgesIn) {\n importersEdgesIn.add(edge)\n }\n }\n\n for (const edge of state.partial.edges) {\n if (!edge.to || !importersEdgesIn.has(edge)) {\n state.partial.edges.delete(edge)\n }\n }\n state.partial.nodes.clear()\n for (const importer of importers) {\n state.partial.nodes.add(importer)\n }\n return state\n}\n\n/**\n * :scope Pseudo-Element, returns the original scope of items\n * at the start of a given selector.\n */\nconst scope = async (state: ParserState) => {\n state.partial.edges.clear()\n state.partial.nodes.clear()\n for (const edge of state.initial.edges) {\n state.partial.edges.add(edge)\n }\n for (const node of state.initial.nodes) {\n state.partial.nodes.add(node)\n }\n return state\n}\n\n/**\n * :type(str) Pseudo-Element will match only nodes that are of\n * the same type as the value used\n */\nconst typeFn = async (state: ParserState) => {\n const type = asPostcssNodeWithChildren(state.current)\n const selector = asPostcssNodeWithChildren(type.nodes[0])\n const name = asTagNode(selector.nodes[0]).value\n for (const node of state.partial.nodes) {\n const nodeType = splitDepID(node.id)[0]\n if (nodeType !== name) {\n removeNode(state, node)\n }\n }\n return state\n}\n\nconst pseudoSelectors = new Map<string, ParserFn>(\n Object.entries({\n abandoned,\n attr,\n confused,\n cve,\n cwe,\n debug,\n deprecated,\n dynamic,\n eval: evalParser,\n empty,\n entropic,\n env,\n fs,\n has,\n is,\n // TODO: link\n license,\n malware,\n minified,\n missing,\n native: nativeParser,\n network,\n not,\n obfuscated,\n outdated,\n // TODO: overridden\n private: privateFn,\n project,\n root,\n scanned,\n scope,\n scripts,\n semver,\n sev: severity,\n severity,\n shell,\n shrinkwrap,\n squat,\n suspicious,\n tracker,\n trivial,\n type: typeFn,\n undesirable,\n unknown,\n unmaintained,\n unpopular,\n unstable,\n }),\n)\n\n/**\n * Parsers the `pseudo` node types.\n */\nexport const pseudo = async (state: ParserState) => {\n await state.cancellable()\n\n const curr = asPseudoNode(state.current)\n const parserFn =\n curr.value && pseudoSelectors.get(curr.value.slice(1))\n\n if (!parserFn) {\n if (state.loose) {\n return state\n }\n\n throw error(`Unsupported pseudo-class: ${state.current.value}`, {\n found: state.current,\n })\n }\n return parserFn(state)\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vltpkg/query",
|
|
3
3
|
"description": "Query syntax parser that retrieves items from a graph",
|
|
4
|
-
"version": "0.0.0-
|
|
4
|
+
"version": "0.0.0-8",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/vltpkg/vltpkg.git",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"postcss-selector-parser": "^6.1.2",
|
|
23
|
-
"@vltpkg/dep-id": "0.0.0-
|
|
24
|
-
"@vltpkg/
|
|
25
|
-
"@vltpkg/graph": "0.0.0-
|
|
26
|
-
"@vltpkg/
|
|
27
|
-
"@vltpkg/semver": "0.0.0-
|
|
28
|
-
"@vltpkg/
|
|
23
|
+
"@vltpkg/dep-id": "0.0.0-8",
|
|
24
|
+
"@vltpkg/security-archive": "0.0.0-8",
|
|
25
|
+
"@vltpkg/graph": "0.0.0-8",
|
|
26
|
+
"@vltpkg/types": "0.0.0-8",
|
|
27
|
+
"@vltpkg/semver": "0.0.0-8",
|
|
28
|
+
"@vltpkg/error-cause": "0.0.0-8"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@eslint/js": "^9.20.0",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"typedoc": "0.27.6",
|
|
39
39
|
"typescript": "5.7.3",
|
|
40
40
|
"typescript-eslint": "^8.23.0",
|
|
41
|
-
"@vltpkg/spec": "0.0.0-
|
|
41
|
+
"@vltpkg/spec": "0.0.0-8"
|
|
42
42
|
},
|
|
43
43
|
"license": "BSD-2-Clause-Patent",
|
|
44
44
|
"engines": {
|