这是indexloc提供的服务,不要输入任何密码
Skip to content

feat(boundaries): support tsconfig path aliases #10002

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 26, 2025

Conversation

NicholasLYang
Copy link
Contributor

@NicholasLYang NicholasLYang commented Feb 19, 2025

Description

Support tsconfig path aliases such as:

{
  "compilerOptions": {
    "paths": {
      "@/*": ["./*"]
    }
  }
}

We check if we can resolve the import as a path alias and if so, check the resolved path

Can be reviewed commit by commit

Testing Instructions

Turns out we already had a test for this in turborepo-tests/integration/fixtures/boundaries/apps/my-app/types.ts. Added another import and updated snapshot

Copy link

vercel bot commented Feb 19, 2025

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

Name Status Preview Comments Updated (UTC)
examples-basic-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 26, 2025 6:26pm
examples-designsystem-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 26, 2025 6:26pm
examples-gatsby-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 26, 2025 6:26pm
examples-kitchensink-blog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 26, 2025 6:26pm
examples-native-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 26, 2025 6:26pm
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 26, 2025 6:26pm
examples-svelte-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 26, 2025 6:26pm
examples-tailwind-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 26, 2025 6:26pm
examples-vite-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 26, 2025 6:26pm

Comment on lines 91 to 92
pub type PackageKey = String;
pub type PackageVersion = String;
Copy link
Member

Choose a reason for hiding this comment

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

I don't like these type aliases, can we keep them contained to this crate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't want to have the type be BTreeMap<String, String>, since that's sort of opaque. Should I just copy them over?

if let Some(config) = self.configs.get(dir) {
return Some(config.clone());
}
if let Ok(config) = self.resolver.resolve_tsconfig(dir) {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add debug log when we fail to resolve a ts config?

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