@vltpkg/query 0.0.0-13 → 0.0.0-14
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 +38 -7
- package/dist/esm/attribute.d.ts.map +1 -1
- package/dist/esm/attribute.js +1 -1
- package/dist/esm/attribute.js.map +1 -1
- package/dist/esm/combinator.d.ts.map +1 -1
- package/dist/esm/combinator.js +1 -1
- package/dist/esm/combinator.js.map +1 -1
- package/dist/esm/id.js +1 -1
- package/dist/esm/id.js.map +1 -1
- package/dist/esm/index.d.ts +0 -52
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -159
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/parser.d.ts.map +1 -1
- package/dist/esm/parser.js +1 -1
- package/dist/esm/parser.js.map +1 -1
- package/dist/esm/pseudo/attr.d.ts +2 -1
- package/dist/esm/pseudo/attr.d.ts.map +1 -1
- package/dist/esm/pseudo/attr.js +1 -1
- package/dist/esm/pseudo/attr.js.map +1 -1
- package/dist/esm/pseudo/cve.d.ts +2 -1
- package/dist/esm/pseudo/cve.d.ts.map +1 -1
- package/dist/esm/pseudo/cve.js +1 -1
- package/dist/esm/pseudo/cve.js.map +1 -1
- package/dist/esm/pseudo/cwe.d.ts +2 -1
- package/dist/esm/pseudo/cwe.d.ts.map +1 -1
- package/dist/esm/pseudo/cwe.js +1 -1
- package/dist/esm/pseudo/cwe.js.map +1 -1
- package/dist/esm/pseudo/helpers.d.ts.map +1 -1
- package/dist/esm/pseudo/helpers.js.map +1 -1
- package/dist/esm/pseudo/license.d.ts +2 -1
- package/dist/esm/pseudo/license.d.ts.map +1 -1
- package/dist/esm/pseudo/license.js +1 -1
- package/dist/esm/pseudo/license.js.map +1 -1
- package/dist/esm/pseudo/malware.d.ts +2 -1
- package/dist/esm/pseudo/malware.d.ts.map +1 -1
- package/dist/esm/pseudo/malware.js +1 -1
- package/dist/esm/pseudo/malware.js.map +1 -1
- package/dist/esm/pseudo/outdated.d.ts +2 -1
- package/dist/esm/pseudo/outdated.d.ts.map +1 -1
- package/dist/esm/pseudo/outdated.js +1 -1
- package/dist/esm/pseudo/outdated.js.map +1 -1
- package/dist/esm/pseudo/published.d.ts +2 -1
- package/dist/esm/pseudo/published.d.ts.map +1 -1
- package/dist/esm/pseudo/published.js +1 -1
- package/dist/esm/pseudo/published.js.map +1 -1
- package/dist/esm/pseudo/score.d.ts +2 -1
- package/dist/esm/pseudo/score.d.ts.map +1 -1
- package/dist/esm/pseudo/score.js +1 -1
- package/dist/esm/pseudo/score.js.map +1 -1
- package/dist/esm/pseudo/semver.d.ts +2 -1
- package/dist/esm/pseudo/semver.d.ts.map +1 -1
- package/dist/esm/pseudo/semver.js +1 -1
- package/dist/esm/pseudo/semver.js.map +1 -1
- package/dist/esm/pseudo/severity.d.ts +2 -1
- package/dist/esm/pseudo/severity.d.ts.map +1 -1
- package/dist/esm/pseudo/severity.js +1 -1
- package/dist/esm/pseudo/severity.js.map +1 -1
- package/dist/esm/pseudo/squat.d.ts +2 -1
- package/dist/esm/pseudo/squat.d.ts.map +1 -1
- package/dist/esm/pseudo/squat.js +1 -1
- package/dist/esm/pseudo/squat.js.map +1 -1
- package/dist/esm/pseudo/type.d.ts.map +1 -1
- package/dist/esm/pseudo/type.js +1 -1
- package/dist/esm/pseudo/type.js.map +1 -1
- package/dist/esm/pseudo.d.ts.map +1 -1
- package/dist/esm/pseudo.js +1 -1
- package/dist/esm/pseudo.js.map +1 -1
- package/dist/esm/types.d.ts +1 -21
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/types.js +1 -118
- package/dist/esm/types.js.map +1 -1
- package/package.json +13 -12
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,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAG3C,OAAO,EAAE,mB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D;IAC1D,0DAA0D;IAC1D,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IACvC,IACE,WAAW;QACX,WAAW,KAAK,KAAK;QACrB,WAAW,KAAK,IAAI;QACpB,WAAW,KAAK,KAAK,EACrB,CAAC;QACD,MAAM,CAAC,WAAW,CAAC,aAAa,IAAI,CAAC,CAAA;IACvC,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA","sourcesContent":["import { error } from '@vltpkg/error-cause'\nimport type { EdgeLike, NodeLike } from '@vltpkg/graph'\n\nimport { removeDanglingEdges, removeNode } from './pseudo/helpers.ts'\nimport {\n asPostcssNodeWithChildren,\n asPseudoNode,\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 { dev } from './pseudo/dev.ts'\nimport { dynamic } from './pseudo/dynamic.ts'\nimport { empty } from './pseudo/empty.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 { link } from './pseudo/link.ts'\nimport { malware } from './pseudo/malware.ts'\nimport { minified } from './pseudo/minified.ts'\nimport { missing } from './pseudo/missing.ts'\nimport { nativeParser } from './pseudo/native.ts'\nimport { network } from './pseudo/network.ts'\nimport { obfuscated } from './pseudo/obfuscated.ts'\nimport { optional } from './pseudo/optional.ts'\nimport { outdated } from './pseudo/outdated.ts'\nimport { peer } from './pseudo/peer.ts'\nimport { published } from './pseudo/published.ts'\nimport { privateParser } from './pseudo/private.ts'\nimport { prod } from './pseudo/prod.ts'\nimport { root } from './pseudo/root.ts'\nimport { scanned } from './pseudo/scanned.ts'\nimport { score } from './pseudo/score.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 { type } from './pseudo/type.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'\nimport { workspace } from './pseudo/workspace.ts'\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 retries: state.retries,\n securityArchive: state.securityArchive,\n specOptions: state.specOptions,\n signal: state.signal,\n scopeIDs: state.scopeIDs,\n comment: state.comment,\n specificity: { ...state.specificity },\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 retries: state.retries,\n securityArchive: state.securityArchive,\n specOptions: state.specOptions,\n signal: state.signal,\n scopeIDs: state.scopeIDs,\n comment: state.comment,\n specificity: { ...state.specificity },\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 * :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 retries: state.retries,\n securityArchive: state.securityArchive,\n specOptions: state.specOptions,\n signal: state.signal,\n scopeIDs: state.scopeIDs,\n comment: state.comment,\n specificity: { ...state.specificity },\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 * :project Pseudo-Class, matches only graph importers (e.g: the\n * root node along with any configured workspace)\n */\nconst project = async (state: ParserState) => {\n for (const node of state.partial.nodes) {\n if (!node.importer) {\n removeNode(state, node)\n }\n }\n for (const edge of state.partial.edges) {\n if (!edge.to?.importer) {\n state.partial.edges.delete(edge)\n }\n }\n return state\n}\n\n/**\n * :scope Pseudo-Element, returns only the nodes that match the provided scopeIDs\n * from the Query.search method.\n */\nconst scope = async (state: ParserState) => {\n const scopeIDSet = new Set(state.scopeIDs)\n\n for (const node of state.partial.nodes) {\n if (!scopeIDSet.has(node.id)) {\n removeNode(state, node)\n }\n }\n\n removeDanglingEdges(state)\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 dev,\n dynamic,\n eval: evalParser,\n empty,\n entropic,\n env,\n fs,\n has,\n is,\n license,\n link,\n malware,\n minified,\n missing,\n native: nativeParser,\n network,\n not,\n obfuscated,\n optional,\n outdated,\n peer,\n published,\n // TODO: overridden\n private: privateParser,\n prod,\n project,\n root,\n scanned,\n scope,\n score,\n scripts,\n semver,\n sev: severity,\n severity,\n shell,\n shrinkwrap,\n squat,\n suspicious,\n tracker,\n trivial,\n type,\n undesirable,\n unknown,\n unmaintained,\n unpopular,\n unstable,\n v: semver,\n workspace,\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 state.partial.edges.clear()\n state.partial.nodes.clear()\n return state\n }\n\n throw error(`Unsupported pseudo-class: ${state.current.value}`, {\n found: state.current,\n })\n }\n\n const result = await parserFn(state)\n\n // Increment the commonCounter for specificity, except for\n // nesting selectors which don't contribute to specificity\n const pseudoValue = curr.value.slice(1)\n if (\n pseudoValue &&\n pseudoValue !== 'not' &&\n pseudoValue !== 'is' &&\n pseudoValue !== 'has'\n ) {\n result.specificity.commonCounter += 1\n }\n\n return result\n}\n"]}
|
|
1
|
+
{"version":3,"file":"pseudo.js","sourceRoot":"","sources":["../../src/pseudo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrE,OAAO,EACL,yBAAyB,EACzB,YAAY,EACZ,cAAc,GACf,MAAM,oBAAoB,CAAA;AAE3B,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,GAAG,EAAE,MAAM,iBAAiB,CAAA;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzC,OAAO,EA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,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,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;YAC3B,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;YAC3B,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;IAED,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,CAAA;IAEpC,0DAA0D;IAC1D,0DAA0D;IAC1D,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IACvC,IACE,WAAW;QACX,WAAW,KAAK,KAAK;QACrB,WAAW,KAAK,IAAI;QACpB,WAAW,KAAK,KAAK,EACrB,CAAC;QACD,MAAM,CAAC,WAAW,CAAC,aAAa,IAAI,CAAC,CAAA;IACvC,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA","sourcesContent":["import { error } from '@vltpkg/error-cause'\nimport { removeDanglingEdges, removeNode } from './pseudo/helpers.ts'\nimport {\n asPostcssNodeWithChildren,\n asPseudoNode,\n isSelectorNode,\n} from '@vltpkg/dss-parser'\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 { dev } from './pseudo/dev.ts'\nimport { dynamic } from './pseudo/dynamic.ts'\nimport { empty } from './pseudo/empty.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 { link } from './pseudo/link.ts'\nimport { malware } from './pseudo/malware.ts'\nimport { minified } from './pseudo/minified.ts'\nimport { missing } from './pseudo/missing.ts'\nimport { nativeParser } from './pseudo/native.ts'\nimport { network } from './pseudo/network.ts'\nimport { obfuscated } from './pseudo/obfuscated.ts'\nimport { optional } from './pseudo/optional.ts'\nimport { outdated } from './pseudo/outdated.ts'\nimport { peer } from './pseudo/peer.ts'\nimport { published } from './pseudo/published.ts'\nimport { privateParser } from './pseudo/private.ts'\nimport { prod } from './pseudo/prod.ts'\nimport { root } from './pseudo/root.ts'\nimport { scanned } from './pseudo/scanned.ts'\nimport { score } from './pseudo/score.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 { type } from './pseudo/type.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'\nimport { workspace } from './pseudo/workspace.ts'\n\nimport type { EdgeLike, NodeLike } from '@vltpkg/graph'\nimport type { ParserFn, ParserState } from './types.ts'\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 retries: state.retries,\n securityArchive: state.securityArchive,\n specOptions: state.specOptions,\n signal: state.signal,\n scopeIDs: state.scopeIDs,\n comment: state.comment,\n specificity: { ...state.specificity },\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 retries: state.retries,\n securityArchive: state.securityArchive,\n specOptions: state.specOptions,\n signal: state.signal,\n scopeIDs: state.scopeIDs,\n comment: state.comment,\n specificity: { ...state.specificity },\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 * :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 retries: state.retries,\n securityArchive: state.securityArchive,\n specOptions: state.specOptions,\n signal: state.signal,\n scopeIDs: state.scopeIDs,\n comment: state.comment,\n specificity: { ...state.specificity },\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 * :project Pseudo-Class, matches only graph importers (e.g: the\n * root node along with any configured workspace)\n */\nconst project = async (state: ParserState) => {\n for (const node of state.partial.nodes) {\n if (!node.importer) {\n removeNode(state, node)\n }\n }\n for (const edge of state.partial.edges) {\n if (!edge.to?.importer) {\n state.partial.edges.delete(edge)\n }\n }\n return state\n}\n\n/**\n * :scope Pseudo-Element, returns only the nodes that match the provided scopeIDs\n * from the Query.search method.\n */\nconst scope = async (state: ParserState) => {\n const scopeIDSet = new Set(state.scopeIDs)\n\n for (const node of state.partial.nodes) {\n if (!scopeIDSet.has(node.id)) {\n removeNode(state, node)\n }\n }\n\n removeDanglingEdges(state)\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 dev,\n dynamic,\n eval: evalParser,\n empty,\n entropic,\n env,\n fs,\n has,\n is,\n license,\n link,\n malware,\n minified,\n missing,\n native: nativeParser,\n network,\n not,\n obfuscated,\n optional,\n outdated,\n peer,\n published,\n // TODO: overridden\n private: privateParser,\n prod,\n project,\n root,\n scanned,\n scope,\n score,\n scripts,\n semver,\n sev: severity,\n severity,\n shell,\n shrinkwrap,\n squat,\n suspicious,\n tracker,\n trivial,\n type,\n undesirable,\n unknown,\n unmaintained,\n unpopular,\n unstable,\n v: semver,\n workspace,\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 state.partial.edges.clear()\n state.partial.nodes.clear()\n return state\n }\n\n throw error(`Unsupported pseudo-class: ${state.current.value}`, {\n found: state.current,\n })\n }\n\n const result = await parserFn(state)\n\n // Increment the commonCounter for specificity, except for\n // nesting selectors which don't contribute to specificity\n const pseudoValue = curr.value.slice(1)\n if (\n pseudoValue &&\n pseudoValue !== 'not' &&\n pseudoValue !== 'is' &&\n pseudoValue !== 'has'\n ) {\n result.specificity.commonCounter += 1\n }\n\n return result\n}\n"]}
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -2,13 +2,11 @@ import type { EdgeLike, NodeLike } from '@vltpkg/graph';
|
|
|
2
2
|
import type { SpecOptions } from '@vltpkg/spec/browser';
|
|
3
3
|
import type { SecurityArchiveLike, PackageScore } from '@vltpkg/security-archive';
|
|
4
4
|
import type { DepID } from '@vltpkg/dep-id';
|
|
5
|
-
import type {
|
|
5
|
+
import type { PostcssNode } from '@vltpkg/dss-parser';
|
|
6
6
|
export type Specificity = {
|
|
7
7
|
idCounter: number;
|
|
8
8
|
commonCounter: number;
|
|
9
9
|
};
|
|
10
|
-
export type PostcssNode = Tag | String | Selector | Root | Pseudo | Nesting | Identifier | Comment | Combinator | ClassName | Attribute | Universal;
|
|
11
|
-
export type PostcssNodeWithChildren = Selector | Root | Pseudo;
|
|
12
10
|
export type GraphSelectionState = {
|
|
13
11
|
nodes: Set<NodeLike>;
|
|
14
12
|
edges: Set<EdgeLike>;
|
|
@@ -108,22 +106,4 @@ export type ParserFn = (opt: ParserState) => Promise<ParserState>;
|
|
|
108
106
|
export type ParsedSelectorToken = PostcssNode & {
|
|
109
107
|
token: string;
|
|
110
108
|
};
|
|
111
|
-
export declare const isPostcssNodeWithChildren: (node: any) => node is PostcssNodeWithChildren;
|
|
112
|
-
export declare const asPostcssNodeWithChildren: (node?: PostcssNode) => PostcssNodeWithChildren;
|
|
113
|
-
export declare const isAttributeNode: (node: unknown) => node is Attribute;
|
|
114
|
-
export declare const asAttributeNode: (node?: PostcssNode) => Attribute;
|
|
115
|
-
export declare const isCombinatorNode: (node: unknown) => node is Combinator;
|
|
116
|
-
export declare const asCombinatorNode: (node?: PostcssNode) => Combinator;
|
|
117
|
-
export declare const isIdentifierNode: (node: any) => node is Identifier;
|
|
118
|
-
export declare const asIdentifierNode: (node?: PostcssNode) => Identifier;
|
|
119
|
-
export declare const isSelectorNode: (node: any) => node is Selector;
|
|
120
|
-
export declare const asSelectorNode: (node?: PostcssNode) => Selector;
|
|
121
|
-
export declare const isPseudoNode: (node: unknown) => node is Pseudo;
|
|
122
|
-
export declare const asPseudoNode: (node?: PostcssNode) => Pseudo;
|
|
123
|
-
export declare const isTagNode: (node: unknown) => node is Tag;
|
|
124
|
-
export declare const asTagNode: (node?: PostcssNode) => Tag;
|
|
125
|
-
export declare const isStringNode: (node: unknown) => node is String;
|
|
126
|
-
export declare const asStringNode: (node?: PostcssNode) => String;
|
|
127
|
-
export declare const isCommentNode: (node: unknown) => node is Comment;
|
|
128
|
-
export declare const asCommentNode: (node?: PostcssNode) => Comment;
|
|
129
109
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/esm/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EACb,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAErD,MAAM,MAAM,WAAW,GAAG;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,GAAG,CAAC,QAAQ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AAO,CAAA;IACpB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,EAAE,OAAO,CAAA;IACnB,IAAI,EAAE,OAAO,CAAA;IACb,UAAU,EAAE,OAAO,CAAA;IACnB,SAAS,EAAE,OAAO,CAAA;IAClB,QAAQ,EAAE,OAAO,CAAA;IACjB,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,OAAO,CAAA;IACb,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,EAAE,OAAO,CAAA;IACZ,MAAM,EAAE,OAAO,CAAA;IACf,IAAI,EAAE,OAAO,CAAA;IACb,QAAQ,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,eAAe,CAAA;AAC7C,MAAM,MAAM,gBAAgB,GAAG,eAAe,CAAA;AAE9C,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,OAAO,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,WAAW,KAAK,OAAO,CAAC,WAAW,CAAC,CAAA;AAEjE,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG;IAC9C,KAAK,EAAE,MAAM,CAAA;CACd,CAAA"}
|
package/dist/esm/types.js
CHANGED
|
@@ -1,119 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export const isPostcssNodeWithChildren = (node) => 'type' in node && 'nodes' in node;
|
|
3
|
-
export const asPostcssNodeWithChildren = (node) => {
|
|
4
|
-
if (!node) {
|
|
5
|
-
throw error('Expected a query node');
|
|
6
|
-
}
|
|
7
|
-
if (!isPostcssNodeWithChildren(node)) {
|
|
8
|
-
throw error('Not a query selector node with children', {
|
|
9
|
-
found: node,
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
return node;
|
|
13
|
-
};
|
|
14
|
-
const isObj = (o) => !!o && typeof o === 'object';
|
|
15
|
-
export const isAttributeNode = (node) => isObj(node) && !!node.attribute && node.type === 'attribute';
|
|
16
|
-
export const asAttributeNode = (node) => {
|
|
17
|
-
if (!node) {
|
|
18
|
-
throw error('Expected a query node');
|
|
19
|
-
}
|
|
20
|
-
if (!isAttributeNode(node)) {
|
|
21
|
-
throw error('Mismatching query node', {
|
|
22
|
-
wanted: 'attribute',
|
|
23
|
-
found: node.type,
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
return node;
|
|
27
|
-
};
|
|
28
|
-
export const isCombinatorNode = (node) => isObj(node) && !!node.value && node.type === 'combinator';
|
|
29
|
-
export const asCombinatorNode = (node) => {
|
|
30
|
-
if (!node) {
|
|
31
|
-
throw error('Expected a query node');
|
|
32
|
-
}
|
|
33
|
-
if (!isCombinatorNode(node)) {
|
|
34
|
-
throw error('Mismatching query node', {
|
|
35
|
-
wanted: 'combinator',
|
|
36
|
-
found: node.type,
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
return node;
|
|
40
|
-
};
|
|
41
|
-
export const isIdentifierNode = (node) => isObj(node) && !!node.value && node.type === 'id';
|
|
42
|
-
export const asIdentifierNode = (node) => {
|
|
43
|
-
if (!node) {
|
|
44
|
-
throw error('Expected a query node');
|
|
45
|
-
}
|
|
46
|
-
if (!isIdentifierNode(node)) {
|
|
47
|
-
throw error('Mismatching query node', {
|
|
48
|
-
wanted: 'id',
|
|
49
|
-
found: node.type,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
return node;
|
|
53
|
-
};
|
|
54
|
-
export const isSelectorNode = (node) => isPostcssNodeWithChildren(node) && node.type === 'selector';
|
|
55
|
-
export const asSelectorNode = (node) => {
|
|
56
|
-
if (!node) {
|
|
57
|
-
throw error('Expected a query node');
|
|
58
|
-
}
|
|
59
|
-
if (!isSelectorNode(node)) {
|
|
60
|
-
throw error('Mismatching query node', {
|
|
61
|
-
wanted: 'selector',
|
|
62
|
-
found: node.type,
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
return node;
|
|
66
|
-
};
|
|
67
|
-
export const isPseudoNode = (node) => isObj(node) && !!node.value && node.type === 'pseudo';
|
|
68
|
-
export const asPseudoNode = (node) => {
|
|
69
|
-
if (!node) {
|
|
70
|
-
throw error('Expected a query node');
|
|
71
|
-
}
|
|
72
|
-
if (!isPseudoNode(node)) {
|
|
73
|
-
throw error('Mismatching query node', {
|
|
74
|
-
wanted: 'pseudo',
|
|
75
|
-
found: node.type,
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
return node;
|
|
79
|
-
};
|
|
80
|
-
export const isTagNode = (node) => isObj(node) && !!node.value && node.type === 'tag';
|
|
81
|
-
export const asTagNode = (node) => {
|
|
82
|
-
if (!node) {
|
|
83
|
-
throw error('Expected a query node');
|
|
84
|
-
}
|
|
85
|
-
if (!isTagNode(node)) {
|
|
86
|
-
throw error('Mismatching query node', {
|
|
87
|
-
wanted: 'tag',
|
|
88
|
-
found: node.type,
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
return node;
|
|
92
|
-
};
|
|
93
|
-
export const isStringNode = (node) => isObj(node) && !!node.value && node.type === 'string';
|
|
94
|
-
export const asStringNode = (node) => {
|
|
95
|
-
if (!node) {
|
|
96
|
-
throw error('Expected a query node');
|
|
97
|
-
}
|
|
98
|
-
if (!isStringNode(node)) {
|
|
99
|
-
throw error('Mismatching query node', {
|
|
100
|
-
wanted: 'string',
|
|
101
|
-
found: node.type,
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
return node;
|
|
105
|
-
};
|
|
106
|
-
export const isCommentNode = (node) => isObj(node) && !!node.value && node.type === 'comment';
|
|
107
|
-
export const asCommentNode = (node) => {
|
|
108
|
-
if (!node) {
|
|
109
|
-
throw error('Expected a query node');
|
|
110
|
-
}
|
|
111
|
-
if (!isCommentNode(node)) {
|
|
112
|
-
throw error('Mismatching query node', {
|
|
113
|
-
wanted: 'comment',
|
|
114
|
-
found: node.type,
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
return node;
|
|
118
|
-
};
|
|
1
|
+
export {};
|
|
119
2
|
//# sourceMappingURL=types.js.map
|
package/dist/esm/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AA6K3C,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,IAAS,EACwB,EAAE,CACnC,MAAM,IAAI,IAAI,IAAI,OAAO,IAAI,IAAI,CAAA;AAEnC,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,IAAkB,EACO,EAAE;IAC3B,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,KAAK,CAAC,uBAAuB,CAAC,CAAA;IACtC,CAAC;IAED,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,EAAE,CAAC;QACrC,MAAM,KAAK,CAAC,yCAAyC,EAAE;YACrD,KAAK,EAAE,IAAI;SACZ,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,MAAM,KAAK,GAAG,CAAC,CAAU,EAAgC,EAAE,CACzD,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,CAAA;AAE9B,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAa,EAAqB,EAAE,CAClE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,IA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AAa,GAAG,CAAC,IAAa,EAAmB,EAAE,CAC9D,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,CAAA;AAExD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAkB,EAAW,EAAE;IAC3D,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,KAAK,CAAC,uBAAuB,CAAC,CAAA;IACtC,CAAC;IAED,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,KAAK,CAAC,wBAAwB,EAAE;YACpC,MAAM,EAAE,SAAS;YACjB,KAAK,EAAE,IAAI,CAAC,IAAI;SACjB,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA","sourcesContent":["import { error } from '@vltpkg/error-cause'\nimport type { EdgeLike, NodeLike } from '@vltpkg/graph'\nimport type { SpecOptions } from '@vltpkg/spec/browser'\nimport type {\n SecurityArchiveLike,\n PackageScore,\n} from '@vltpkg/security-archive'\nimport type { DepID } from '@vltpkg/dep-id'\nimport type {\n Tag,\n String,\n Selector,\n Root,\n Pseudo,\n Nesting,\n Identifier,\n Comment,\n Combinator,\n ClassName,\n Attribute,\n Universal,\n} from 'postcss-selector-parser'\n\nexport type Specificity = {\n idCounter: number\n commonCounter: number\n}\n\nexport type PostcssNode =\n | Tag\n | String\n | Selector\n | Root\n | Pseudo\n | Nesting\n | Identifier\n | Comment\n | Combinator\n | ClassName\n | Attribute\n | Universal\n\nexport type PostcssNodeWithChildren = Selector | Root | Pseudo\n\nexport type GraphSelectionState = {\n nodes: Set<NodeLike>\n edges: Set<EdgeLike>\n}\n\nexport type ParserState = {\n cancellable: () => Promise<void>\n collect: GraphSelectionState\n comment: string\n current: PostcssNode\n initial: GraphSelectionState\n loose?: boolean\n next?: PostcssNode\n prev?: PostcssNode\n result?: NodeLike[]\n signal: AbortSignal\n walk: ParserFn\n partial: GraphSelectionState\n retries: number\n securityArchive: SecurityArchiveLike | undefined\n specOptions: SpecOptions\n scopeIDs?: DepID[]\n specificity: Specificity\n}\n\nexport type QueryResponse = {\n edges: QueryResponseEdge[]\n nodes: QueryResponseNode[]\n comment: string\n specificity: Specificity\n}\n\nexport type QueryResponseEdge = Omit<EdgeLike, 'from' | 'to'> & {\n from: QueryResponseNode\n to?: QueryResponseNode\n}\n\nexport type QueryResponseNode = Omit<\n NodeLike,\n 'edgesIn' | 'edgesOut'\n> & {\n edgesIn: Set<QueryResponseEdge>\n edgesOut: Map<string, QueryResponseEdge>\n insights: Insights\n toJSON: () => Pick<\n QueryResponseNode,\n | 'id'\n | 'name'\n | 'version'\n | 'location'\n | 'importer'\n | 'manifest'\n | 'projectRoot'\n | 'integrity'\n | 'resolved'\n | 'dev'\n | 'optional'\n | 'insights'\n | 'confused'\n >\n}\n\nexport type Insights = {\n abandoned?: boolean\n confused?: boolean\n cve?: `CVE-${string}`[]\n cwe?: `CWE-${string}`[]\n debug?: boolean\n deprecated?: boolean\n dynamic?: boolean\n entropic?: boolean\n env?: boolean\n eval?: boolean\n fs?: boolean\n license?: LicenseInsights\n malware?: MalwareInsights\n minified?: boolean\n native?: boolean\n network?: boolean\n obfuscated?: boolean\n scanned: boolean\n score?: PackageScore\n scripts?: boolean\n severity?: SeverityInsights\n shell?: boolean\n shrinkwrap?: boolean\n squat?: SquatInsights\n suspicious?: boolean\n tracker?: boolean\n trivial?: boolean\n undesirable?: boolean\n unknown?: boolean\n unmaintained?: boolean\n unpopular?: boolean\n unstable?: boolean\n}\n\nexport type LicenseInsights = {\n unlicensed: boolean\n misc: boolean\n restricted: boolean\n ambiguous: boolean\n copyleft: boolean\n unknown: boolean\n none: boolean\n exception: boolean\n}\n\nexport type LeveledInsights = {\n low: boolean\n medium: boolean\n high: boolean\n critical: boolean\n}\n\nexport type MalwareInsights = LeveledInsights\nexport type SeverityInsights = LeveledInsights\n\nexport type SquatInsights = {\n medium: boolean\n critical: boolean\n}\n\nexport type ParserFn = (opt: ParserState) => Promise<ParserState>\n\nexport type ParsedSelectorToken = PostcssNode & {\n token: string\n}\n\nexport const isPostcssNodeWithChildren = (\n node: any,\n): node is PostcssNodeWithChildren =>\n 'type' in node && 'nodes' in node\n\nexport const asPostcssNodeWithChildren = (\n node?: PostcssNode,\n): PostcssNodeWithChildren => {\n if (!node) {\n throw error('Expected a query node')\n }\n\n if (!isPostcssNodeWithChildren(node)) {\n throw error('Not a query selector node with children', {\n found: node,\n })\n }\n return node\n}\n\nconst isObj = (o: unknown): o is Record<string, unknown> =>\n !!o && typeof o === 'object'\n\nexport const isAttributeNode = (node: unknown): node is Attribute =>\n isObj(node) && !!node.attribute && node.type === 'attribute'\n\nexport const asAttributeNode = (node?: PostcssNode): Attribute => {\n if (!node) {\n throw error('Expected a query node')\n }\n\n if (!isAttributeNode(node)) {\n throw error('Mismatching query node', {\n wanted: 'attribute',\n found: node.type,\n })\n }\n return node\n}\n\nexport const isCombinatorNode = (node: unknown): node is Combinator =>\n isObj(node) && !!node.value && node.type === 'combinator'\n\nexport const asCombinatorNode = (node?: PostcssNode): Combinator => {\n if (!node) {\n throw error('Expected a query node')\n }\n\n if (!isCombinatorNode(node)) {\n throw error('Mismatching query node', {\n wanted: 'combinator',\n found: node.type,\n })\n }\n return node\n}\n\nexport const isIdentifierNode = (node: any): node is Identifier =>\n isObj(node) && !!node.value && node.type === 'id'\n\nexport const asIdentifierNode = (node?: PostcssNode): Identifier => {\n if (!node) {\n throw error('Expected a query node')\n }\n\n if (!isIdentifierNode(node)) {\n throw error('Mismatching query node', {\n wanted: 'id',\n found: node.type,\n })\n }\n return node\n}\n\nexport const isSelectorNode = (node: any): node is Selector =>\n isPostcssNodeWithChildren(node) && node.type === 'selector'\n\nexport const asSelectorNode = (node?: PostcssNode): Selector => {\n if (!node) {\n throw error('Expected a query node')\n }\n\n if (!isSelectorNode(node)) {\n throw error('Mismatching query node', {\n wanted: 'selector',\n found: node.type,\n })\n }\n return node\n}\n\nexport const isPseudoNode = (node: unknown): node is Pseudo =>\n isObj(node) && !!node.value && node.type === 'pseudo'\n\nexport const asPseudoNode = (node?: PostcssNode): Pseudo => {\n if (!node) {\n throw error('Expected a query node')\n }\n\n if (!isPseudoNode(node)) {\n throw error('Mismatching query node', {\n wanted: 'pseudo',\n found: node.type,\n })\n }\n return node\n}\n\nexport const isTagNode = (node: unknown): node is Tag =>\n isObj(node) && !!node.value && node.type === 'tag'\n\nexport const asTagNode = (node?: PostcssNode): Tag => {\n if (!node) {\n throw error('Expected a query node')\n }\n\n if (!isTagNode(node)) {\n throw error('Mismatching query node', {\n wanted: 'tag',\n found: node.type,\n })\n }\n\n return node\n}\n\nexport const isStringNode = (node: unknown): node is String =>\n isObj(node) && !!node.value && node.type === 'string'\n\nexport const asStringNode = (node?: PostcssNode): String => {\n if (!node) {\n throw error('Expected a query node')\n }\n\n if (!isStringNode(node)) {\n throw error('Mismatching query node', {\n wanted: 'string',\n found: node.type,\n })\n }\n\n return node\n}\n\nexport const isCommentNode = (node: unknown): node is Comment =>\n isObj(node) && !!node.value && node.type === 'comment'\n\nexport const asCommentNode = (node?: PostcssNode): Comment => {\n if (!node) {\n throw error('Expected a query node')\n }\n\n if (!isCommentNode(node)) {\n throw error('Mismatching query node', {\n wanted: 'comment',\n found: node.type,\n })\n }\n\n return node\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { EdgeLike, NodeLike } from '@vltpkg/graph'\nimport type { SpecOptions } from '@vltpkg/spec/browser'\nimport type {\n SecurityArchiveLike,\n PackageScore,\n} from '@vltpkg/security-archive'\nimport type { DepID } from '@vltpkg/dep-id'\nimport type { PostcssNode } from '@vltpkg/dss-parser'\n\nexport type Specificity = {\n idCounter: number\n commonCounter: number\n}\n\nexport type GraphSelectionState = {\n nodes: Set<NodeLike>\n edges: Set<EdgeLike>\n}\n\nexport type ParserState = {\n cancellable: () => Promise<void>\n collect: GraphSelectionState\n comment: string\n current: PostcssNode\n initial: GraphSelectionState\n loose?: boolean\n next?: PostcssNode\n prev?: PostcssNode\n result?: NodeLike[]\n signal: AbortSignal\n walk: ParserFn\n partial: GraphSelectionState\n retries: number\n securityArchive: SecurityArchiveLike | undefined\n specOptions: SpecOptions\n scopeIDs?: DepID[]\n specificity: Specificity\n}\n\nexport type QueryResponse = {\n edges: QueryResponseEdge[]\n nodes: QueryResponseNode[]\n comment: string\n specificity: Specificity\n}\n\nexport type QueryResponseEdge = Omit<EdgeLike, 'from' | 'to'> & {\n from: QueryResponseNode\n to?: QueryResponseNode\n}\n\nexport type QueryResponseNode = Omit<\n NodeLike,\n 'edgesIn' | 'edgesOut'\n> & {\n edgesIn: Set<QueryResponseEdge>\n edgesOut: Map<string, QueryResponseEdge>\n insights: Insights\n toJSON: () => Pick<\n QueryResponseNode,\n | 'id'\n | 'name'\n | 'version'\n | 'location'\n | 'importer'\n | 'manifest'\n | 'projectRoot'\n | 'integrity'\n | 'resolved'\n | 'dev'\n | 'optional'\n | 'insights'\n | 'confused'\n >\n}\n\nexport type Insights = {\n abandoned?: boolean\n confused?: boolean\n cve?: `CVE-${string}`[]\n cwe?: `CWE-${string}`[]\n debug?: boolean\n deprecated?: boolean\n dynamic?: boolean\n entropic?: boolean\n env?: boolean\n eval?: boolean\n fs?: boolean\n license?: LicenseInsights\n malware?: MalwareInsights\n minified?: boolean\n native?: boolean\n network?: boolean\n obfuscated?: boolean\n scanned: boolean\n score?: PackageScore\n scripts?: boolean\n severity?: SeverityInsights\n shell?: boolean\n shrinkwrap?: boolean\n squat?: SquatInsights\n suspicious?: boolean\n tracker?: boolean\n trivial?: boolean\n undesirable?: boolean\n unknown?: boolean\n unmaintained?: boolean\n unpopular?: boolean\n unstable?: boolean\n}\n\nexport type LicenseInsights = {\n unlicensed: boolean\n misc: boolean\n restricted: boolean\n ambiguous: boolean\n copyleft: boolean\n unknown: boolean\n none: boolean\n exception: boolean\n}\n\nexport type LeveledInsights = {\n low: boolean\n medium: boolean\n high: boolean\n critical: boolean\n}\n\nexport type MalwareInsights = LeveledInsights\nexport type SeverityInsights = LeveledInsights\n\nexport type SquatInsights = {\n medium: boolean\n critical: boolean\n}\n\nexport type ParserFn = (opt: ParserState) => Promise<ParserState>\n\nexport type ParsedSelectorToken = PostcssNode & {\n token: string\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-14",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/vltpkg/vltpkg.git",
|
|
@@ -21,24 +21,25 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"p-retry": "^6.2.1",
|
|
23
23
|
"postcss-selector-parser": "^7.1.0",
|
|
24
|
-
"@vltpkg/dep-id": "0.0.0-
|
|
25
|
-
"@vltpkg/
|
|
26
|
-
"@vltpkg/security-archive": "0.0.0-
|
|
27
|
-
"@vltpkg/
|
|
28
|
-
"@vltpkg/
|
|
29
|
-
"@vltpkg/types": "0.0.0-
|
|
24
|
+
"@vltpkg/dep-id": "0.0.0-14",
|
|
25
|
+
"@vltpkg/dss-parser": "0.0.0-14",
|
|
26
|
+
"@vltpkg/security-archive": "0.0.0-14",
|
|
27
|
+
"@vltpkg/graph": "0.0.0-14",
|
|
28
|
+
"@vltpkg/error-cause": "0.0.0-14",
|
|
29
|
+
"@vltpkg/types": "0.0.0-14",
|
|
30
|
+
"@vltpkg/semver": "0.0.0-14"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
|
-
"@eslint/js": "^9.
|
|
33
|
-
"@types/node": "^22.15.
|
|
34
|
-
"eslint": "^9.
|
|
33
|
+
"@eslint/js": "^9.28.0",
|
|
34
|
+
"@types/node": "^22.15.29",
|
|
35
|
+
"eslint": "^9.28.0",
|
|
35
36
|
"prettier": "^3.5.3",
|
|
36
37
|
"tap": "^21.1.0",
|
|
37
38
|
"tshy": "^3.0.2",
|
|
38
39
|
"typedoc": "~0.27.9",
|
|
39
40
|
"typescript": "5.7.3",
|
|
40
|
-
"typescript-eslint": "^8.
|
|
41
|
-
"@vltpkg/spec": "0.0.0-
|
|
41
|
+
"typescript-eslint": "^8.33.1",
|
|
42
|
+
"@vltpkg/spec": "0.0.0-14"
|
|
42
43
|
},
|
|
43
44
|
"license": "BSD-2-Clause-Patent",
|
|
44
45
|
"engines": {
|