Skip to content
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

Unify how module specifiers are visited by different declaration transformers #554

Merged
merged 5 commits into from
May 17, 2023

Conversation

Andarist
Copy link
Member

Just a refactor PR, in preparation for the logic that will fix the issue with explicit .ts extensions (the one that we've discussed)

@Andarist Andarist requested a review from emmatown May 17, 2023 17:49
@changeset-bot
Copy link

changeset-bot bot commented May 17, 2023

🦋 Changeset detected

Latest commit: f00319c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@preconstruct/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

node: TNode
): TNode => {
const literal = getModuleSpecifier(node, typescript);
if (literal) return handleImport(node, literal, context);
Copy link
Member Author

Choose a reason for hiding this comment

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

TODO: recheck this, I have a feeling that this had a bug (that is preserved by this PR) that skips over nested imports in nodes like this:

type Test = import('#foo').Foo<import('#bar').Bar>

Copy link
Member

Choose a reason for hiding this comment

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

Hmmm, yeah, makes sense, I didn't realise that the qualifier and type arguments are children of the import type node. I expected it to be like how most ASTs represent property access, call expressions, etc.

@codecov
Copy link

codecov bot commented May 17, 2023

Codecov Report

Patch coverage: 93.75% and project coverage change: +0.27 🎉

Comparison is base (6896664) 91.89% compared to head (3756352) 92.16%.

❗ Current head 3756352 differs from pull request most recent head f00319c. Consider uploading reports for the commit f00319c to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #554      +/-   ##
==========================================
+ Coverage   91.89%   92.16%   +0.27%     
==========================================
  Files          41       41              
  Lines        1998     1979      -19     
  Branches      586      584       -2     
==========================================
- Hits         1836     1824      -12     
+ Misses        152      145       -7     
  Partials       10       10              
Impacted Files Coverage Δ
...eclarations/get-used-declaration-with-replacing.ts 92.85% <50.00%> (+7.67%) ⬆️
...c/rollup-plugins/typescript-declarations/common.ts 87.09% <100.00%> (+2.88%) ⬆️
...s/typescript-declarations/get-used-declarations.ts 100.00% <100.00%> (+3.84%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@emmatown emmatown force-pushed the refactor-module-specifier-visitors branch from 917693e to f73ea9e Compare May 17, 2023 23:14
@emmatown emmatown merged commit 1147fee into main May 17, 2023
8 checks passed
@emmatown emmatown deleted the refactor-module-specifier-visitors branch May 17, 2023 23:53
@github-actions github-actions bot mentioned this pull request May 17, 2023
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.

None yet

2 participants