Skip to content

fix(vite-plugin-angular): discover files from tsconfig path directories and wildcards#2291

Draft
benpsnyder wants to merge 26 commits intoanalogjs:alphafrom
benpsnyder:docs/debugging-techniques
Draft

fix(vite-plugin-angular): discover files from tsconfig path directories and wildcards#2291
benpsnyder wants to merge 26 commits intoanalogjs:alphafrom
benpsnyder:docs/debugging-techniques

Conversation

@benpsnyder
Copy link
Copy Markdown
Contributor

@benpsnyder benpsnyder commented Apr 15, 2026

PR Checklist

Closes none

Affected scope

  • Primary scope: vite-plugin-angular
  • Secondary scopes: none

Recommended merge strategy for maintainer [optional]

  • Squash merge
  • Rebase merge
  • Other

Commit preservation note [optional]

What is the new behavior?

  • Expands compilation root discovery so tsconfig path entries that point at directories or wildcard globs resolve to concrete source files instead of raw directory paths.
  • Extends angular-vite-plugin-live-reload coverage for directory-based and wildcard-based path mappings.
  • Tightens the debugging guides with clearer Angular debug scopes, link:-based local package wiring, and consumer validation steps for debugging local or GitHub-based Analog builds.

Test plan

  • nx format:check
  • pnpm build
  • pnpm nx test vite-plugin-angular
  • Manual verification

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

  • This PR targets the alpha branch.

…o plugins by clarifying HMR behavior and config handling
…d comments do not interfere with directive detection
…SS comment handling for directive detection
… for Tailwind reference detection and improving test case timeout
…mentHostWithResources, enhancing error management in CSS processing
…ancing experimental options and test coverage
…and test coverage

- Enhanced documentation for the selectorless compilation option in the Angular plugin.
- Added tests to ensure top-level selectorless configuration takes precedence over legacy settings.
- Updated logic to maintain consistency between top-level and legacy experimental configurations.
- Improved handling of selectorless support detection in the live reload plugin.
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 15, 2026

Deploy Preview for analog-blog ready!

Name Link
🔨 Latest commit 7859392
🔍 Latest deploy log https://app.netlify.com/projects/analog-blog/deploys/69deff7ba1f5810008a54584
😎 Deploy Preview https://deploy-preview-2291--analog-blog.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 15, 2026

Deploy Preview for analog-app ready!

Name Link
🔨 Latest commit 7859392
🔍 Latest deploy log https://app.netlify.com/projects/analog-app/deploys/69deff7b7c2c39000875513f
😎 Deploy Preview https://deploy-preview-2291--analog-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the scope:vite-plugin-angular Changes in @analogjs/vite-plugin-angular label Apr 15, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 15, 2026

📝 Walkthrough

Walkthrough

This pull request extends the Vite Angular plugin with enhanced debug telemetry for emit operations and improves TypeScript configuration handling for project references. The changes introduce tsconfig wrapping logic that computes expanded root sets from direct roots, compiler option paths, and recursive references, along with normalization of Angular virtual file request IDs (specifically /@fs/ paths) in emitter lookups to support cross-platform resolution. Two test cases validate tsconfig wrapper generation with project references and Windows-style path handling. The selectorless feature assignment was removed from both NgtscProgram and Compilation API code paths, and stylesheet preprocessing iteration was refactored from Map.forEach to a for...of loop.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Key observations

  • Selectorless enablement removal: The deletion of _enableSelectorless assignments in both the NgtscProgram and Compilation API branches warrants verification—confirm this is intentional deprecation and not an unintended loss of functionality.

  • Tsconfig wrapping logic: The new root expansion mechanism combining rootNames, compilerOptions.paths targets, and recursive tsconfig.references introduces non-trivial graph traversal; verify the glob expansion for paths targets and the cache invalidation strategy for tsconfigGraphRootCache are correct.

  • Emitter lookup normalization: The introduction of normalizeEmitterLookupId for /@fs/ virtual paths is critical for Windows cross-platform support; confirm the normalization logic aligns with Vite's internal path handling conventions.

  • Test coverage: New test cases appropriately cover tsconfig wrapper generation with project references and Windows-style transform IDs, validating the primary new code paths.

  • Monorepo consistency: Changes are isolated to the vite-plugin-angular package and introduce no public API modifications—existing external consumers are unaffected.

