Skip to content

Conversation

@tianyingchun
Copy link
Contributor

@tianyingchun tianyingchun commented Aug 3, 2025

Closes: #3727

feat: Add support for custom TypeScript transformers in Vendure dashboard plugin

This update introduces a new option for custom TypeScript transformers in the Vite plugin, allowing users to customize the TypeScript compilation process. The changes include updates to the CompilerOptions interface and the compilation logic to merge user-defined transformers with default ones.

Summary by CodeRabbit

  • New Features
    • Added support for custom TypeScript transformers during the dashboard build process. Users can now specify custom transformers in plugin options for enhanced compilation flexibility.

@vercel
Copy link

vercel bot commented Aug 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview Aug 3, 2025 2:27pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 3, 2025

Walkthrough

The changes add support for passing custom TypeScript transformers through the Vendure dashboard Vite plugin and its underlying compiler utility. New optional customTransformers properties are introduced to relevant interfaces, and logic is added to merge user-provided transformers with defaults, ensuring both are applied during TypeScript compilation.

Changes

Cohort / File(s) Change Summary
Compiler: Custom Transformer Support
packages/dashboard/vite/utils/compiler.ts
Extended CompilerOptions with customTransformers; updated compile and compileTypeScript to accept and merge custom transformers with defaults.
Vite Plugin: Transformer Option Propagation
packages/dashboard/vite/vite-plugin-vendure-dashboard.ts
Added customTransformers to plugin options; passed through to config loader for use during compilation.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant VitePlugin
    participant Compiler

    User->>VitePlugin: vendureDashboardPlugin({ customTransformers })
    VitePlugin->>Compiler: compile({ ..., customTransformers })
    Compiler->>Compiler: Merge customTransformers with defaults
    Compiler->>Compiler: compileTypeScript(..., mergedCustomTransformers)
    Compiler->>VitePlugin: Compilation result
    VitePlugin->>User: Plugin setup complete
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Assessment against linked issues

Objective Addressed Explanation
Support ESM import.meta.url in dashboard Vite plugin compilation (#3727) The changes add custom transformer support, which may enable ESM handling, but do not directly implement ESM or import.meta.url support.

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Addition of custom TypeScript transformer support (all affected files) The linked issue requests ESM/import.meta.url support, not custom transformer extensibility. While transformers could help, this is not a direct solution to the objective.

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 82f0512 and 83aea40.

📒 Files selected for processing (2)
  • packages/dashboard/vite/utils/compiler.ts (6 hunks)
  • packages/dashboard/vite/vite-plugin-vendure-dashboard.ts (3 hunks)
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: applies to packages/dashboard/src/lib/components/**/*.{tsx,jsx} : use shadcn ui and tailwind css for...
Learnt from: CR
PR: vendure-ecommerce/vendure#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-23T07:05:04.344Z
Learning: Applies to packages/dashboard/src/lib/components/**/*.{tsx,jsx} : Use Shadcn UI and Tailwind CSS for UI components.

Applied to files:

  • packages/dashboard/vite/vite-plugin-vendure-dashboard.ts
📚 Learning: applies to packages/dashboard/src/**/*.{tsx,jsx} : use react for all ui components in the dashboard ...
Learnt from: CR
PR: vendure-ecommerce/vendure#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-23T07:05:04.344Z
Learning: Applies to packages/dashboard/src/**/*.{tsx,jsx} : Use React for all UI components in the dashboard package.

Applied to files:

  • packages/dashboard/vite/vite-plugin-vendure-dashboard.ts
📚 Learning: applies to packages/dashboard/src/app/routes/**/*.tsx : use tanstack router for all routing and navi...
Learnt from: CR
PR: vendure-ecommerce/vendure#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-23T07:05:04.344Z
Learning: Applies to packages/dashboard/src/app/routes/**/*.tsx : Use TanStack Router for all routing and navigation in the dashboard app.

Applied to files:

  • packages/dashboard/vite/vite-plugin-vendure-dashboard.ts
📚 Learning: applies to packages/dashboard/src/**/*.{ts,tsx} : use tanstack query (usequery or usemutation) for d...
Learnt from: CR
PR: vendure-ecommerce/vendure#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-23T07:05:04.344Z
Learning: Applies to packages/dashboard/src/**/*.{ts,tsx} : Use TanStack Query (useQuery or useMutation) for data fetching; do not use Apollo Client.

Applied to files:

  • packages/dashboard/vite/vite-plugin-vendure-dashboard.ts
🧬 Code Graph Analysis (1)
packages/dashboard/vite/utils/compiler.ts (2)
packages/dashboard/vite/utils/logger.ts (1)
  • noopLogger (30-43)
packages/dashboard/vite/types.ts (2)
  • Logger (1-6)
  • PathAdapter (33-44)
🔇 Additional comments (9)
packages/dashboard/vite/vite-plugin-vendure-dashboard.ts (3)

5-5: LGTM!

The TypeScript import is necessary for the ts.CustomTransformers type and is correctly placed with other imports.


90-95: LGTM!

The interface property addition is well-documented, follows existing patterns, and maintains backward compatibility with the optional typing.


139-139: LGTM!

The option forwarding follows the established pattern and correctly passes the custom transformers to the compilation process.

packages/dashboard/vite/utils/compiler.ts (6)

31-31: LGTM!

The interface extension maintains backward compatibility with optional typing and uses the correct TypeScript type.


45-52: LGTM!

The destructuring update properly includes the new customTransformers option while maintaining the existing pattern.


65-65: LGTM!

The option forwarding to compileTypeScript is consistent with the function signature update.


146-146: LGTM!

The function signature updates correctly include the new customTransformers parameter with appropriate optional typing.

Also applies to: 152-152


203-222: LGTM!

The transformer merging logic is well-implemented:

  • Safely handles undefined properties with fallback to empty arrays
  • Preserves both user-provided and default transformers
  • Uses clear naming for default transformers
  • Ensures proper execution order by concatenating arrays

225-225: LGTM!

The emit call correctly uses the merged transformers, ensuring both user-provided and default transformers are applied during TypeScript compilation.


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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Aug 3, 2025

@RubenDarioGuerreroNeira
Copy link

👋 Hi team,

I noticed that PR #3732 introduces support for custom TypeScript transformers, which is a great feature — thanks for the effort!

However, as the original issue #3727 specifically refers to supporting import.meta.url and ESM in the dashboard compilation, it seems this PR may not directly address that need.

If the team agrees, I’d be happy to explore a dedicated solution to enable proper handling of import.meta.url in the Vite-based dashboard build, possibly using a transformer or alternative approach.

Let me know if that would be helpful — I’d love to contribute further. 🙌

Best regards,
Rubén Darío Guerrero Neira

@tianyingchun
Copy link
Contributor Author

It is very necessary to support import.meta

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.

Should support ESM import.meta.url

2 participants