New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@markuplint/selector

Package Overview
Dependencies
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@markuplint/selector - npm Package Compare versions

Comparing version 3.0.0-alpha.5 to 3.0.0-alpha.6

2

lib/invalid-selector-error.d.ts
export declare class InvalidSelectorError extends Error {
name: string;
name: string;
}
import type { Specificity, RegexSelector } from './types';
export declare type SelectorMatches = SelectorMatched | SelectorUnmatched;
declare type SelectorMatched = {
matched: true;
selector: string;
specificity: Specificity;
data?: Record<string, string>;
export type SelectorMatches = SelectorMatched | SelectorUnmatched;
type SelectorMatched = {
matched: true;
selector: string;
specificity: Specificity;
data?: Record<string, string>;
};
declare type SelectorUnmatched = {
matched: false;
type SelectorUnmatched = {
matched: false;
};
export declare function matchSelector(el: Node, selector: string | RegexSelector | undefined): SelectorMatches;
export {};

@@ -1,3 +0,7 @@

export declare function regexSelectorMatches(reg: string, raw: string, ignoreCase: boolean): {
[x: string]: string;
export declare function regexSelectorMatches(
reg: string,
raw: string,
ignoreCase: boolean,
): {
[x: string]: string;
} | null;
import type { SelectorResult, Specificity } from './types';
declare type ExtendedPseudoClass = Record<string, (content: string) => (el: Element) => SelectorResult>;
type ExtendedPseudoClass = Record<string, (content: string) => (el: Element) => SelectorResult>;
export declare class Selector {
#private;
constructor(selector: string, extended?: ExtendedPseudoClass);
match(el: Node, scope?: ParentNode | null): Specificity | false;
search(el: Node, scope?: ParentNode | null): SelectorResult[];
#private;
constructor(selector: string, extended?: ExtendedPseudoClass);
match(el: Node, scope?: ParentNode | null): Specificity | false;
search(el: Node, scope?: ParentNode | null): SelectorResult[];
}
export {};

@@ -35,13 +35,2 @@ "use strict";

class Ruleset {
constructor(selectors, extended, depth) {
_Ruleset_selectorGroup.set(this, []);
tslib_1.__classPrivateFieldGet(this, _Ruleset_selectorGroup, "f").push(...selectors.map(selector => new StructuredSelector(selector, depth, extended)));
const head = tslib_1.__classPrivateFieldGet(this, _Ruleset_selectorGroup, "f")[0];
this.headCombinator = (head === null || head === void 0 ? void 0 : head.headCombinator) || null;
if (this.headCombinator) {
if (depth <= 0) {
throw new invalid_selector_error_1.InvalidSelectorError(`'${tslib_1.__classPrivateFieldGet(this, _Ruleset_selectorGroup, "f")[0].selector}' is not a valid selector`);
}
}
}
static parse(selector, extended) {

@@ -62,2 +51,13 @@ const selectors = [];

}
constructor(selectors, extended, depth) {
_Ruleset_selectorGroup.set(this, []);
tslib_1.__classPrivateFieldGet(this, _Ruleset_selectorGroup, "f").push(...selectors.map(selector => new StructuredSelector(selector, depth, extended)));
const head = tslib_1.__classPrivateFieldGet(this, _Ruleset_selectorGroup, "f")[0];
this.headCombinator = (head === null || head === void 0 ? void 0 : head.headCombinator) || null;
if (this.headCombinator) {
if (depth <= 0) {
throw new invalid_selector_error_1.InvalidSelectorError(`'${tslib_1.__classPrivateFieldGet(this, _Ruleset_selectorGroup, "f")[0].selector}' is not a valid selector`);
}
}
}
match(el, scope) {

@@ -64,0 +64,0 @@ (0, debug_1.log)('<%s> (%s)', (0, is_1.isElement)(el) ? el.localName : el.nodeName, scope ? ((0, is_1.isElement)(scope) ? scope.localName : scope.nodeName) : null);

@@ -1,24 +0,24 @@

export declare type Specificity = [number, number, number];
export declare type SelectorResult = SelectorMatchedResult | SelectorUnmatchedResult;
export declare type SelectorMatchedResult = {
specificity: Specificity;
matched: true;
nodes: (Element | Text)[];
has: SelectorMatchedResult[];
export type Specificity = [number, number, number];
export type SelectorResult = SelectorMatchedResult | SelectorUnmatchedResult;
export type SelectorMatchedResult = {
specificity: Specificity;
matched: true;
nodes: (Element | Text)[];
has: SelectorMatchedResult[];
};
export declare type SelectorUnmatchedResult = {
specificity: Specificity;
matched: false;
not?: SelectorMatchedResult[];
export type SelectorUnmatchedResult = {
specificity: Specificity;
matched: false;
not?: SelectorMatchedResult[];
};
export declare type RegexSelector = RegexSelectorWithoutCombination & {
combination?: {
combinator: RegexSelectorCombinator;
} & RegexSelector;
export type RegexSelector = RegexSelectorWithoutCombination & {
combination?: {
combinator: RegexSelectorCombinator;
} & RegexSelector;
};
export declare type RegexSelectorCombinator = ' ' | '>' | '+' | '~' | ':has(+)' | ':has(~)';
export declare type RegexSelectorWithoutCombination = {
nodeName?: string;
attrName?: string;
attrValue?: string;
export type RegexSelectorCombinator = ' ' | '>' | '+' | '~' | ':has(+)' | ':has(~)';
export type RegexSelectorWithoutCombination = {
nodeName?: string;
attrName?: string;
attrValue?: string;
};
{
"name": "@markuplint/selector",
"version": "3.0.0-alpha.5",
"version": "3.0.0-alpha.6",
"description": "W3C Selector and Regex selector",

@@ -25,3 +25,3 @@ "repository": "git@github.com:markuplint/markuplint.git",

"devDependencies": {
"@markuplint/ml-spec": "3.0.0-alpha.5",
"@markuplint/ml-spec": "3.0.0-alpha.6",
"@types/debug": "^4.1.7",

@@ -31,3 +31,3 @@ "@types/jsdom": "16",

},
"gitHead": "d2ee395d917cb69b91dedb0262b1c12ddc81fb58"
"gitHead": "b185a06d4ea09a1bf32458f7be4abe510eb57b89"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc