@vltpkg/query 1.0.0-rc.2 → 1.0.0-rc.22
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/package.json +36 -47
- package/dist/esm/attribute.d.ts +0 -15
- package/dist/esm/attribute.d.ts.map +0 -1
- package/dist/esm/attribute.js +0 -133
- package/dist/esm/attribute.js.map +0 -1
- package/dist/esm/combinator.d.ts +0 -6
- package/dist/esm/combinator.d.ts.map +0 -1
- package/dist/esm/combinator.js +0 -112
- package/dist/esm/combinator.js.map +0 -1
- package/dist/esm/id.d.ts +0 -6
- package/dist/esm/id.d.ts.map +0 -1
- package/dist/esm/id.js +0 -36
- package/dist/esm/id.js.map +0 -1
- package/dist/esm/index.d.ts +0 -48
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/index.js +0 -408
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/package.json +0 -3
- package/dist/esm/parser.d.ts +0 -15
- package/dist/esm/parser.d.ts.map +0 -1
- package/dist/esm/parser.js +0 -93
- package/dist/esm/parser.js.map +0 -1
- package/dist/esm/pseudo/abandoned.d.ts +0 -7
- package/dist/esm/pseudo/abandoned.d.ts.map +0 -1
- package/dist/esm/pseudo/abandoned.js +0 -6
- package/dist/esm/pseudo/abandoned.js.map +0 -1
- package/dist/esm/pseudo/attr.d.ts +0 -19
- package/dist/esm/pseudo/attr.d.ts.map +0 -1
- package/dist/esm/pseudo/attr.js +0 -58
- package/dist/esm/pseudo/attr.js.map +0 -1
- package/dist/esm/pseudo/built.d.ts +0 -8
- package/dist/esm/pseudo/built.d.ts.map +0 -1
- package/dist/esm/pseudo/built.js +0 -16
- package/dist/esm/pseudo/built.js.map +0 -1
- package/dist/esm/pseudo/confused.d.ts +0 -9
- package/dist/esm/pseudo/confused.d.ts.map +0 -1
- package/dist/esm/pseudo/confused.js +0 -19
- package/dist/esm/pseudo/confused.js.map +0 -1
- package/dist/esm/pseudo/cve.d.ts +0 -13
- package/dist/esm/pseudo/cve.d.ts.map +0 -1
- package/dist/esm/pseudo/cve.js +0 -44
- package/dist/esm/pseudo/cve.js.map +0 -1
- package/dist/esm/pseudo/cwe.d.ts +0 -13
- package/dist/esm/pseudo/cwe.d.ts.map +0 -1
- package/dist/esm/pseudo/cwe.js +0 -43
- package/dist/esm/pseudo/cwe.js.map +0 -1
- package/dist/esm/pseudo/debug.d.ts +0 -7
- package/dist/esm/pseudo/debug.d.ts.map +0 -1
- package/dist/esm/pseudo/debug.js +0 -6
- package/dist/esm/pseudo/debug.js.map +0 -1
- package/dist/esm/pseudo/deprecated.d.ts +0 -7
- package/dist/esm/pseudo/deprecated.d.ts.map +0 -1
- package/dist/esm/pseudo/deprecated.js +0 -6
- package/dist/esm/pseudo/deprecated.js.map +0 -1
- package/dist/esm/pseudo/dev.d.ts +0 -6
- package/dist/esm/pseudo/dev.d.ts.map +0 -1
- package/dist/esm/pseudo/dev.js +0 -15
- package/dist/esm/pseudo/dev.js.map +0 -1
- package/dist/esm/pseudo/dynamic.d.ts +0 -7
- package/dist/esm/pseudo/dynamic.d.ts.map +0 -1
- package/dist/esm/pseudo/dynamic.js +0 -6
- package/dist/esm/pseudo/dynamic.js.map +0 -1
- package/dist/esm/pseudo/empty.d.ts +0 -7
- package/dist/esm/pseudo/empty.d.ts.map +0 -1
- package/dist/esm/pseudo/empty.js +0 -14
- package/dist/esm/pseudo/empty.js.map +0 -1
- package/dist/esm/pseudo/entropic.d.ts +0 -7
- package/dist/esm/pseudo/entropic.d.ts.map +0 -1
- package/dist/esm/pseudo/entropic.js +0 -6
- package/dist/esm/pseudo/entropic.js.map +0 -1
- package/dist/esm/pseudo/env.d.ts +0 -7
- package/dist/esm/pseudo/env.d.ts.map +0 -1
- package/dist/esm/pseudo/env.js +0 -6
- package/dist/esm/pseudo/env.js.map +0 -1
- package/dist/esm/pseudo/eval.d.ts +0 -7
- package/dist/esm/pseudo/eval.d.ts.map +0 -1
- package/dist/esm/pseudo/eval.js +0 -6
- package/dist/esm/pseudo/eval.js.map +0 -1
- package/dist/esm/pseudo/fs.d.ts +0 -7
- package/dist/esm/pseudo/fs.d.ts.map +0 -1
- package/dist/esm/pseudo/fs.js +0 -6
- package/dist/esm/pseudo/fs.js.map +0 -1
- package/dist/esm/pseudo/helpers.d.ts +0 -39
- package/dist/esm/pseudo/helpers.d.ts.map +0 -1
- package/dist/esm/pseudo/helpers.js +0 -77
- package/dist/esm/pseudo/helpers.js.map +0 -1
- package/dist/esm/pseudo/host.d.ts +0 -20
- package/dist/esm/pseudo/host.d.ts.map +0 -1
- package/dist/esm/pseudo/host.js +0 -80
- package/dist/esm/pseudo/host.js.map +0 -1
- package/dist/esm/pseudo/license.d.ts +0 -13
- package/dist/esm/pseudo/license.d.ts.map +0 -1
- package/dist/esm/pseudo/license.js +0 -75
- package/dist/esm/pseudo/license.js.map +0 -1
- package/dist/esm/pseudo/link.d.ts +0 -9
- package/dist/esm/pseudo/link.d.ts.map +0 -1
- package/dist/esm/pseudo/link.js +0 -25
- package/dist/esm/pseudo/link.js.map +0 -1
- package/dist/esm/pseudo/malware.d.ts +0 -24
- package/dist/esm/pseudo/malware.d.ts.map +0 -1
- package/dist/esm/pseudo/malware.js +0 -187
- package/dist/esm/pseudo/malware.js.map +0 -1
- package/dist/esm/pseudo/minified.d.ts +0 -7
- package/dist/esm/pseudo/minified.d.ts.map +0 -1
- package/dist/esm/pseudo/minified.js +0 -6
- package/dist/esm/pseudo/minified.js.map +0 -1
- package/dist/esm/pseudo/missing.d.ts +0 -8
- package/dist/esm/pseudo/missing.d.ts.map +0 -1
- package/dist/esm/pseudo/missing.js +0 -15
- package/dist/esm/pseudo/missing.js.map +0 -1
- package/dist/esm/pseudo/native.d.ts +0 -7
- package/dist/esm/pseudo/native.d.ts.map +0 -1
- package/dist/esm/pseudo/native.js +0 -6
- package/dist/esm/pseudo/native.js.map +0 -1
- package/dist/esm/pseudo/network.d.ts +0 -7
- package/dist/esm/pseudo/network.d.ts.map +0 -1
- package/dist/esm/pseudo/network.js +0 -6
- package/dist/esm/pseudo/network.js.map +0 -1
- package/dist/esm/pseudo/obfuscated.d.ts +0 -7
- package/dist/esm/pseudo/obfuscated.d.ts.map +0 -1
- package/dist/esm/pseudo/obfuscated.js +0 -6
- package/dist/esm/pseudo/obfuscated.js.map +0 -1
- package/dist/esm/pseudo/optional.d.ts +0 -6
- package/dist/esm/pseudo/optional.d.ts.map +0 -1
- package/dist/esm/pseudo/optional.js +0 -15
- package/dist/esm/pseudo/optional.js.map +0 -1
- package/dist/esm/pseudo/outdated.d.ts +0 -54
- package/dist/esm/pseudo/outdated.d.ts.map +0 -1
- package/dist/esm/pseudo/outdated.js +0 -212
- package/dist/esm/pseudo/outdated.js.map +0 -1
- package/dist/esm/pseudo/overridden.d.ts +0 -8
- package/dist/esm/pseudo/overridden.d.ts.map +0 -1
- package/dist/esm/pseudo/overridden.js +0 -17
- package/dist/esm/pseudo/overridden.js.map +0 -1
- package/dist/esm/pseudo/path.d.ts +0 -19
- package/dist/esm/pseudo/path.d.ts.map +0 -1
- package/dist/esm/pseudo/path.js +0 -113
- package/dist/esm/pseudo/path.js.map +0 -1
- package/dist/esm/pseudo/peer.d.ts +0 -6
- package/dist/esm/pseudo/peer.d.ts.map +0 -1
- package/dist/esm/pseudo/peer.js +0 -15
- package/dist/esm/pseudo/peer.js.map +0 -1
- package/dist/esm/pseudo/prerelease.d.ts +0 -18
- package/dist/esm/pseudo/prerelease.d.ts.map +0 -1
- package/dist/esm/pseudo/prerelease.js +0 -41
- package/dist/esm/pseudo/prerelease.js.map +0 -1
- package/dist/esm/pseudo/private.d.ts +0 -7
- package/dist/esm/pseudo/private.d.ts.map +0 -1
- package/dist/esm/pseudo/private.js +0 -16
- package/dist/esm/pseudo/private.js.map +0 -1
- package/dist/esm/pseudo/prod.d.ts +0 -6
- package/dist/esm/pseudo/prod.d.ts.map +0 -1
- package/dist/esm/pseudo/prod.js +0 -15
- package/dist/esm/pseudo/prod.js.map +0 -1
- package/dist/esm/pseudo/published.d.ts +0 -40
- package/dist/esm/pseudo/published.d.ts.map +0 -1
- package/dist/esm/pseudo/published.js +0 -180
- package/dist/esm/pseudo/published.js.map +0 -1
- package/dist/esm/pseudo/root.d.ts +0 -7
- package/dist/esm/pseudo/root.d.ts.map +0 -1
- package/dist/esm/pseudo/root.js +0 -18
- package/dist/esm/pseudo/root.js.map +0 -1
- package/dist/esm/pseudo/scanned.d.ts +0 -9
- package/dist/esm/pseudo/scanned.d.ts.map +0 -1
- package/dist/esm/pseudo/scanned.js +0 -17
- package/dist/esm/pseudo/scanned.js.map +0 -1
- package/dist/esm/pseudo/score.d.ts +0 -16
- package/dist/esm/pseudo/score.d.ts.map +0 -1
- package/dist/esm/pseudo/score.js +0 -133
- package/dist/esm/pseudo/score.js.map +0 -1
- package/dist/esm/pseudo/scripts.d.ts +0 -10
- package/dist/esm/pseudo/scripts.d.ts.map +0 -1
- package/dist/esm/pseudo/scripts.js +0 -44
- package/dist/esm/pseudo/scripts.js.map +0 -1
- package/dist/esm/pseudo/semver.d.ts +0 -17
- package/dist/esm/pseudo/semver.d.ts.map +0 -1
- package/dist/esm/pseudo/semver.js +0 -167
- package/dist/esm/pseudo/semver.js.map +0 -1
- package/dist/esm/pseudo/severity.d.ts +0 -15
- package/dist/esm/pseudo/severity.d.ts.map +0 -1
- package/dist/esm/pseudo/severity.js +0 -160
- package/dist/esm/pseudo/severity.js.map +0 -1
- package/dist/esm/pseudo/shell.d.ts +0 -7
- package/dist/esm/pseudo/shell.d.ts.map +0 -1
- package/dist/esm/pseudo/shell.js +0 -6
- package/dist/esm/pseudo/shell.js.map +0 -1
- package/dist/esm/pseudo/shrinkwrap.d.ts +0 -7
- package/dist/esm/pseudo/shrinkwrap.d.ts.map +0 -1
- package/dist/esm/pseudo/shrinkwrap.js +0 -6
- package/dist/esm/pseudo/shrinkwrap.js.map +0 -1
- package/dist/esm/pseudo/spec.d.ts +0 -17
- package/dist/esm/pseudo/spec.d.ts.map +0 -1
- package/dist/esm/pseudo/spec.js +0 -102
- package/dist/esm/pseudo/spec.js.map +0 -1
- package/dist/esm/pseudo/squat.d.ts +0 -15
- package/dist/esm/pseudo/squat.d.ts.map +0 -1
- package/dist/esm/pseudo/squat.js +0 -172
- package/dist/esm/pseudo/squat.js.map +0 -1
- package/dist/esm/pseudo/suspicious.d.ts +0 -7
- package/dist/esm/pseudo/suspicious.d.ts.map +0 -1
- package/dist/esm/pseudo/suspicious.js +0 -6
- package/dist/esm/pseudo/suspicious.js.map +0 -1
- package/dist/esm/pseudo/tracker.d.ts +0 -7
- package/dist/esm/pseudo/tracker.d.ts.map +0 -1
- package/dist/esm/pseudo/tracker.js +0 -6
- package/dist/esm/pseudo/tracker.js.map +0 -1
- package/dist/esm/pseudo/trivial.d.ts +0 -7
- package/dist/esm/pseudo/trivial.d.ts.map +0 -1
- package/dist/esm/pseudo/trivial.js +0 -6
- package/dist/esm/pseudo/trivial.js.map +0 -1
- package/dist/esm/pseudo/type.d.ts +0 -8
- package/dist/esm/pseudo/type.d.ts.map +0 -1
- package/dist/esm/pseudo/type.js +0 -22
- package/dist/esm/pseudo/type.js.map +0 -1
- package/dist/esm/pseudo/undesirable.d.ts +0 -7
- package/dist/esm/pseudo/undesirable.d.ts.map +0 -1
- package/dist/esm/pseudo/undesirable.js +0 -6
- package/dist/esm/pseudo/undesirable.js.map +0 -1
- package/dist/esm/pseudo/unknown.d.ts +0 -7
- package/dist/esm/pseudo/unknown.d.ts.map +0 -1
- package/dist/esm/pseudo/unknown.js +0 -6
- package/dist/esm/pseudo/unknown.js.map +0 -1
- package/dist/esm/pseudo/unmaintained.d.ts +0 -7
- package/dist/esm/pseudo/unmaintained.d.ts.map +0 -1
- package/dist/esm/pseudo/unmaintained.js +0 -6
- package/dist/esm/pseudo/unmaintained.js.map +0 -1
- package/dist/esm/pseudo/unpopular.d.ts +0 -7
- package/dist/esm/pseudo/unpopular.d.ts.map +0 -1
- package/dist/esm/pseudo/unpopular.js +0 -6
- package/dist/esm/pseudo/unpopular.js.map +0 -1
- package/dist/esm/pseudo/unstable.d.ts +0 -7
- package/dist/esm/pseudo/unstable.d.ts.map +0 -1
- package/dist/esm/pseudo/unstable.js +0 -6
- package/dist/esm/pseudo/unstable.js.map +0 -1
- package/dist/esm/pseudo/workspace.d.ts +0 -6
- package/dist/esm/pseudo/workspace.d.ts.map +0 -1
- package/dist/esm/pseudo/workspace.js +0 -20
- package/dist/esm/pseudo/workspace.js.map +0 -1
- package/dist/esm/pseudo.d.ts +0 -6
- package/dist/esm/pseudo.d.ts.map +0 -1
- package/dist/esm/pseudo.js +0 -361
- package/dist/esm/pseudo.js.map +0 -1
- package/dist/esm/types.d.ts +0 -118
- package/dist/esm/types.d.ts.map +0 -1
- package/dist/esm/types.js +0 -2
- package/dist/esm/types.js.map +0 -1
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filters out any node that does not have a **shellAccess** report alert.
|
|
3
|
-
*/
|
|
4
|
-
export declare const shell: (state: import("../types.ts").ParserState) => Promise<import("../types.ts").ParserState & {
|
|
5
|
-
securityArchive: NonNullable<import("../types.ts").ParserState["securityArchive"]>;
|
|
6
|
-
}>;
|
|
7
|
-
//# sourceMappingURL=shell.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../src/pseudo/shell.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,KAAK;;EAGjB,CAAA"}
|
package/dist/esm/pseudo/shell.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../../src/pseudo/shell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAA;AAE3D;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,4BAA4B,CAC/C,OAAO,EACP,aAAa,CACd,CAAA","sourcesContent":["import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **shellAccess** report alert.\n */\nexport const shell = createSecuritySelectorFilter(\n 'shell',\n 'shellAccess',\n)\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filters out any node that does not have a **shrinkwrap** report alert.
|
|
3
|
-
*/
|
|
4
|
-
export declare const shrinkwrap: (state: import("../types.ts").ParserState) => Promise<import("../types.ts").ParserState & {
|
|
5
|
-
securityArchive: NonNullable<import("../types.ts").ParserState["securityArchive"]>;
|
|
6
|
-
}>;
|
|
7
|
-
//# sourceMappingURL=shrinkwrap.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shrinkwrap.d.ts","sourceRoot":"","sources":["../../../src/pseudo/shrinkwrap.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,UAAU;;EAGtB,CAAA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { createSecuritySelectorFilter } from "./helpers.js";
|
|
2
|
-
/**
|
|
3
|
-
* Filters out any node that does not have a **shrinkwrap** report alert.
|
|
4
|
-
*/
|
|
5
|
-
export const shrinkwrap = createSecuritySelectorFilter('shrinkwrap', 'shrinkwrap');
|
|
6
|
-
//# sourceMappingURL=shrinkwrap.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shrinkwrap.js","sourceRoot":"","sources":["../../../src/pseudo/shrinkwrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAA;AAE3D;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,4BAA4B,CACpD,YAAY,EACZ,YAAY,CACb,CAAA","sourcesContent":["import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **shrinkwrap** report alert.\n */\nexport const shrinkwrap = createSecuritySelectorFilter(\n 'shrinkwrap',\n 'shrinkwrap',\n)\n"]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { ParserState } from '../types.ts';
|
|
2
|
-
import type { PostcssNode } from '@vltpkg/dss-parser';
|
|
3
|
-
export type SpecInternals = {
|
|
4
|
-
specValue: string;
|
|
5
|
-
};
|
|
6
|
-
export declare const parseInternals: (nodes: PostcssNode[]) => SpecInternals;
|
|
7
|
-
/**
|
|
8
|
-
* :spec Pseudo-Selector, matches edges where edge.spec.bareSpec equals the provided value.
|
|
9
|
-
*
|
|
10
|
-
* Examples:
|
|
11
|
-
* - :spec("*") matches edges with a package specifier equal to "*"
|
|
12
|
-
* - :spec(^1.0.0) matches edges with a package specifier equal to "^1.0.0"
|
|
13
|
-
* - :spec("catalog:") matches edges with a package specifier equal to "catalog:"
|
|
14
|
-
* - :spec("workspace:dev") matches edges with a package specifier equal to "workspace:dev"
|
|
15
|
-
*/
|
|
16
|
-
export declare const spec: (state: ParserState) => Promise<ParserState>;
|
|
17
|
-
//# sourceMappingURL=spec.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../../src/pseudo/spec.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAErD,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,cAAc,UAClB,WAAW,EAAE,KACnB,aAyEF,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,IAAI,UAAiB,WAAW,yBAwB5C,CAAA"}
|
package/dist/esm/pseudo/spec.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { error } from '@vltpkg/error-cause';
|
|
2
|
-
import { asError } from '@vltpkg/types';
|
|
3
|
-
import { asPostcssNodeWithChildren, asStringNode, asTagNode, isTagNode, } from '@vltpkg/dss-parser';
|
|
4
|
-
import { removeEdge, removeUnlinkedNodes, removeQuotes, } from "./helpers.js";
|
|
5
|
-
export const parseInternals = (nodes) => {
|
|
6
|
-
// tries to parse the first param as a string node, otherwise defaults
|
|
7
|
-
// to reading all postcss nodes as just strings, since it just means
|
|
8
|
-
// the value was defined as an unquoted string
|
|
9
|
-
let specValue = '';
|
|
10
|
-
if (nodes.length === 0) {
|
|
11
|
-
throw new Error('No nodes provided to parseInternals');
|
|
12
|
-
}
|
|
13
|
-
const firstNode = asPostcssNodeWithChildren(nodes[0]);
|
|
14
|
-
if (firstNode.nodes.length === 0) {
|
|
15
|
-
throw new Error('First node has no child nodes');
|
|
16
|
-
}
|
|
17
|
-
// Try to parse as a quoted string first (single string node)
|
|
18
|
-
if (firstNode.nodes.length === 1) {
|
|
19
|
-
const targetNode = firstNode.nodes[0];
|
|
20
|
-
try {
|
|
21
|
-
specValue = removeQuotes(asStringNode(targetNode).value);
|
|
22
|
-
return { specValue };
|
|
23
|
-
}
|
|
24
|
-
catch (err) {
|
|
25
|
-
if (asError(err).message === 'Mismatching query node' &&
|
|
26
|
-
isTagNode(targetNode)
|
|
27
|
-
/* c8 ignore start */
|
|
28
|
-
) {
|
|
29
|
-
// Handle simple unquoted single-token values like "1"
|
|
30
|
-
const tagNode = asTagNode(targetNode);
|
|
31
|
-
specValue = tagNode.value;
|
|
32
|
-
return { specValue };
|
|
33
|
-
/* c8 ignore stop */
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
throw err;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
// Handle unquoted complex values that get parsed into multiple nodes
|
|
41
|
-
// This happens when unquoted values contain dots, like ^1.0.0 which becomes:
|
|
42
|
-
// - Tag: "^1"
|
|
43
|
-
// - ClassName: "0" (from .0)
|
|
44
|
-
// - ClassName: "0" (from .0)
|
|
45
|
-
// We need to reconstruct the original value by concatenating all nodes
|
|
46
|
-
const parts = [];
|
|
47
|
-
for (const node of firstNode.nodes) {
|
|
48
|
-
switch (node.type) {
|
|
49
|
-
case 'tag':
|
|
50
|
-
parts.push(asTagNode(node).value);
|
|
51
|
-
break;
|
|
52
|
-
case 'class':
|
|
53
|
-
// Class nodes represent .className in CSS, so we need to add the dot back
|
|
54
|
-
parts.push('.' + node.value);
|
|
55
|
-
break;
|
|
56
|
-
case 'id':
|
|
57
|
-
// ID nodes represent #idName in CSS, so we need to add the hash back
|
|
58
|
-
parts.push('#' + node.value);
|
|
59
|
-
break;
|
|
60
|
-
case 'string':
|
|
61
|
-
parts.push(removeQuotes(asStringNode(node).value));
|
|
62
|
-
break;
|
|
63
|
-
default:
|
|
64
|
-
// For other node types, try to get the value property or convert to string
|
|
65
|
-
/* c8 ignore next */
|
|
66
|
-
parts.push(node.value ?? String(node));
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
specValue = parts.join('');
|
|
71
|
-
return { specValue };
|
|
72
|
-
};
|
|
73
|
-
/**
|
|
74
|
-
* :spec Pseudo-Selector, matches edges where edge.spec.bareSpec equals the provided value.
|
|
75
|
-
*
|
|
76
|
-
* Examples:
|
|
77
|
-
* - :spec("*") matches edges with a package specifier equal to "*"
|
|
78
|
-
* - :spec(^1.0.0) matches edges with a package specifier equal to "^1.0.0"
|
|
79
|
-
* - :spec("catalog:") matches edges with a package specifier equal to "catalog:"
|
|
80
|
-
* - :spec("workspace:dev") matches edges with a package specifier equal to "workspace:dev"
|
|
81
|
-
*/
|
|
82
|
-
export const spec = async (state) => {
|
|
83
|
-
let internals;
|
|
84
|
-
try {
|
|
85
|
-
internals = parseInternals(asPostcssNodeWithChildren(state.current).nodes);
|
|
86
|
-
}
|
|
87
|
-
catch (err) {
|
|
88
|
-
throw error('Failed to parse :spec selector', {
|
|
89
|
-
cause: err,
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
const { specValue } = internals;
|
|
93
|
-
for (const edge of state.partial.edges) {
|
|
94
|
-
if (edge.spec.bareSpec !== specValue) {
|
|
95
|
-
removeEdge(state, edge);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
// Clean up unlinked nodes after removing edges
|
|
99
|
-
removeUnlinkedNodes(state);
|
|
100
|
-
return state;
|
|
101
|
-
};
|
|
102
|
-
//# sourceMappingURL=spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"spec.js","sourceRoot":"","sources":["../../../src/pseudo/spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EACL,yBAAyB,EACzB,YAAY,EACZ,SAAS,EACT,SAAS,GACV,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,YAAY,GACb,MAAM,cAAc,CAAA;AAQrB,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,KAAoB,EACL,EAAE;IACjB,sEAAsE;IACtE,oEAAoE;IACpE,8CAA8C;IAC9C,IAAI,SAAS,GAAG,EAAE,CAAA;IAElB,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAA;IACxD,CAAC;IAED,MAAM,SAAS,GAAG,yBAAyB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;IAErD,IAAI,SAAS,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAA;IAClD,CAAC;IAED,6DAA6D;IAC7D,IAAI,SAAS,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjC,MAAM,UAAU,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QACrC,IAAI,CAAC;YACH,SAAS,GAAG,YAAY,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,K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AAI,CAAC,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;gBACtC,MAAK;QACT,CAAC;IACH,CAAC;IAED,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC1B,OAAO,EAAE,SAAS,EAAE,CAAA;AACtB,CAAC,CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,EAAE,KAAkB,EAAE,EAAE;IAC/C,IAAI,SAAS,CAAA;IACb,IAAI,CAAC;QACH,SAAS,GAAG,cAAc,CACxB,yBAAyB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,KAAK,CAC/C,CAAA;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,KAAK,CAAC,gCAAgC,EAAE;YAC5C,KAAK,EAAE,GAAG;SACX,CAAC,CAAA;IACJ,CAAC;IAED,MAAM,EAAE,SAAS,EAAE,GAAG,SAAS,CAAA;IAE/B,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACvC,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YACrC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;QACzB,CAAC;IACH,CAAC;IAED,+CAA+C;IAC/C,mBAAmB,CAAC,KAAK,CAAC,CAAA;IAE1B,OAAO,KAAK,CAAA;AACd,CAAC,CAAA","sourcesContent":["import { error } from '@vltpkg/error-cause'\nimport { asError } from '@vltpkg/types'\nimport {\n asPostcssNodeWithChildren,\n asStringNode,\n asTagNode,\n isTagNode,\n} from '@vltpkg/dss-parser'\nimport {\n removeEdge,\n removeUnlinkedNodes,\n removeQuotes,\n} from './helpers.ts'\nimport type { ParserState } from '../types.ts'\nimport type { PostcssNode } from '@vltpkg/dss-parser'\n\nexport type SpecInternals = {\n specValue: string\n}\n\nexport const parseInternals = (\n nodes: PostcssNode[],\n): SpecInternals => {\n // tries to parse the first param as a string node, otherwise defaults\n // to reading all postcss nodes as just strings, since it just means\n // the value was defined as an unquoted string\n let specValue = ''\n\n if (nodes.length === 0) {\n throw new Error('No nodes provided to parseInternals')\n }\n\n const firstNode = asPostcssNodeWithChildren(nodes[0])\n\n if (firstNode.nodes.length === 0) {\n throw new Error('First node has no child nodes')\n }\n\n // Try to parse as a quoted string first (single string node)\n if (firstNode.nodes.length === 1) {\n const targetNode = firstNode.nodes[0]\n try {\n specValue = removeQuotes(asStringNode(targetNode).value)\n return { specValue }\n } catch (err) {\n if (\n asError(err).message === 'Mismatching query node' &&\n isTagNode(targetNode)\n /* c8 ignore start */\n ) {\n // Handle simple unquoted single-token values like \"1\"\n const tagNode = asTagNode(targetNode)\n specValue = tagNode.value\n return { specValue }\n /* c8 ignore stop */\n } else {\n throw err\n }\n }\n }\n\n // Handle unquoted complex values that get parsed into multiple nodes\n // This happens when unquoted values contain dots, like ^1.0.0 which becomes:\n // - Tag: \"^1\"\n // - ClassName: \"0\" (from .0)\n // - ClassName: \"0\" (from .0)\n // We need to reconstruct the original value by concatenating all nodes\n const parts: string[] = []\n\n for (const node of firstNode.nodes) {\n switch (node.type) {\n case 'tag':\n parts.push(asTagNode(node).value)\n break\n case 'class':\n // Class nodes represent .className in CSS, so we need to add the dot back\n parts.push('.' + node.value)\n break\n case 'id':\n // ID nodes represent #idName in CSS, so we need to add the hash back\n parts.push('#' + node.value)\n break\n case 'string':\n parts.push(removeQuotes(asStringNode(node).value))\n break\n default:\n // For other node types, try to get the value property or convert to string\n /* c8 ignore next */\n parts.push(node.value ?? String(node))\n break\n }\n }\n\n specValue = parts.join('')\n return { specValue }\n}\n\n/**\n * :spec Pseudo-Selector, matches edges where edge.spec.bareSpec equals the provided value.\n *\n * Examples:\n * - :spec(\"*\") matches edges with a package specifier equal to \"*\"\n * - :spec(^1.0.0) matches edges with a package specifier equal to \"^1.0.0\"\n * - :spec(\"catalog:\") matches edges with a package specifier equal to \"catalog:\"\n * - :spec(\"workspace:dev\") matches edges with a package specifier equal to \"workspace:dev\"\n */\nexport const spec = async (state: ParserState) => {\n let internals\n try {\n internals = parseInternals(\n asPostcssNodeWithChildren(state.current).nodes,\n )\n } catch (err) {\n throw error('Failed to parse :spec selector', {\n cause: err,\n })\n }\n\n const { specValue } = internals\n\n for (const edge of state.partial.edges) {\n if (edge.spec.bareSpec !== specValue) {\n removeEdge(state, edge)\n }\n }\n\n // Clean up unlinked nodes after removing edges\n removeUnlinkedNodes(state)\n\n return state\n}\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ParserState } from '../types.ts';
|
|
2
|
-
import type { PostcssNode } from '@vltpkg/dss-parser';
|
|
3
|
-
export type SquatKinds = '0' | '2' | 'critical' | 'medium' | undefined;
|
|
4
|
-
export type SquatAlertTypes = 'didYouMean' | 'gptDidYouMean' | undefined;
|
|
5
|
-
export type SquatComparator = '>' | '<' | '>=' | '<=' | undefined;
|
|
6
|
-
export declare const isSquatKind: (value?: string) => value is SquatKinds;
|
|
7
|
-
export declare const asSquatKind: (value?: string) => SquatKinds;
|
|
8
|
-
export declare const parseInternals: (nodes: PostcssNode[]) => {
|
|
9
|
-
kind: SquatKinds;
|
|
10
|
-
comparator: SquatComparator;
|
|
11
|
-
};
|
|
12
|
-
export declare const squat: (state: ParserState) => Promise<ParserState & {
|
|
13
|
-
securityArchive: NonNullable<ParserState["securityArchive"]>;
|
|
14
|
-
}>;
|
|
15
|
-
//# sourceMappingURL=squat.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"squat.d.ts","sourceRoot":"","sources":["../../../src/pseudo/squat.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAErD,MAAM,MAAM,UAAU,GAAG,GAAG,GAAG,GAAG,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAA;AAEtE,MAAM,MAAM,eAAe,GACvB,YAAY,GACZ,eAAe,GACf,SAAS,CAAA;AAEb,MAAM,MAAM,eAAe,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAAA;AAoBjE,eAAO,MAAM,WAAW,WAAY,MAAM,KAAG,KAAK,IAAI,UACtB,CAAA;AAEhC,eAAO,MAAM,WAAW,WAAY,MAAM,KAAG,UAQ5C,CAAA;AAED,eAAO,MAAM,cAAc,UAClB,WAAW,EAAE,KACnB;IACD,IAAI,EAAE,UAAU,CAAA;IAChB,UAAU,EAAE,eAAe,CAAA;CA+C5B,CAAA;AAED,eAAO,MAAM,KAAK,UAAiB,WAAW;;EAmH7C,CAAA"}
|
package/dist/esm/pseudo/squat.js
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { error } from '@vltpkg/error-cause';
|
|
2
|
-
import { asError } from '@vltpkg/types';
|
|
3
|
-
import { asPostcssNodeWithChildren, asStringNode, asTagNode, isStringNode, isTagNode, } from '@vltpkg/dss-parser';
|
|
4
|
-
import { assertSecurityArchive, removeDanglingEdges, removeNode, removeQuotes, } from "./helpers.js";
|
|
5
|
-
const kindsMap = new Map([
|
|
6
|
-
['critical', 'didYouMean'],
|
|
7
|
-
['medium', 'gptDidYouMean'],
|
|
8
|
-
['0', 'didYouMean'],
|
|
9
|
-
['2', 'gptDidYouMean'],
|
|
10
|
-
[undefined, undefined],
|
|
11
|
-
]);
|
|
12
|
-
// Map numerical values to their respective kinds for comparison operations
|
|
13
|
-
const kindLevelMap = new Map([
|
|
14
|
-
['critical', 0],
|
|
15
|
-
['medium', 2],
|
|
16
|
-
['0', 0],
|
|
17
|
-
['2', 2],
|
|
18
|
-
]);
|
|
19
|
-
const kinds = new Set(kindsMap.keys());
|
|
20
|
-
export const isSquatKind = (value) => kinds.has(value);
|
|
21
|
-
export const asSquatKind = (value) => {
|
|
22
|
-
if (!isSquatKind(value)) {
|
|
23
|
-
throw error('Expected a valid squat kind', {
|
|
24
|
-
found: value,
|
|
25
|
-
validOptions: Array.from(kinds),
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
return value;
|
|
29
|
-
};
|
|
30
|
-
export const parseInternals = (nodes) => {
|
|
31
|
-
let kind;
|
|
32
|
-
let comparator;
|
|
33
|
-
let kindValue = '';
|
|
34
|
-
if (isStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])) {
|
|
35
|
-
kindValue = removeQuotes(asStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])
|
|
36
|
-
.value);
|
|
37
|
-
}
|
|
38
|
-
else if (isTagNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])) {
|
|
39
|
-
kindValue = asTagNode(asPostcssNodeWithChildren(nodes[0]).nodes[0]).value;
|
|
40
|
-
}
|
|
41
|
-
// Extract comparator if present
|
|
42
|
-
if (kindValue.startsWith('>=')) {
|
|
43
|
-
comparator = '>=';
|
|
44
|
-
kindValue = kindValue.substring(2);
|
|
45
|
-
}
|
|
46
|
-
else if (kindValue.startsWith('<=')) {
|
|
47
|
-
comparator = '<=';
|
|
48
|
-
kindValue = kindValue.substring(2);
|
|
49
|
-
}
|
|
50
|
-
else if (kindValue.startsWith('>')) {
|
|
51
|
-
comparator = '>';
|
|
52
|
-
kindValue = kindValue.substring(1);
|
|
53
|
-
}
|
|
54
|
-
else if (kindValue.startsWith('<')) {
|
|
55
|
-
comparator = '<';
|
|
56
|
-
kindValue = kindValue.substring(1);
|
|
57
|
-
}
|
|
58
|
-
// Parse kind value
|
|
59
|
-
if (kindValue) {
|
|
60
|
-
if (isSquatKind(kindValue)) {
|
|
61
|
-
kind = kindValue;
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
throw error('Expected a valid squat kind for comparison', {
|
|
65
|
-
found: kindValue,
|
|
66
|
-
validOptions: Array.from(kinds),
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return { kind, comparator };
|
|
71
|
-
};
|
|
72
|
-
export const squat = async (state) => {
|
|
73
|
-
assertSecurityArchive(state, 'squat');
|
|
74
|
-
let internals;
|
|
75
|
-
try {
|
|
76
|
-
internals = parseInternals(asPostcssNodeWithChildren(state.current).nodes);
|
|
77
|
-
}
|
|
78
|
-
catch (err) {
|
|
79
|
-
if (asError(err).message === 'Expected a query node') {
|
|
80
|
-
// No parameters provided - pseudo state form: match ANY squat level
|
|
81
|
-
internals = { kind: undefined, comparator: undefined };
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
throw error('Failed to parse :squat selector', { cause: err });
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
const { kind, comparator } = internals;
|
|
88
|
-
// First pass: Remove nodes without security data
|
|
89
|
-
for (const node of state.partial.nodes) {
|
|
90
|
-
const report = state.securityArchive.get(node.id);
|
|
91
|
-
// Always exclude nodes that don't have security data or alerts
|
|
92
|
-
if (!report?.alerts || report.alerts.length === 0) {
|
|
93
|
-
removeNode(state, node);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
// Second pass: Apply comparison filtering
|
|
97
|
-
for (const node of state.partial.nodes) {
|
|
98
|
-
const report = state.securityArchive.get(node.id);
|
|
99
|
-
// Skip if report is undefined
|
|
100
|
-
// (should never happen since we filtered above)
|
|
101
|
-
/* c8 ignore next - impossible */
|
|
102
|
-
if (!report)
|
|
103
|
-
continue;
|
|
104
|
-
// At this point we know report exists and has alerts
|
|
105
|
-
let exclude = true;
|
|
106
|
-
if (kind === undefined && comparator === undefined) {
|
|
107
|
-
// Pseudo state form: match ANY squat level
|
|
108
|
-
exclude = !report.alerts.some(alert => [...kindsMap.values()].includes(alert.type));
|
|
109
|
-
}
|
|
110
|
-
else if (comparator) {
|
|
111
|
-
// Get the value to compare against
|
|
112
|
-
const kindLevel = kindLevelMap.get(kind);
|
|
113
|
-
/* c8 ignore next - impossible */
|
|
114
|
-
if (kindLevel === undefined)
|
|
115
|
-
break;
|
|
116
|
-
// For each alert, check if it matches the comparison criteria
|
|
117
|
-
let matchesComparison = false;
|
|
118
|
-
for (const alert of report.alerts) {
|
|
119
|
-
// Get the alert type
|
|
120
|
-
const alertType = alert.type;
|
|
121
|
-
// Find the corresponding kind for this alert type
|
|
122
|
-
const alertLevelKey = [...kindsMap.entries()].find(([_, value]) => value === alertType)?.[0];
|
|
123
|
-
if (alertLevelKey) {
|
|
124
|
-
// Get the numeric level for this alert
|
|
125
|
-
const alertLevel = kindLevelMap.get(alertLevelKey);
|
|
126
|
-
/* c8 ignore next - impossible */
|
|
127
|
-
if (alertLevel === undefined)
|
|
128
|
-
continue;
|
|
129
|
-
// Apply the comparison based on the comparator
|
|
130
|
-
switch (comparator) {
|
|
131
|
-
case '>':
|
|
132
|
-
if (alertLevel > kindLevel) {
|
|
133
|
-
matchesComparison = true;
|
|
134
|
-
}
|
|
135
|
-
break;
|
|
136
|
-
case '<':
|
|
137
|
-
if (alertLevel < kindLevel) {
|
|
138
|
-
matchesComparison = true;
|
|
139
|
-
}
|
|
140
|
-
break;
|
|
141
|
-
case '>=':
|
|
142
|
-
if (alertLevel >= kindLevel) {
|
|
143
|
-
matchesComparison = true;
|
|
144
|
-
}
|
|
145
|
-
break;
|
|
146
|
-
case '<=':
|
|
147
|
-
if (alertLevel <= kindLevel) {
|
|
148
|
-
matchesComparison = true;
|
|
149
|
-
}
|
|
150
|
-
break;
|
|
151
|
-
}
|
|
152
|
-
// If we found a match, we can stop checking other alerts
|
|
153
|
-
if (matchesComparison)
|
|
154
|
-
break;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
// Exclude the node if it doesn't match the comparison
|
|
158
|
-
exclude = !matchesComparison;
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
// Original exact match behavior
|
|
162
|
-
const alertName = kindsMap.get(kind);
|
|
163
|
-
exclude = !report.alerts.some(alert => alert.type === alertName);
|
|
164
|
-
}
|
|
165
|
-
if (exclude) {
|
|
166
|
-
removeNode(state, node);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
removeDanglingEdges(state);
|
|
170
|
-
return state;
|
|
171
|
-
};
|
|
172
|
-
//# sourceMappingURL=squat.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"squat.js","sourceRoot":"","sources":["../../../src/pseudo/squat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EACL,yBAAyB,EACzB,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,SAAS,GACV,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,UAAU,EACV,YAAY,GACb,MAAM,cAAc,CAAA;AAarB,MAAM,QAAQ,GAAG,IAAI,GAAG,CAA8B;IACpD,CAAC,UAAU,EAAE,YAAY,CAAC;IAC1B,CAAC,QAAQ,EAAE,eAAe,CAAC;IAC3B,CAAC,GAAG,EAAE,YAAY,CAAC;IACnB,CAAC,GAAG,EAAE,eAAe,CAAC;IACtB,CAAC,SAAS,EAAE,SAAS,CAAC;CACvB,CAAC,CAAA;AAEF,2EAA2E;AAC3E,MAAM,YAAY,GAAG,IAAI,GAAG,CAAqB;IAC/C,CAAC,UAAU,EAAE,CAAC,CAAC;IACf,CAAC,QAAQ,EAAE,CAAC,CAAC;IACb,CAAC,GAAG,EAAE,CAAC,CAAC;IACR,CAAC,GAAG,EAAE,CAAC,CAAC;CACT,CAAC,CAAA;AAEF,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAA;AAEtC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAc,EAAuB,EAAE,CACjE,KAAK,CAAC,GAAG,CAAC,KAAmB,CAAC,CAAA;AAEhC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAc,EAAc,EAAE;IAC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,GAAG,CAAC,iBAAiB,CAAA;QAC9B,CAAC;aAAM,CAAC;YACN,gCAAgC;YAChC,MAAM,SAAS,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;YACpC,OAAO,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAA;QAClE,CAAC;QAED,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 { asError } from '@vltpkg/types'\nimport {\n asPostcssNodeWithChildren,\n asStringNode,\n asTagNode,\n isStringNode,\n isTagNode,\n} from '@vltpkg/dss-parser'\nimport {\n assertSecurityArchive,\n removeDanglingEdges,\n removeNode,\n removeQuotes,\n} from './helpers.ts'\nimport type { ParserState } from '../types.ts'\nimport type { PostcssNode } from '@vltpkg/dss-parser'\n\nexport type SquatKinds = '0' | '2' | 'critical' | 'medium' | undefined\n\nexport type SquatAlertTypes =\n | 'didYouMean'\n | 'gptDidYouMean'\n | undefined\n\nexport type SquatComparator = '>' | '<' | '>=' | '<=' | undefined\n\nconst kindsMap = new Map<SquatKinds, SquatAlertTypes>([\n ['critical', 'didYouMean'],\n ['medium', 'gptDidYouMean'],\n ['0', 'didYouMean'],\n ['2', 'gptDidYouMean'],\n [undefined, undefined],\n])\n\n// Map numerical values to their respective kinds for comparison operations\nconst kindLevelMap = new Map<SquatKinds, number>([\n ['critical', 0],\n ['medium', 2],\n ['0', 0],\n ['2', 2],\n])\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): {\n kind: SquatKinds\n comparator: SquatComparator\n} => {\n let kind: SquatKinds\n let comparator: SquatComparator\n\n let kindValue = ''\n if (isStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])) {\n kindValue = removeQuotes(\n asStringNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])\n .value,\n )\n } else if (\n isTagNode(asPostcssNodeWithChildren(nodes[0]).nodes[0])\n ) {\n kindValue = asTagNode(\n asPostcssNodeWithChildren(nodes[0]).nodes[0],\n ).value\n }\n\n // Extract comparator if present\n if (kindValue.startsWith('>=')) {\n comparator = '>='\n kindValue = kindValue.substring(2)\n } else if (kindValue.startsWith('<=')) {\n comparator = '<='\n kindValue = kindValue.substring(2)\n } else if (kindValue.startsWith('>')) {\n comparator = '>'\n kindValue = kindValue.substring(1)\n } else if (kindValue.startsWith('<')) {\n comparator = '<'\n kindValue = kindValue.substring(1)\n }\n\n // Parse kind value\n if (kindValue) {\n if (isSquatKind(kindValue)) {\n kind = kindValue\n } else {\n throw error('Expected a valid squat kind for comparison', {\n found: kindValue,\n validOptions: Array.from(kinds),\n })\n }\n }\n\n return { kind, comparator }\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 if (asError(err).message === 'Expected a query node') {\n // No parameters provided - pseudo state form: match ANY squat level\n internals = { kind: undefined, comparator: undefined }\n } else {\n throw error('Failed to parse :squat selector', { cause: err })\n }\n }\n\n const { kind, comparator } = internals\n\n // First pass: Remove nodes without security data\n for (const node of state.partial.nodes) {\n const report = state.securityArchive.get(node.id)\n // Always exclude nodes that don't have security data or alerts\n if (!report?.alerts || report.alerts.length === 0) {\n removeNode(state, node)\n }\n }\n\n // Second pass: Apply comparison filtering\n for (const node of state.partial.nodes) {\n const report = state.securityArchive.get(node.id)\n\n // Skip if report is undefined\n // (should never happen since we filtered above)\n /* c8 ignore next - impossible */\n if (!report) continue\n\n // At this point we know report exists and has alerts\n let exclude = true\n\n if (kind === undefined && comparator === undefined) {\n // Pseudo state form: match ANY squat level\n exclude = !report.alerts.some(alert =>\n [...kindsMap.values()].includes(\n alert.type as SquatAlertTypes,\n ),\n )\n } else if (comparator) {\n // Get the value to compare against\n const kindLevel = kindLevelMap.get(kind)\n /* c8 ignore next - impossible */\n if (kindLevel === undefined) break\n\n // For each alert, check if it matches the comparison criteria\n let matchesComparison = false\n for (const alert of report.alerts) {\n // Get the alert type\n const alertType = alert.type\n\n // Find the corresponding kind for this alert type\n const alertLevelKey = [...kindsMap.entries()].find(\n ([_, value]) => value === alertType,\n )?.[0]\n\n if (alertLevelKey) {\n // Get the numeric level for this alert\n const alertLevel = kindLevelMap.get(alertLevelKey)\n /* c8 ignore next - impossible */\n if (alertLevel === undefined) continue\n\n // Apply the comparison based on the comparator\n switch (comparator) {\n case '>':\n if (alertLevel > kindLevel) {\n matchesComparison = true\n }\n break\n case '<':\n if (alertLevel < kindLevel) {\n matchesComparison = true\n }\n break\n case '>=':\n if (alertLevel >= kindLevel) {\n matchesComparison = true\n }\n break\n case '<=':\n if (alertLevel <= kindLevel) {\n matchesComparison = true\n }\n break\n }\n\n // If we found a match, we can stop checking other alerts\n if (matchesComparison) break\n }\n }\n\n // Exclude the node if it doesn't match the comparison\n exclude = !matchesComparison\n } else {\n // Original exact match behavior\n const alertName = kindsMap.get(kind)\n exclude = !report.alerts.some(alert => alert.type === alertName)\n }\n\n if (exclude) {\n removeNode(state, node)\n }\n }\n\n removeDanglingEdges(state)\n\n return state\n}\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filters out any node that does not have a **suspiciousStarActivity** report alert.
|
|
3
|
-
*/
|
|
4
|
-
export declare const suspicious: (state: import("../types.ts").ParserState) => Promise<import("../types.ts").ParserState & {
|
|
5
|
-
securityArchive: NonNullable<import("../types.ts").ParserState["securityArchive"]>;
|
|
6
|
-
}>;
|
|
7
|
-
//# sourceMappingURL=suspicious.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"suspicious.d.ts","sourceRoot":"","sources":["../../../src/pseudo/suspicious.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,UAAU;;EAGtB,CAAA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { createSecuritySelectorFilter } from "./helpers.js";
|
|
2
|
-
/**
|
|
3
|
-
* Filters out any node that does not have a **suspiciousStarActivity** report alert.
|
|
4
|
-
*/
|
|
5
|
-
export const suspicious = createSecuritySelectorFilter('suspicious', 'suspiciousStarActivity');
|
|
6
|
-
//# sourceMappingURL=suspicious.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"suspicious.js","sourceRoot":"","sources":["../../../src/pseudo/suspicious.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAA;AAE3D;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,4BAA4B,CACpD,YAAY,EACZ,wBAAwB,CACzB,CAAA","sourcesContent":["import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **suspiciousStarActivity** report alert.\n */\nexport const suspicious = createSecuritySelectorFilter(\n 'suspicious',\n 'suspiciousStarActivity',\n)\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filters out any node that does not have a **telemetry** report alert.
|
|
3
|
-
*/
|
|
4
|
-
export declare const tracker: (state: import("../types.ts").ParserState) => Promise<import("../types.ts").ParserState & {
|
|
5
|
-
securityArchive: NonNullable<import("../types.ts").ParserState["securityArchive"]>;
|
|
6
|
-
}>;
|
|
7
|
-
//# sourceMappingURL=tracker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tracker.d.ts","sourceRoot":"","sources":["../../../src/pseudo/tracker.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,OAAO;;EAGnB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tracker.js","sourceRoot":"","sources":["../../../src/pseudo/tracker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAA;AAE3D;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,4BAA4B,CACjD,SAAS,EACT,WAAW,CACZ,CAAA","sourcesContent":["import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **telemetry** report alert.\n */\nexport const tracker = createSecuritySelectorFilter(\n 'tracker',\n 'telemetry',\n)\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filters out any node that does not have a **trivialPackage** report alert.
|
|
3
|
-
*/
|
|
4
|
-
export declare const trivial: (state: import("../types.ts").ParserState) => Promise<import("../types.ts").ParserState & {
|
|
5
|
-
securityArchive: NonNullable<import("../types.ts").ParserState["securityArchive"]>;
|
|
6
|
-
}>;
|
|
7
|
-
//# sourceMappingURL=trivial.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trivial.d.ts","sourceRoot":"","sources":["../../../src/pseudo/trivial.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,OAAO;;EAGnB,CAAA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { createSecuritySelectorFilter } from "./helpers.js";
|
|
2
|
-
/**
|
|
3
|
-
* Filters out any node that does not have a **trivialPackage** report alert.
|
|
4
|
-
*/
|
|
5
|
-
export const trivial = createSecuritySelectorFilter('trivial', 'trivialPackage');
|
|
6
|
-
//# sourceMappingURL=trivial.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trivial.js","sourceRoot":"","sources":["../../../src/pseudo/trivial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAA;AAE3D;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,4BAA4B,CACjD,SAAS,EACT,gBAAgB,CACjB,CAAA","sourcesContent":["import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **trivialPackage** report alert.\n */\nexport const trivial = createSecuritySelectorFilter(\n 'trivial',\n 'trivialPackage',\n)\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ParserState } from '../types.ts';
|
|
2
|
-
/**
|
|
3
|
-
* :type(str) Pseudo-Element will match only nodes that are of
|
|
4
|
-
* the same type as the value used. The type is determined by the
|
|
5
|
-
* first part of the dependency ID.
|
|
6
|
-
*/
|
|
7
|
-
export declare const type: (state: ParserState) => Promise<ParserState>;
|
|
8
|
-
//# sourceMappingURL=type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/pseudo/type.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C;;;;GAIG;AACH,eAAO,MAAM,IAAI,UAAiB,WAAW,yBAY5C,CAAA"}
|
package/dist/esm/pseudo/type.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { splitDepID } from '@vltpkg/dep-id/browser';
|
|
2
|
-
import { asPostcssNodeWithChildren, asTagNode, } from '@vltpkg/dss-parser';
|
|
3
|
-
import { removeDanglingEdges, removeNode } from "./helpers.js";
|
|
4
|
-
/**
|
|
5
|
-
* :type(str) Pseudo-Element will match only nodes that are of
|
|
6
|
-
* the same type as the value used. The type is determined by the
|
|
7
|
-
* first part of the dependency ID.
|
|
8
|
-
*/
|
|
9
|
-
export const type = async (state) => {
|
|
10
|
-
const type = asPostcssNodeWithChildren(state.current);
|
|
11
|
-
const selector = asPostcssNodeWithChildren(type.nodes[0]);
|
|
12
|
-
const name = asTagNode(selector.nodes[0]).value;
|
|
13
|
-
for (const node of state.partial.nodes) {
|
|
14
|
-
const nodeType = splitDepID(node.id)[0];
|
|
15
|
-
if (nodeType !== name) {
|
|
16
|
-
removeNode(state, node);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
removeDanglingEdges(state);
|
|
20
|
-
return state;
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=type.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../src/pseudo/type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EACL,yBAAyB,EACzB,SAAS,GACV,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAG9D;;;;GAIG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,EAAE,KAAkB,EAAE,EAAE;IAC/C,MAAM,IAAI,GAAG,yBAAyB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACrD,MAAM,QAAQ,GAAG,yBAAyB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;IACzD,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;IAC/C,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACvC,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;QACvC,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACtB,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;QACzB,CAAC;IACH,CAAC;IACD,mBAAmB,CAAC,KAAK,CAAC,CAAA;IAC1B,OAAO,KAAK,CAAA;AACd,CAAC,CAAA","sourcesContent":["import { splitDepID } from '@vltpkg/dep-id/browser'\nimport {\n asPostcssNodeWithChildren,\n asTagNode,\n} from '@vltpkg/dss-parser'\nimport { removeDanglingEdges, removeNode } from './helpers.ts'\nimport type { ParserState } from '../types.ts'\n\n/**\n * :type(str) Pseudo-Element will match only nodes that are of\n * the same type as the value used. The type is determined by the\n * first part of the dependency ID.\n */\nexport const type = 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 removeDanglingEdges(state)\n return state\n}\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filters out any node that does not have a **troll** report alert.
|
|
3
|
-
*/
|
|
4
|
-
export declare const undesirable: (state: import("../types.ts").ParserState) => Promise<import("../types.ts").ParserState & {
|
|
5
|
-
securityArchive: NonNullable<import("../types.ts").ParserState["securityArchive"]>;
|
|
6
|
-
}>;
|
|
7
|
-
//# sourceMappingURL=undesirable.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"undesirable.d.ts","sourceRoot":"","sources":["../../../src/pseudo/undesirable.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,WAAW;;EAGvB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"undesirable.js","sourceRoot":"","sources":["../../../src/pseudo/undesirable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAA;AAE3D;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,4BAA4B,CACrD,aAAa,EACb,OAAO,CACR,CAAA","sourcesContent":["import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **troll** report alert.\n */\nexport const undesirable = createSecuritySelectorFilter(\n 'undesirable',\n 'troll',\n)\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filters out any node that does not have a **newAuthor** report alert.
|
|
3
|
-
*/
|
|
4
|
-
export declare const unknown: (state: import("../types.ts").ParserState) => Promise<import("../types.ts").ParserState & {
|
|
5
|
-
securityArchive: NonNullable<import("../types.ts").ParserState["securityArchive"]>;
|
|
6
|
-
}>;
|
|
7
|
-
//# sourceMappingURL=unknown.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unknown.d.ts","sourceRoot":"","sources":["../../../src/pseudo/unknown.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,OAAO;;EAGnB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unknown.js","sourceRoot":"","sources":["../../../src/pseudo/unknown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAA;AAE3D;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,4BAA4B,CACjD,SAAS,EACT,WAAW,CACZ,CAAA","sourcesContent":["import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **newAuthor** report alert.\n */\nexport const unknown = createSecuritySelectorFilter(\n 'unknown',\n 'newAuthor',\n)\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filters out any node that does not have a **unmaintained** report alert.
|
|
3
|
-
*/
|
|
4
|
-
export declare const unmaintained: (state: import("../types.ts").ParserState) => Promise<import("../types.ts").ParserState & {
|
|
5
|
-
securityArchive: NonNullable<import("../types.ts").ParserState["securityArchive"]>;
|
|
6
|
-
}>;
|
|
7
|
-
//# sourceMappingURL=unmaintained.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unmaintained.d.ts","sourceRoot":"","sources":["../../../src/pseudo/unmaintained.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,YAAY;;EAGxB,CAAA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { createSecuritySelectorFilter } from "./helpers.js";
|
|
2
|
-
/**
|
|
3
|
-
* Filters out any node that does not have a **unmaintained** report alert.
|
|
4
|
-
*/
|
|
5
|
-
export const unmaintained = createSecuritySelectorFilter('unmaintained', 'unmaintained');
|
|
6
|
-
//# sourceMappingURL=unmaintained.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unmaintained.js","sourceRoot":"","sources":["../../../src/pseudo/unmaintained.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAA;AAE3D;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,4BAA4B,CACtD,cAAc,EACd,cAAc,CACf,CAAA","sourcesContent":["import { createSecuritySelectorFilter } from './helpers.ts'\n\n/**\n * Filters out any node that does not have a **unmaintained** report alert.\n */\nexport const unmaintained = createSecuritySelectorFilter(\n 'unmaintained',\n 'unmaintained',\n)\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filters out any node that does not have a **unpopularPackage** report alert.
|
|
3
|
-
*/
|
|
4
|
-
export declare const unpopular: (state: import("../types.ts").ParserState) => Promise<import("../types.ts").ParserState & {
|
|
5
|
-
securityArchive: NonNullable<import("../types.ts").ParserState["securityArchive"]>;
|
|
6
|
-
}>;
|
|
7
|
-
//# sourceMappingURL=unpopular.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unpopular.d.ts","sourceRoot":"","sources":["../../../src/pseudo/unpopular.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,SAAS;;EAGrB,CAAA"}
|