---
title: "@vltpkg/dss-parser: Reference — vlt docs"
description: "Documentation for the vlt client and the vlt registry."
url: "https://docs.vlt.io/client/api-reference/dss-parser/reference"
image: "https://docs.vlt.io/og/client/api-reference/dss-parser/reference"
lang: "en"
---

# Reference

## Type Aliases

### AttributeOperatorName

```ts
type AttributeOperatorName = typeof attributeOperatorNames[number];
```

Defined in: grammar.ts:102

---

### CombinatorName

```ts
type CombinatorName = typeof combinatorNames[number];
```

Defined in: grammar.ts:89

---

### ParsedSelectorToken

```ts
type ParsedSelectorToken = PostcssNode & object;
```

Defined in: types.ts:47

#### Type declaration

| Name    | Type     |
| ------- | -------- |
| `token` | `string` |

---

### ParseOptions

```ts
type ParseOptions = object;
```

Defined in: index.ts:165

#### Type declaration

| Name     | Type      | Description                                            |
| -------- | --------- | ------------------------------------------------------ |
| `loose`? | `boolean` | skip DSS grammar checks, malformed syntax still throws |

---

### PartPseudoName

```ts
type PartPseudoName = typeof partPseudoNames[number];
```

Defined in: grammar.ts:83

---

### PostCSSLeaf

```ts
type PostCSSLeaf = 
  | ReturnType<typeof tag>
  | ReturnType<typeof id>
  | ReturnType<typeof attribute>
  | ReturnType<typeof combinator>
  | ReturnType<typeof pseudo>
| ReturnType<typeof string>;
```

Defined in: types.ts:37

---

### PostcssNode

```ts
type PostcssNode = 
  | Tag
  | String
  | Selector
  | Root
  | Pseudo
  | Nesting
  | Identifier
  | Comment
  | Combinator
  | ClassName
  | Attribute
  | Universal;
```

Defined in: types.ts:23

---

### PostcssNodeWithChildren

```ts
type PostcssNodeWithChildren = Selector | Root | Pseudo;
```

Defined in: types.ts:45

---

### PseudoClassName

```ts
type PseudoClassName = typeof pseudoClassNames[number];
```

Defined in: grammar.ts:75

## Variables

### attributeOperatorNames

```ts
const attributeOperatorNames: readonly ["=", "^=", "$=", "~=", "*=", "|="];
```

Defined in: grammar.ts:94

Attribute selector operators supported by DSS.

---

### combinatorNames

```ts
const combinatorNames: readonly [">", "~", " "];
```

Defined in: grammar.ts:88

Combinators supported by DSS.

---

### partPseudoNames

```ts
const partPseudoNames: readonly ["skill"];
```

Defined in: grammar.ts:82

Part selectors: pseudo-classes that pick a part of the packages their selector matched, e.g. `:skill()`. They must end a top-level selector.

---

### pseudoClassNames

```ts
const pseudoClassNames: readonly ["abandoned", "attr", "built", "confused", "cve", "cwe", "debug", "deprecated", "dev", "diff", "dist", "dynamic", "empty", "entropic", "env", "eval", "fs", "has", "host", "hostname", "is", "license", "link", "malware", "minified", "missing", "native", "network", "not", "obfuscated", "optional", "outdated", "overridden", "path", "peer", "prerelease", "private", "prod", "project", "published", "registry", "root", "scanned", "scope", "score", "scripts", "semver", "sev", "severity", "shell", "shrinkwrap", "skill", "skills", "spec", "squat", "suspicious", "tracker", "trivial", "type", "types", "undesirable", "unknown", "unmaintained", "unpopular", "unstable", "v", "vuln", "vulnerable", "workspace"];
```

Defined in: grammar.ts:4

Pseudo-class names supported by DSS, without the leading `:`.

## Functions

### asAttributeNode()

```ts
function asAttributeNode(node?): Attribute
```

Defined in: types.ts:77

#### Parameters

