Skip to content

Release V5 - Leverage postcss as dependency#639

Open
holblin wants to merge 7 commits into
mainfrom
v5
Open

Release V5 - Leverage postcss as dependency#639
holblin wants to merge 7 commits into
mainfrom
v5

Conversation

@holblin
Copy link
Copy Markdown

@holblin holblin commented May 20, 2026

Description

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Jean-Philippe Zolesio and others added 2 commits May 20, 2026 14:59
Replace the hand-written recursive descent parser with a lightweight
wrapper on top of PostCSS, maintaining 100% API and AST compatibility
with v4. Uses postcss-safe-parser for error recovery in silent mode.

Key implementation details:
- All 32 CssTypes AST node types preserved with identical structure
- Silent mode uses per-segment strict-parse to generate parsingErrors
- Non-silent mode falls back to safe-parser only for top-level syntax
  errors (depth 0), not for errors inside rule bodies
- IE6 star hack (*property) restored from PostCSS raws.before
- Comment whitespace preserved via raws.left/right
- Custom-media multiline params normalized during name/media split
- @import: safe-parser artifact (colon-in-name) handled transparently
- Regenerated all ast.json fixtures from v5 output

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…nd document vendor

- Declarations with ';': use PostCSS end directly (no +1) — matches v4
- Declarations without ';': use parent rule's '}' position — matches v4
- @layer statement: advance past trailing whitespace to next token — matches v4 quirk
- @document without vendor prefix: use '' not undefined — matches v4

All 222 tests now pass with the original v4 ast.json fixtures (zero diff).

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@holblin
Copy link
Copy Markdown
Author

holblin commented May 20, 2026

@jogibear9988 Could you take a look?

Jean-Philippe Zolesio and others added 4 commits May 20, 2026 17:14
Add declaration file for postcss-safe-parser (no bundled types) and
add null guards on postcss source.start/source.end which TypeScript 6
now types as possibly undefined.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
- rollup.config.mjs: mark postcss and postcss-safe-parser as external
  to eliminate unresolved dependency and Node.js shim warnings; add
  globals for UMD; fix missing outputToFilesystem:false on CJS plugin;
  add sourcemapPathTransform to fix source map paths
- biome.json: update schema version from 2.1.2 to 2.4.9 (installed version)
- src/postcss-safe-parser.d.ts: fix biome formatting (blank line, line wrapping)

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
- npm update: bump @biomejs/biome 2.4.9→2.4.15, @rollup/plugin-commonjs
  29.0.0→29.0.2, @types/node 25.5.0→25.9.1, jest 30.3.0→30.4.2,
  rollup 4.59.0→4.60.4, typescript 6.0.2→6.0.3
- Add overrides.@arethetypeswrong/core.fflate=0.8.2: fflate 0.8.3 changed
  Gunzip callback to multi-chunk streaming, breaking attw's single-chunk
  assumption; pin to 0.8.2 until attw is fixed upstream
- postbuild: replace manual tar+attw with attw --pack . (simpler, same result)
- biome.json: update schema to 2.4.15 to match installed biome version

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Resolve rollup.config.mjs conflict by keeping v5 version which has
postcss/postcss-safe-parser external deps, UMD globals, and the
sourcemapPathTransform fix from main.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@jogibear9988
Copy link
Copy Markdown

What should I say about this? I refactored my fork in a complete different way, so it has no dependecies.
If it works, I think it will be okay

Regenerated lockfile from scratch (rm node_modules + package-lock.json
+ npm install) to include @rollup/rollup-linux-x64-gnu in the lockfile.
macOS partial reinstalls omit platform-specific optional deps causing
CI failures on Linux runners.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@holblin
Copy link
Copy Markdown
Author

holblin commented May 23, 2026

No problems with you fork. On my side, I know that there is 40M download per week and professionally I have less and less time for that open source project. The idea is to make css-tools a small wrapper layer for people to have option of migrating out.

I could make the v5 with an announcement like this:

@adobe/css-tools will be retired. There is two solutions going forward:

  • Using @jogibear9988 fork
  • Using postcss (more maintained)
    If you choose the first option, you should simply use XXXX
    If you choose option 2, you could upgrade to v5 and then migrate to postcss, we hope looking at the source code of the v5 will help you to do this transition.
    both option are valid and have pros and cons. @holblin and @jogibear9988 are aligned with both options

Thoughs?

@jogibear9988
Copy link
Copy Markdown

it's okay for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants