Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@salesforce-ux/design-system-parser
Advanced tools
Readme
Parses CSS comments into a tree data structure using assertion selectors.
npm install @salesforce-ux/design-system-parser
comments :: () -> [Comment]
components :: () -> [Component]
component :: Id -> FullComponent
moduleComponents :: () -> [ModuleComponent]
moduleComponent :: Id -> FullModule
findVariant :: (Id, FullComponent) -> FullComponent
findModifier :: (Id, FullComponent) -> FullComponent
Base | Variant | Modifier
restrictees
@
symbolsRepo
.utils
are comments with a restrict of *
so we can't use them for hierarchy building.fancy
comments are ones with with any special characters in their restriction. It separates any css selector syntax from plain
classnames and element names (e.g. td[class=~"Im fancy"] vs td.plain > name). This is because we need to actually interpret fancy
selectors, but the rest can be statically indexed. Speaking of which, it then sets up an INDEX of {restrict: [comment]}
where any classname mentioned in the restrict is now a key in this INDEX pointing to the comment. This is so we can rapidly look up the comments via a selector later.
We start by finding the first concrete variant. This is because there is no selector/restrict on an abstract component. Then we call recurse
with a cache and the first variant.
recurse
will first get the selector from the comment, then exit if it's missing or if we've already populated the restrictees for that comment in the cache. We then find all comments who's restrict rule matches our selector and recursively populate each of their restrictees before finally setting them to the restrictees attribute of our comment. The workhorse here is Repo.findAllByRestrict
Repo.findAllByRestrict
starts by searching the INDEX, which is keyed by selector names mentioned in restrict rules. Then, it does a second pass on (the much smaller set) fancy
. For fancy
, we first make sure we're not comparing the comment to itself, then we find the restrict. With restrict in hand, we actually generate html according to the selector and apply the restrict to see if there's a match using cheerio. This is much like how validation works in ds-markup.
Utilities work top-down looking for selectors, not restricts. The reason is restrict should always be *
(or .myscope > *
) for a utility. We use the same matching technique we used with fancy
, but this time we use utils
and also flip the html generation around: the candidates generate html and the abstract utility's selector is used to match.
Source code is licensed under BSD 3-Clause
FAQs
Parse CSS comments into a data structure
The npm package @salesforce-ux/design-system-parser receives a total of 13 weekly downloads. As such, @salesforce-ux/design-system-parser popularity was classified as not popular.
We found that @salesforce-ux/design-system-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.