Repository navigation
Conversation
Accept a source callback without generating CSS when only an explicit from path is read. Reuse eager initialization for source maps, BOM handling, documents and error positions, then cache writable source properties. Add regression coverage for deferred evaluation, source maps, serialization and failed initialization.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthrough
ChangesLazy Input CSS
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant Caller
participant Input
participant Source as CSS source function
Caller->>Input: Read CSS-dependent property
Input->>Source: Invoke source function
Source-->>Input: Return CSS string
Input-->>Caller: Return initialized property
Merge Risk: ⚪ Minimal · up to The reviewed change has no identified issue that should delay merging after normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
It looks like a feature for 9.0 release |
Closes #1945
Allow
Inputto receive a function that generates its CSS on demand:The lazy path reuses the existing constructor for BOM handling, documents, and source maps. Successful initialization replaces the accessors with ordinary writable properties. If initialization throws, the input can be retried. String and Buffer inputs keep their existing eager behavior.
Without
from, resolving the input identifier may generate the source because a previous source map can supply the filename. The constructor documentation describes this distinction.Added tests for deferred generation, caching, BOMs, source maps, writable properties, failed initialization, JSON round-tripping, and error positions. The new tests fail against the original implementation.
pnpm testpasses on Arch Linux with Node.js 26.10.0 and pnpm 11.28.4: 731 unit tests, 100% line coverage, lint, types, version, integration, and size checks. Other Node versions and Windows have not been run locally.Summary by CodeRabbit