| Parameter | Type                                                                                          |
| --------- | --------------------------------------------------------------------------------------------- |
| `node`?   | [`PostcssNode`](https://docs.vlt.io/client/api-reference/dss-parser/reference.md#postcssnode) |

#### Returns

`Attribute`

---

### asCombinatorNode()

```ts
function asCombinatorNode(node?): Combinator
```

Defined in: types.ts:94

#### Parameters

| Parameter | Type                                                                                          |
| --------- | --------------------------------------------------------------------------------------------- |
| `node`?   | [`PostcssNode`](https://docs.vlt.io/client/api-reference/dss-parser/reference.md#postcssnode) |

#### Returns

`Combinator`

---

### asCommentNode()

```ts
function asCommentNode(node?): Comment
```

Defined in: types.ts:198

#### Parameters

| Parameter | Type                                                                                          |
| --------- | --------------------------------------------------------------------------------------------- |
| `node`?   | [`PostcssNode`](https://docs.vlt.io/client/api-reference/dss-parser/reference.md#postcssnode) |

#### Returns

`Comment`

---

### asIdentifierNode()

```ts
function asIdentifierNode(node?): Identifier
```

Defined in: types.ts:111

#### Parameters

| Parameter | Type                                                                                          |
| --------- | --------------------------------------------------------------------------------------------- |
| `node`?   | [`PostcssNode`](https://docs.vlt.io/client/api-reference/dss-parser/reference.md#postcssnode) |

#### Returns

`Identifier`

---

### asPostcssNodeWithChildren()

```ts
function asPostcssNodeWithChildren(node?): PostcssNodeWithChildren
```

Defined in: types.ts:56

#### Parameters

| Parameter | Type                                                                                          |
| --------- | --------------------------------------------------------------------------------------------- |
| `node`?   | [`PostcssNode`](https://docs.vlt.io/client/api-reference/dss-parser/reference.md#postcssnode) |

#### Returns

[`PostcssNodeWithChildren`](https://docs.vlt.io/client/api-reference/dss-parser/reference.md#postcssnodewithchildren)

---

### asPseudoNode()

```ts
function asPseudoNode(node?): Pseudo
```

Defined in: types.ts:145

#### Parameters

| Parameter | Type                                                                                          |
| --------- | --------------------------------------------------------------------------------------------- |
| `node`?   | [`PostcssNode`](https://docs.vlt.io/client/api-reference/dss-parser/reference.md#postcssnode) |

#### Returns

`Pseudo`

---

### asSelectorNode()

```ts
function asSelectorNode(node?): Selector
```

Defined in: types.ts:128

#### Parameters

| Parameter | Type                                                                                          |
| --------- | --------------------------------------------------------------------------------------------- |
| `node`?   | [`PostcssNode`](https://docs.vlt.io/client/api-reference/dss-parser/reference.md#postcssnode) |

#### Returns

`Selector`

---

### asStringNode()

```ts
function asStringNode(node?): String
```

Defined in: types.ts:180

#### Parameters

| Parameter | Type                                                                                          |
| --------- | --------------------------------------------------------------------------------------------- |
| `node`?   | [`PostcssNode`](https://docs.vlt.io/client/api-reference/dss-parser/reference.md#postcssnode) |

#### Returns

`String`

---

### asTagNode()

```ts
function asTagNode(node?): Tag
```

Defined in: types.ts:162

#### Parameters

| Parameter | Type                                                                                          |
| --------- | --------------------------------------------------------------------------------------------- |
| `node`?   | [`PostcssNode`](https://docs.vlt.io/client/api-reference/dss-parser/reference.md#postcssnode) |

#### Returns

`Tag`

---

### escapeDots()

```ts
function escapeDots(query): string
```

Defined in: index.ts:34

#### Parameters

| Parameter | Type     |
| --------- | -------- |
| `query`   | `string` |

#### Returns

`string`

---

### escapeScopedNamesSlashes()

```ts
function escapeScopedNamesSlashes(query): string
```

Defined in: index.ts:28

Escapes forward slashes in specific patterns matching @scoped/name paths This will allow usage of unescaped forward slashes necessary for scoped package names in the id selector.

#### Parameters

| Parameter | Type     |
| --------- | -------- |
| `query`   | `string` |

#### Returns

`string`

---

### isAttributeNode()

```ts
function isAttributeNode(node): node is Attribute
```

Defined in: types.ts:74

#### Parameters

| Parameter | Type      |
| --------- | --------- |
| `node`    | `unknown` |

#### Returns

`node is Attribute`

---

### isCombinatorNode()

```ts
function isCombinatorNode(node): node is Combinator
```

Defined in: types.ts:91

#### Parameters

| Parameter | Type      |
| --------- | --------- |
| `node`    | `unknown` |

#### Returns

`node is Combinator`

---

### isCommentNode()

```ts
function isCommentNode(node): node is Comment
```

Defined in: types.ts:195

#### Parameters

| Parameter | Type      |
| --------- | --------- |
| `node`    | `unknown` |

#### Returns

`node is Comment`

---

### isIdentifierNode()

```ts
function isIdentifierNode(node): node is Identifier
```

Defined in: types.ts:108

#### Parameters

| Parameter | Type  |
| --------- | ----- |
| `node`    | `any` |

#### Returns

`node is Identifier`

---

### isPostcssNodeWithChildren()

```ts
function isPostcssNodeWithChildren(node): node is PostcssNodeWithChildren
```

Defined in: types.ts:51

#### Parameters

| Parameter | Type  |
| --------- | ----- |
| `node`    | `any` |

#### Returns

`node is PostcssNodeWithChildren`

---

### isPseudoNode()

```ts
function isPseudoNode(node): node is Pseudo
```

Defined in: types.ts:142

#### Parameters

| Parameter | Type      |
| --------- | --------- |
| `node`    | `unknown` |

#### Returns

`node is Pseudo`

---

### isSelectorNode()

```ts
function isSelectorNode(node): node is Selector
```

Defined in: types.ts:125

#### Parameters

| Parameter | Type  |
| --------- | ----- |
| `node`    | `any` |

#### Returns

`node is Selector`

---

### isStringNode()

```ts
function isStringNode(node): node is String
```

Defined in: types.ts:177

#### Parameters

| Parameter | Type      |
| --------- | --------- |
| `node`    | `unknown` |

#### Returns

`node is String`

---

### isTagNode()

```ts
function isTagNode(node): node is Tag
```

Defined in: types.ts:159

#### Parameters

| Parameter | Type      |
| --------- | --------- |
| `node`    | `unknown` |

#### Returns

`node is Tag`

---

### parse()

```ts
function parse(query, __namedParameters): Root
```

Defined in: index.ts:175

Parses a DSS query string into an AST Handles escaping of forward slashes in specific patterns Throws an `EQUERY` SyntaxError on invalid DSS

#### Parameters

| Parameter           | Type                                                                                            |
| ------------------- | ----------------------------------------------------------------------------------------------- |
| `query`             | `string`                                                                                        |
| `__namedParameters` | [`ParseOptions`](https://docs.vlt.io/client/api-reference/dss-parser/reference.md#parseoptions) |

#### Returns

`Root`

---

### unescapeDots()

```ts
function unescapeDots(query): string
```

Defined in: index.ts:37

#### Parameters

| Parameter | Type     |
| --------- | -------- |
| `query`   | `string` |

#### Returns

`string`
