Registry / serialization / bo-selector

bo-selector

JSON →
library0.0.10jsnpmunverified

The `bo-selector` package provides a CSS selector parser capable of generating an Abstract Syntax Tree (AST) from a CSS selector string. It is built using `jison`, a parser generator, which is a development dependency, meaning the runtime package has no external dependencies. The package is currently at version 0.0.10 and has not seen updates since its last publish in October 2013, indicating it is an abandoned project. Its primary utility is to parse CSS selectors like `'p:has(.foo), b'` into a structured JavaScript object that represents the selector's components and relationships. It exclusively uses the CommonJS module system. Given its age and lack of maintenance, it is highly unlikely to support modern CSS selector features introduced after 2013, nor does it provide an ECMAScript Module (ESM) entry point, making integration into contemporary JavaScript projects challenging.

npm install bo-selector
INSTALL
IMPORT
SIG · BO-SELECTOR
B
bo-selector
serializationjavascriptv0.0.10
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parser
const parser = require('bo-selector').parser;
import { parser } from 'bo-selector';
This package is CommonJS-only and does not provide an ESM export. Direct property access is required.

Demonstrates parsing a CSS selector string into an Abstract Syntax Tree (AST) and inspecting its structure.

const parser = require('bo-selector').parser; const util = require('util'); // Example CSS selector string const cssSelector = 'p:has(.foo), b.bar[data-attr="value"]'; // Parse the CSS selector into an Abstract Syntax Tree (AST) const ast = parser.parse(cssSelector); // Log the generated AST in a human-readable format console.log('Parsed AST:'); console.log(util.inspect(ast, { depth: null, colors: true })); // Demonstrate accessing parts of the AST (simplified) if (ast.type === 'selector_list' && ast.selectors.length > 0) { const firstSelectorElement = ast.selectors[0].element; console.log('\nFirst selector element name:', firstSelectorElement.name); if (firstSelectorElement.constraints && firstSelectorElement.constraints.length > 0) { console.log('First selector element constraints:', firstSelectorElement.constraints.map(c => c.type)); } }
Debug
Known issues
breakingThe `bo-selector` package is abandoned, with its last publish in October 2013. It is not maintained and will not receive updates for new CSS features, bug fixes, or security patches.
fix
Consider using modern, actively maintained CSS selector parsers or libraries (e.g., PostCSS, css-tree) for new projects. If you must use this package, be aware of its limitations and security implications.
affects: >=0.0.1
gotchaThis package is strictly CommonJS-only. Attempting to use `import` statements will result in errors in an ESM context.
fix
Ensure your project is configured for CommonJS (`require()`) when using this package. If your project is ESM-first, you may need to use a bundler or dynamic import (`await import()`) if compatibility layers exist, or prefer an alternative ESM-compatible parser.
affects: >=0.0.1
gotchaDue to its age, `bo-selector` does not support modern CSS selector syntax (e.g., `:is()`, `:where()`, `:has()` with complex arguments, new pseudo-classes/elements) introduced after CSS Selectors Level 3 (roughly 2011-2013).
fix
Test your specific selector syntax extensively. For selectors not supported, you will need to manually parse or pre-process them, or switch to a more modern parser.
affects: >=0.0.1
Errors
Common errors & fixes
SyntaxError: Cannot use import statement outside a module
Attempting to use `import { parser } from 'bo-selector';` in an ESM module context.
fix
Use the CommonJS `require()` syntax: `const parser = require('bo-selector').parser;`
parser.parse is not a function
Incorrectly trying to call `bo-selector()` directly or a non-existent method.
fix
Ensure you are accessing the `parser` property from the required module: `const { parser } = require('bo-selector');` or `const boselector = require('bo-selector'); const parser = boselector.parser;`
Upgrade
Version history
0.0.10latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources
bo-selector — npm install bo-selector · libregistry