hast-util-parse-selector is a small utility that creates a HAST element from a simple CSS selector, optionally using a default tag name when none is provided. It is useful when you want to turn selector strings like tag, classes, and ID into a parsed element structure for syntax-tree based HTML processing.
Project status
- The most recent upstream updates are from 2023-08-01 (v4.0.0), and there have been no further pushes up to today (2026-06-09), so the source appears quiet/dormant rather than actively maintained.
- Update cadence appears irregular and infrequent, with releases spanning years (e.g., v4.0.0 in 2023, prior notable updates in 2023-01, then 2021 and earlier), indicating no steady modern release rhythm.
AI summary generated 2026-06-09
Recent updates
4.0.0
2023-08-01Release 4.0.0 updates runtime and type requirements (Node.js 16), removes older TypeScript compatibility, and switches the package distribution to use the package.json `exports` field. The main functional code change appears to be around type-level selector inference, while most runtime behavior remains centered on `parseSelector` producing the same element shape.
Breaking3.1.1
2023-01-07Release 3.1.1 is described as a docs-only change (“Add improved docs”). However, the diff shows multiple non-documentation changes, including a runtime code re-organization and changes to how `defaultTagName` is handled.
3.1.0
2021-05-09Release 3.1.0 adds TypeScript type inference so `parseSelector()` can infer a more specific `tagName` type from the provided selector string. The implementation and published type artifacts also add supporting helper types and compatibility shims for older TypeScript versions.
Features3.0.0
2021-04-26Version 3.0.0 converts the package to ESM and adds JSDoc-driven type support by generating an index.d.ts file. The implementation now exports a named function parseSelector and updates the build and test tooling to TypeScript declarations and c8 coverage checks.
Breaking2.2.5
2020-10-31Release 2.2.5 includes a refactor intended to improve bundle size and performance, plus an update to the README with a related-projects list. The runtime code change is limited to the selector parsing implementation, but the repository tooling/development dependencies were also updated.
Features2.2.4
2020-02-29Release 2.2.4 is described as a prose refactor. The diff shows no runtime code changes, but it does update package metadata (description/keywords) and developer tooling versions, plus several README wording and link changes.
2.2.3
2019-11-10Release 2.2.3 mainly updates project metadata and documentation. It adds a funding block to package.json and introduces a README security section warning about XSS risks when resolving selector values to script elements.
SecurityFeatures2.2.2
2019-05-26Release 2.2.2 is mainly a small internal refactor to use numeric character codes when parsing selector strings, plus documentation-only wording changes. The published code diff does not show any API export or runtime behavior change beyond the character-code refactor.
2.2.1
2018-11-07Release 2.2.1 mainly updates project metadata, README badge links, and switches several URLs to HTTPS, plus renames LICENSE to license. The diff also updates the development toolchain (devDependencies and build scripts), which is not mentioned in the release notes.
2.2.0
2018-07-17Release 2.2.0 adds an optional `defaultTagName` parameter so `parseSelector` can use a tag name when the selector string does not specify one. The README and tests were updated to reflect the new API and behavior.
Features