Skip to content

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

Merged
emmatown merged 5 commits into
mainfrom
refactor-module-specifier-visitors
May 17, 2023
Merged

Unify how module specifiers are visited by different declaration transformers#554
emmatown merged 5 commits into
mainfrom
refactor-module-specifier-visitors

Conversation

@Andarist

Copy link
Copy Markdown
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

changeset-bot Bot commented May 17, 2023

Copy link
Copy Markdown

🦋 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
Copy Markdown
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
Copy Markdown
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

codecov Bot commented May 17, 2023

Copy link
Copy Markdown

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
@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
@emmatown
emmatown restored the refactor-module-specifier-visitors branch November 22, 2025 01:17
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