@vltpkg/dss-parser 0.0.0-22 → 0.0.0-24

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.
@@ -1,5 +1,6 @@
1
- import type { Tag, String, Selector, Root, Pseudo, Nesting, Identifier, Comment, Combinator, ClassName, Attribute, Universal } from 'postcss-selector-parser';
1
+ import type { Tag, String, Selector, Root, Pseudo, Nesting, Identifier, Comment, Combinator, ClassName, Attribute, Universal, tag, id, combinator, string, attribute, pseudo } from 'postcss-selector-parser';
2
2
  export type PostcssNode = Tag | String | Selector | Root | Pseudo | Nesting | Identifier | Comment | Combinator | ClassName | Attribute | Universal;
3
+ export type PostCSSLeaf = ReturnType<typeof tag> | ReturnType<typeof id> | ReturnType<typeof attribute> | ReturnType<typeof combinator> | ReturnType<typeof pseudo> | ReturnType<typeof string>;
3
4
  export type PostcssNodeWithChildren = Selector | Root | Pseudo;
4
5
  export type ParsedSelectorToken = PostcssNode & {
5
6
  token: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,GAAG,EACH,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,OAAO,EACP,UAAU,EACV,OAAO,EACP,UAAU,EACV,SAAS,EACT,SAAS,EACT,SAAS,EACV,MAAM,yBAAyB,CAAA;AAEhC,MAAM,MAAM,WAAW,GACnB,GAAG,GACH,MAAM,GACN,QAAQ,GACR,IAAI,GACJ,MAAM,GACN,OAAO,GACP,UAAU,GACV,OAAO,GACP,UAAU,GACV,SAAS,GACT,SAAS,GACT,SAAS,CAAA;AAEb,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,IAAI,GAAG,MAAM,CAAA;AAE9D,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG;IAC9C,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,eAAO,MAAM,yBAAyB,SAC9B,GA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AK,CAAC,wBAAwB,EAAE;YACpC,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE,IAAI,CAAC,IAAI;SACjB,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,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 {\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 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 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":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAkD3C,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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M,EAAE,QAAQ;YAChB,KAAK,EAAE,IAAI,CAAC,IAAI;SACjB,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,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 {\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 tag,\n id,\n combinator,\n string,\n attribute,\n pseudo,\n} from 'postcss-selector-parser'\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 PostCSSLeaf =\n | ReturnType<typeof tag>\n | ReturnType<typeof id>\n | ReturnType<typeof attribute>\n | ReturnType<typeof combinator>\n | ReturnType<typeof pseudo>\n | ReturnType<typeof string>\n\nexport type PostcssNodeWithChildren = Selector | Root | Pseudo\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"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vltpkg/dss-parser",
3
3
  "description": "The Dependency Selector Syntax (DSS) parser",
4
- "version": "0.0.0-22",
4
+ "version": "0.0.0-24",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/vltpkg/vltpkg.git",
@@ -20,18 +20,18 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "postcss-selector-parser": "^7.1.0",
23
- "@vltpkg/error-cause": "0.0.0-22"
23
+ "@vltpkg/error-cause": "0.0.0-24"
24
24
  },
25
25
  "devDependencies": {
26
- "@eslint/js": "^9.28.0",
27
- "@types/node": "^22.15.29",
28
- "eslint": "^9.28.0",
29
- "prettier": "^3.6.0",
26
+ "@eslint/js": "^9.34.0",
27
+ "@types/node": "^22.17.2",
28
+ "eslint": "^9.34.0",
29
+ "prettier": "^3.6.2",
30
30
  "tap": "^21.1.0",
31
31
  "tshy": "^3.0.2",
32
32
  "typedoc": "~0.27.9",
33
33
  "typescript": "5.7.3",
34
- "typescript-eslint": "^8.33.1"
34
+ "typescript-eslint": "^8.40.0"
35
35
  },
36
36
  "license": "BSD-2-Clause-Patent",
37
37
  "engines": {