🚥 Pre-merge checks | ✅ 1 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive No description provided; unable to assess whether intent aligns with the substantial implementation changes across multiple core files. Add a description explaining the debug telemetry implementation, tsconfig wrapping logic, and test additions to clarify intent and ensure proper change documentation.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title uses Conventional Commit format with vite-plugin-angular scope, which is a supported package. It clearly describes the main change: discovering files from tsconfig path directories and wildcards.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

@benpsnyder benpsnyder marked this pull request as draft April 15, 2026 02:39
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/vite-plugin-angular/src/lib/angular-vite-plugin-live-reload.spec.ts (1)

576-613: Windows /@fs/ resolution test validates the normalization fix.

The test confirms that Angular emit output is correctly resolved when Vite transforms pass /@fs/C:/... style ids, which occurs during SSR or cross-environment builds on Windows.

Consider adding a follow-up test (or inline assertion) for lowercase drive letters (/@fs/c:/...) to document the case-insensitivity guarantee, though the regex [A-Za-z] does handle it.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/vite-plugin-angular/src/lib/angular-vite-plugin-live-reload.spec.ts`
around lines 576 - 613, Add an extra assertion to the existing test "resolves
Angular emit output for Windows /@fs/ transform ids" to also exercise a
lowercase drive-letter path: duplicate or reuse windowsComponentId but with a
lowercase drive letter (e.g., `/@fs/c:/project/src/app/demo.component.ts`) and
call plugin.transform.handler the same way (using setupLiveReloadPlugin
emitAffectedFiles entry and the transform handler invocation) then assert the
transformed result still equals { code: emittedCode, map: null } to document
case-insensitivity of the resolution.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@packages/vite-plugin-angular/src/lib/angular-vite-plugin-live-reload.spec.ts`:
- Around line 576-613: Add an extra assertion to the existing test "resolves
Angular emit output for Windows /@fs/ transform ids" to also exercise a
lowercase drive-letter path: duplicate or reuse windowsComponentId but with a
lowercase drive letter (e.g., `/@fs/c:/project/src/app/demo.component.ts`) and
call plugin.transform.handler the same way (using setupLiveReloadPlugin
emitAffectedFiles entry and the transform handler invocation) then assert the
transformed result still equals { code: emittedCode, map: null } to document
case-insensitivity of the resolution.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 180f2114-cd7d-4789-8626-51245429c5d3

📥 Commits

Reviewing files that changed from the base of the PR and between 45799f9 and 8241741.

⛔ Files ignored due to path filters (1)
  • docs/debugging.md is excluded by none and included by none
📒 Files selected for processing (3)
  • packages/vite-plugin-angular/src/lib/angular-vite-plugin-live-reload.spec.ts
  • packages/vite-plugin-angular/src/lib/angular-vite-plugin.ts
  • packages/vite-plugin-angular/src/lib/utils/debug.ts

@github-actions github-actions Bot added the scope:docs Documentation changes label Apr 15, 2026
…directory and wildcard support

- Added new directories and files to the live reload test setup for improved coverage.
- Updated path mappings to include newly created directories and wildcard patterns.
- Enhanced assertions to ensure proper exclusion of certain paths in generated configurations.
@benpsnyder benpsnyder changed the title Docs/debugging techniques fix(vite-plugin-angular): discover files from tsconfig path directories and wildcards Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope:docs Documentation changes scope:vite-plugin-angular Changes in @analogjs/vite-plugin-angular

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant