Skip to content

refactor(postcss-syntax): switch from @griffel/babel-preset to @griffel/transform#810

Draft
layershifter wants to merge 6 commits intomicrosoft:mainfrom
layershifter:refactor/next
Draft

refactor(postcss-syntax): switch from @griffel/babel-preset to @griffel/transform#810
layershifter wants to merge 6 commits intomicrosoft:mainfrom
layershifter:refactor/next

Conversation

@layershifter
Copy link
Member

Summary

  • Extends @griffel/transform with metadata output (locations, comment directives) that postcss-syntax needs, eliminating the need for @griffel/babel-preset and its Babel dependency chain
  • Refactors @griffel/postcss-syntax to consume @griffel/transform directly — removes @babel/core, @babel/helper-plugin-utils, @griffel/babel-preset dependencies
  • Switches postcss-syntax from Jest to Vitest and from .ts to .mts source files

Test plan

  • npx nx run-many -t build -p transform postcss-syntax passes
  • npx nx run-many -t test -p transform postcss-syntax passes (95 tests: 73 transform + 22 postcss-syntax)
  • npx nx run-many -t type-check -p transform postcss-syntax passes

🤖 Generated with Claude Code

layershifter and others added 6 commits March 11, 2026 17:21
…o @nx/js:tsc

Replace @nx/vite:build with @nx/js:tsc executor for these three packages.
This uses the TypeScript compiler directly instead of bundling via Rollup,
producing individual output files matching the source structure.

- Update project.json build targets to use @nx/js:tsc
- Update package.json exports to use "default" condition (compatible with bundler resolution)
- Add module: "ESNext" + moduleResolution: "bundler" to tsconfig.lib.json
- Delete vite.config.ts (was build+test), create vitest.config.mts (test-only)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…_RSPACK branches

Switch e2e-rspack from deprecated @griffel/webpack-extraction-plugin + @griffel/webpack-loader
to the unified @griffel/webpack-plugin. Remove unnecessary IS_RSPACK conditionals in the plugin
and loader now that Rspack supports NormalModule.getCompilationHooks and namedChunks.get().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace all references to @griffel/webpack-loader and
@griffel/webpack-extraction-plugin with the unified @griffel/webpack-plugin
in the ahead-of-time compilation and CSS extraction docs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove the package and all references from tsconfig paths, copilot
instructions, and website documentation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…-loader

These packages are superseded by the unified @griffel/webpack-plugin.
Updates all references in e2e tests, READMEs, tsconfig paths, and
copilot instructions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…el/transform

Eliminate the Babel dependency chain by having postcss-syntax consume
@griffel/transform directly. This required extending transform's output
with metadata (locations, comment directives) that the Babel
location-preset previously provided.

Transform changes:
- Add SourceLocation, CommentDirective, TransformMetadata, ModuleConfig types
- Accept ModuleConfig[] in modules option for flexible import matching
- Collect call expression locations, slot locations, reset locations,
  and comment directives when generateMetadata is enabled
- Return metadata in TransformResult

postcss-syntax changes:
- Remove @babel/core, @babel/helper-plugin-utils, @griffel/babel-preset deps
- Add @griffel/transform dependency
- Delete location-preset.ts (functionality now in transform)
- Rename .ts → .mts, switch to ESM source
- Switch from Jest to Vitest
- Fix type-check cwd (was pointing to babel-preset)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant