Commit e7feb4f
committed
fix(nexu-io#6250): make opening-brace scan quote-aware for selectors
PerishCode CHANGES_REQUESTED on PR nexu-io#6250 (round 4):
"Make the opening-brace search quote-aware too. The new quote state
begins only after has already selected an
opener, so a valid selector such as treats the brace inside the attribute value as the rule
boundary. ... is , and the Buttons group has
no selectors or token references, so both rules are lost."
The previous opener lookup used , which finds
the first byte with no lexical context. A quoted inside a
selector — e.g. — was therefore selected as
the rule opener, leaving the closing of the same attribute value as
the body's first and as a corrupt
selectorList. The body scanner then ran with mismatched braces and
emitted zero rules.
Fix: replace the lookup with a quote-aware scan that mirrors
the closing-brace scanner's lexical handling. The scan walks from
, tracking single / double quote state plus backslash escapes,
and skips / that appear inside a quoted string (also skipping
comments defensively). The first un-quoted found is the
real rule-body opener.
Coverage: add a regression suite at
packages/contracts/tests/components-manifest-6250-quoted-selector.test.ts
covering both double- and single-quoted attribute selectors that
contain a . Each case pairs the quoted-brace selector with a
trailing flat rule and asserts both selectors plus their --a / --b
attribution survive on the buttons group.
Local verification:
- pnpm --filter @open-design/contracts vitest run
tests/components-manifest-6250-quoted-selector.test.ts -> 2/2 pass
- pnpm --filter @open-design/contracts test -> 254/254 pass
- pnpm --filter @open-design/contracts typecheck -> clean1 parent fe29a4d commit e7feb4f
2 files changed
Lines changed: 122 additions & 6 deletions
File tree
- packages/contracts
- src/design-systems
- tests
Lines changed: 51 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
345 | | - | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
346 | 391 | | |
347 | 392 | | |
348 | 393 | | |
| |||
360 | 405 | | |
361 | 406 | | |
362 | 407 | | |
363 | | - | |
| 408 | + | |
364 | 409 | | |
365 | 410 | | |
366 | 411 | | |
| |||
377 | 422 | | |
378 | 423 | | |
379 | 424 | | |
380 | | - | |
| 425 | + | |
381 | 426 | | |
382 | 427 | | |
383 | 428 | | |
384 | 429 | | |
385 | 430 | | |
386 | | - | |
387 | | - | |
| 431 | + | |
| 432 | + | |
388 | 433 | | |
389 | 434 | | |
390 | 435 | | |
| |||
394 | 439 | | |
395 | 440 | | |
396 | 441 | | |
397 | | - | |
| 442 | + | |
398 | 443 | | |
399 | 444 | | |
400 | 445 | | |
| |||
Lines changed: 71 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
0 commit comments