Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/tailwindcss/src/utils/brace-expansion.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ describe('expand(…)', () => {
expect(() => expand('a{b,c{d,e},{f,g}h}x{y,z')).toThrowErrorMatchingInlineSnapshot(
`[Error: The pattern \`x{y,z\` is not balanced.]`,
)
expect(() => expand('a{b,{c}')).toThrowErrorMatchingInlineSnapshot(
`[Error: The pattern \`a{b,{c}\` is not balanced.]`,
)
})

test('throws when step is set to zero', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/tailwindcss/src/utils/brace-expansion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function expand(pattern: string): string[] {

// Find the matching closing brace
let depth = 0
let endIndex = rest.lastIndexOf('}')
let endIndex = -1
for (let i = 0; i < rest.length; i++) {
let char = rest[i]
if (char === '{') {
Expand Down