Skip to content

Commit

Permalink
add support for pin being a port alias for selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
seveibar committed Aug 29, 2024
1 parent 9bbb3b9 commit ca12b31
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
12 changes: 12 additions & 0 deletions lib/utils/extend-aliases.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export const extendAliases = (
aliases: string[],
additionalAliases: Record<string, string[]>,
): string[] => {
return Array.from(
new Set(
aliases.flatMap((alias) => {
return [alias, ...(additionalAliases[alias] || [])]
}),
),
)
}
4 changes: 3 additions & 1 deletion lib/utils/selector-matching/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ export function isMatchingSelector(
}

// Split the selector into type and conditions
const [type, ...conditions] = selector.split(/(?=[#.[])/)
let [type, ...conditions] = selector.split(/(?=[#.[])/)

if (type === "pin") type = "port"

// Check if the component type matches
if (
Expand Down

0 comments on commit ca12b31

Please sign in to comment.