-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5b964c4
commit b4c7e17
Showing
12 changed files
with
5,124 additions
and
3,185 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_style = tab | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.yml] | ||
indent_size = 2 | ||
indent_style = space |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: test | ||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
- 'master' | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
# Test node 14/16/18/20/22 on ubuntu | ||
# Test node 20 on macos/windows | ||
# Enable annotations only for node 20 + ubuntu | ||
matrix: | ||
os: [ubuntu-latest] | ||
node: [16, 18, 20, 22] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
|
||
- name: npm ci | ||
run: npm ci | ||
|
||
- name: test | ||
run: npm run test |
This file was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
module.exports = function resolveNestedSelector(selector, node) { | ||
var parent = node.parent; | ||
var parentIsNestAtRule = parent.type === 'atrule' && parent.name === 'nest'; | ||
var parent = node.parent; | ||
var parentIsNestAtRule = parent.type === 'atrule' && parent.name === 'nest'; | ||
|
||
if (parent.type === 'root') return [selector]; | ||
if (parent.type !== 'rule' && !parentIsNestAtRule) return resolveNestedSelector(selector, parent); | ||
if (parent.type === 'root') return [selector]; | ||
if (parent.type !== 'rule' && !parentIsNestAtRule) return resolveNestedSelector(selector, parent); | ||
|
||
var parentSelectors = (parentIsNestAtRule) | ||
? parent.params.split(',').map(function(s) { return s.trim(); }) | ||
: parent.selectors; | ||
var parentSelectors = (parentIsNestAtRule) | ||
? parent.params.split(',').map(function(s) { return s.trim(); }) | ||
: parent.selectors; | ||
|
||
var resolvedSelectors = parentSelectors.reduce(function(result, parentSelector) { | ||
if (selector.indexOf('&') !== -1) { | ||
var newlyResolvedSelectors = resolveNestedSelector(parentSelector, parent).map(function(resolvedParentSelector) { | ||
return selector.replace(/&/g, resolvedParentSelector); | ||
}); | ||
return result.concat(newlyResolvedSelectors); | ||
} | ||
var resolvedSelectors = parentSelectors.reduce(function(result, parentSelector) { | ||
if (selector.indexOf('&') !== -1) { | ||
var newlyResolvedSelectors = resolveNestedSelector(parentSelector, parent).map(function(resolvedParentSelector) { | ||
return selector.replace(/&/g, resolvedParentSelector); | ||
}); | ||
return result.concat(newlyResolvedSelectors); | ||
} | ||
|
||
var combinedSelector = [ parentSelector, selector ].join(' '); | ||
return result.concat(resolveNestedSelector(combinedSelector, parent)); | ||
}, []); | ||
var combinedSelector = [ parentSelector, selector ].join(' '); | ||
return result.concat(resolveNestedSelector(combinedSelector, parent)); | ||
}, []); | ||
|
||
return resolvedSelectors; | ||
return resolvedSelectors; | ||
} |
Oops, something went wrong.