-
Notifications
You must be signed in to change notification settings - Fork 62
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
refactor(core): integrate new CSS selector parser (from Tokey) #1884
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- add `@tokey/css-selector-parser` dependency to core - only internal processor process effected - keep backwards compatibility with SRule - future intentions comments and removed export in selector-utils
- move to types / utils into deprecation folder - mark fields and related utils as deprecated with intention to remove - add alternative getStylableAstData/setStylableAstData - no breaking change - keep lib exports
- there are probably breaking changes: - some exports are not exported anymore - ast return type from scopeSelector / resolveSelectorElements
- transformer uses the new ast insterad of an & element - new scopeNestedSelector to replace previous scopeSelector - deprecated stylable-utils/scopeSelector - fix infinite loop issues when scoping selecotr contained an &
- move to deprecated folder - mark as deprecated on index export - kept tests until removed (moved to proper folder)
- move current exported api to deprecation folder - mark as deprecated on index exports
idoros
added
core
Processing and transforming logic
tech debt
Updates, upgrades, stale code and work-arounds
labels
Jun 29, 2021
- utils that used deprected stylable/selector utils - change all stylable utils to use non deprecated helpers - moved old tests to deprecated folder - new utils that work with new ast to replace deprecated utils - copied tests for new utils - changed scopeNestedSelector to return both ast & selector (immutable)
- new util to parse and cache selectors (return readonly by default) - new util to figure out isSimpleSelector - remove setting of selectorAst/isSimpleSelector/selectorType on astData - remove all usages of selectorAst/isSimpleSelector/selectorType - change utils to specify they accept readonly if they don't mutate - add reverse map for scoped class names on meta
- change parsing to tokey css selector parser
tomrav
changed the title
tokey css selector parser
New CSS Selector Parser (from Tokey)
Jul 13, 2021
tomrav
changed the title
New CSS Selector Parser (from Tokey)
refactor(core): integrate new CSS selector parser (from Tokey)
Jul 13, 2021
- add errors for selectors stylable doesn't support - exception for pseudo classes value() reference
- export getRuleScopeSelector(rule) as a backwards/forwards alternative - use getRuleScopeSelector internally
- add deprecated warn on stylableMeta.mixins - add deprecation warn on SRule.mixins - still use SRule.mixins internally for now - removed unused stylable AST data - rename ignoreWarn to ignoreDeprecationWarn
- add to deprecated types and functions
This was referenced Jul 13, 2021
- no selector transformation on the parameter itself - stop collecting reserved pseudo classes as -st-states - new warning when collecting reserved classes as states
- replace 2 versions of selector walk with a single one from tokey - use immutable type versions from tokey - remove DeepReadOnlyAll type
- no change is done directly on it during transform
- moved from toky to @Tokey - removed unused dependency in @stylable/rollup-plugin
AviVahl
reviewed
Oct 22, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR replaces the usage of
css-selector-tokenizer
with@tokey/css-selector-parser
and on the way deprecates all the utils that were used to handle the old AST.While trying to keep as much backwards/forwards compatibility working, some changes are breaking:
tasks
selector-util
to deprecate folder and route usagestylable-utils
that worked with the old selector ASTSRule/SDecl
extensions (set deprecation fields and offer alternative where we know they are required)SRule.selectorAst
- deprecated with (internally cached selector parser. publicly selector needs to be transformed manually)SRule.isSimpleSelector
- deprecated (internal util with no public alternativ)SRule.selectorType
- deprecated (internal util with no public alternativ)SRule.mixins
- deprecated (still used internally with no public alternative)SRule.stScopeSelector
- deprecated onSRule
with alternative backwards/forwards compatiblegetRuleScopeSelector(rule)
SDecl.stylable
- deprecatedelements
/resolveSelectorElements
parse/stringify
getStylableData/setStylableData
to cache selector ast onpostcss.Rule/Decl
walk
selectornext phases
cachedParseSelector
through stylable configuration