Skip to content

Commit 02f940a

Browse files
committed
rm "legacy" parse parameter
1 parent c0a580e commit 02f940a

File tree

2 files changed

+2
-42
lines changed

2 files changed

+2
-42
lines changed

src/parser-options.test.ts

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -177,41 +177,6 @@ describe('Parser Options', () => {
177177
})
178178
})
179179

180-
describe('Backwards compatibility', () => {
181-
it('should support legacy boolean parameter for skip_comments', () => {
182-
const parser = new Parser('/* comment */ body { color: red; }', true)
183-
const root = parser.parse()
184-
const rule = root.first_child
185-
186-
// Should parse normally with comments skipped
187-
expect(rule).not.toBeNull()
188-
const selector = rule?.first_child
189-
expect(selector?.text).toBe('body')
190-
})
191-
192-
it('should support legacy boolean false parameter', () => {
193-
const parser = new Parser('/* comment */ body { color: red; }', false)
194-
const root = parser.parse()
195-
196-
// First child should be comment
197-
const comment = root.first_child
198-
expect(comment).not.toBeNull()
199-
})
200-
201-
it('should parse values and selectors with legacy parameter', () => {
202-
const parser = new Parser(css, true)
203-
const root = parser.parse()
204-
const rule = root.first_child
205-
const selector = rule?.first_child
206-
const declaration = selector?.next_sibling
207-
208-
// Both should be parsed by default
209-
// Simple selector returns NODE_SELECTOR directly
210-
expect(selector?.type).toBe(NODE_SELECTOR)
211-
expect(declaration?.has_children).toBe(true)
212-
})
213-
})
214-
215180
describe('Performance optimization use cases', () => {
216181
it('should skip value parsing for fast property name extraction', () => {
217182
const css = `

src/parser.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,11 @@ export class Parser {
4949
private parse_selectors_enabled: boolean
5050
private parse_atrule_preludes_enabled: boolean
5151

52-
constructor(source: string, options?: ParserOptions | boolean) {
52+
constructor(source: string, options?: ParserOptions) {
5353
this.source = source
5454

5555
// Support legacy boolean parameter for backwards compatibility
56-
let opts: ParserOptions
57-
if (typeof options === 'boolean') {
58-
opts = { skip_comments: options }
59-
} else {
60-
opts = options || {}
61-
}
56+
let opts: ParserOptions = options || {}
6257

6358
let skip_comments = opts.skip_comments ?? true
6459
this.parse_values_enabled = opts.parse_values ?? true

0 commit comments

Comments
 (0)