Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: deprecate axe.imports and upgrade to css-selector-parser 3 #4264

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Dec 1, 2023

Because css-selector-parser 3.0 has changed its API completely we're unable to maintain full support for axe.imports.CssSelectorParser. As best we can tell this isn't used. axe.import is not a documented feature of axe-core, but just in case this PR adds a class that wraps css-selector-parser's createParser method.

Bumps css-selector-parser from 1.4.1 to 3.0.2.

Changelog

Sourced from css-selector-parser's changelog.

3.0.2 (2023-11-21)

Bug Fixes

  • identifier parsing for ids, classes, pseudo-classes and pseudo-elements (d222dfd)

3.0.1 (2023-11-20)

Bug Fixes

3.0.0 (2023-09-26)

⚠ BREAKING CHANGES

  • API is backwards incompatible.

Migrating from 2.x to 3.x

  1. Rule.tag was moved to Rule.items.

    Example selector: div.

    • Before: {type: 'Rule', tagName: {type: 'TagName', name: 'div'}}
    • After: {type: 'Rule', items: [{type: 'TagName', name: 'div'}]}
  2. Rule.classNames was converted to an AST entity and moved to Rule.items.

    Example selector: .user.hidden

    • Before: {type: 'Rule', classNames: ['user', 'hidden']}
    • After: {type: 'Rule', items: [{type: 'ClassName', name: 'user'}, {type: 'ClassName', name: 'hidden'}]}
  3. Rule.ids was converted to an AST entity and moved to Rule.items.

    Example selector: #root#user-1

    • Before: {type: 'Rule', ids: ['root', 'user-1']}
    • After: {type: 'Rule', items: [{type: 'Id', name: 'root'}, {type: 'Id', name: 'user-1'}]}
  4. Rule.attributes was moved to Rule.items.

    Example selector: [href^=/][role]

    • Before: {type: 'Rule', attributes: [{type: 'Attribute', name: 'href', operator: '^=', value: {type: 'String', value: '/'}}, {type: 'Attribute', name: 'role'}]}
    • After: {type: 'Rule', items: [{type: 'Attribute', name: 'href', operator: '^=', value: {type: 'String', value: '/'}}, {type: 'Attribute', name: 'role'}]}
  5. Rule.pseudoClasses was moved to Rule.items.

    Example selector: :hover:lang(en)

... (truncated)

Commits

Dependabot compatibility score

You can trigger a rebase of this PR by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore <dependency name> major version will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself)
  • @dependabot ignore <dependency name> minor version will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself)
  • @dependabot ignore <dependency name> will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself)
  • @dependabot unignore <dependency name> will remove all of the ignore conditions of the specified dependency
  • @dependabot unignore <dependency name> <ignore condition> will remove the ignore condition of the specified dependency and ignore conditions

Note
Automatic rebases have been disabled on this pull request as it has been open for over 30 days.

Bumps [css-selector-parser](https://github.com/mdevils/css-selector-parser) from 1.4.1 to 3.0.2.
- [Changelog](https://github.com/mdevils/css-selector-parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mdevils/css-selector-parser/commits/v3.0.2)

---
updated-dependencies:
- dependency-name: css-selector-parser
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot dependabot bot requested a review from a team as a code owner December 1, 2023 12:58
@dependabot dependabot bot added dependencies Pull requests that update a dependency file javascript Pull requests that update Javascript code labels Dec 1, 2023
@WilcoFiers WilcoFiers changed the title chore: bump css-selector-parser from 1.4.1 to 3.0.2 feat: deprecate axe.imports Dec 4, 2023
@WilcoFiers WilcoFiers changed the title feat: deprecate axe.imports feat: deprecate axe.imports and upgrade to css-selector-parser 3 Dec 4, 2023
* @memberof axe
*/
export { CssSelectorParser, doT, emojiRegexText, memoize, Color as Colorjs };
export { CSSSelectorParser, doT, emojiRegexText, memoize, Color as Colorjs };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't update the casing of CSS otherwise this is a breaking change

Suggested change
export { CSSSelectorParser, doT, emojiRegexText, memoize, Color as Colorjs };
export { CssSelectorParser, doT, emojiRegexText, memoize, Color as Colorjs };

/**
* @deprecated
*/
class CSSSelectorParser {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class isn't a 1:1 back compatible wrapper. The return of CssSelectorParser was a class, but the class also had additional functions that were used to configure the parser (registerSelectorPseudos, registerNestingOperators, etc.). In order to fully be back compatible, this class would need to implement those functions and probably then call createParser in the parse function with all the settings the user has set using the configuration functions.


export default parser;
export default { parse };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changed the export to a named export so you'll also need to update the import in matches.

Copy link
Contributor Author

dependabot bot commented on behalf of github Jan 1, 2024

A newer version of css-selector-parser exists, but since this PR has been edited by someone other than Dependabot I haven't updated it. You'll get a PR for the updated version as normal once this PR is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file javascript Pull requests that update Javascript code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants