Skip to content

[api-extractor] add basic support for import * as module from './local-module' - #1796

Merged
Pete Gonzalez (octogonz) merged 39 commits into
microsoft:masterfrom
grafana-cold-storage:export-star-as-support
Jun 30, 2021
Merged

[api-extractor] add basic support for import * as module from './local-module'#1796
Pete Gonzalez (octogonz) merged 39 commits into
microsoft:masterfrom
grafana-cold-storage:export-star-as-support

Conversation

@mckn

Copy link
Copy Markdown
Contributor

I have basically taken the PR created by adventure-yunfei (@adventure-yunfei) here PR and cleaned up the code a bit. Tested it on the Grafana project which is a really big project and then opened this PR.

Thanks and great work by adventure-yunfei (@adventure-yunfei)!

Please let me know what you want to be adressed to get it merged. I think there are several people that wants to help out to get this PR merged.

Fixes: #1029

@msftclas

Microsoft Contribution License Agreements (msftclas) commented Mar 25, 2020

Copy link
Copy Markdown

CLA assistant check
All CLA requirements met.

@mckn Marcus Andersson (mckn) changed the title So this PR adds basic support for import * as module from './local-module' [api-extractor] add basic support for import * as module from './local-module' Mar 25, 2020
@mckn

Marcus Andersson (mckn) commented Mar 25, 2020

Copy link
Copy Markdown
Contributor Author

I can run the tests and see that there are two failing tests but not sure how to get some more details about the failure.

Saw that it was a build failure and got more details by running the regular gulp script in the api-extractor.

@stevengum Steven Gum (stevengum) left a comment

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.

Just had two style/practice comments.

I ran into this issue today and am looking forward to these changes, thanks Marcus Andersson (@mckn)!

Comment thread apps/api-extractor/src/analyzer/ExportAnalyzer.ts Outdated
Comment thread apps/api-extractor/src/generators/ApiReportGenerator.ts Outdated
@stevengum

Copy link
Copy Markdown
Member

Pete Gonzalez (@octogonz) sorry for the out-of-the-blue PR review, just excited to use api-extractor on my team's projects 😄

Marcus Andersson (@mckn), do you have tests that can be added to the PR?

@mckn

Copy link
Copy Markdown
Contributor Author

Pete Gonzalez (@octogonz) sorry for the out-of-the-blue PR review, just excited to use api-extractor on my team's projects 😄

Marcus Andersson (@mckn), do you have tests that can be added to the PR?

Steven Gum (@stevengum) awesome feedback! Thanks for doing the review. Have made the updates and pushed the changes.

I have not added any tests but please give me some directions on how I can write some tests and I am happy to add that as well.

@stevengum

Copy link
Copy Markdown
Member

Marcus Andersson (@mckn) sorry for the delay, I'm not a regular contributor to this project so I don't know how to write/run tests.

I've pulled the grafana branch and was going to run the tests locally, it looks like they've already passed as part of the setup of the repo.

I don't have insight into their CI pipelines either, could the rushstack CI Build be stuck in pending due to the merge conflict?

@mckn

Copy link
Copy Markdown
Contributor Author

Steven Gum (@stevengum) I have added one some simple tests to verify the import * as .. scenario. Not sure if it is the merge conflict that is causing errors. But I will sync with upstream asap so we can get this mergeable.

@mckn

Copy link
Copy Markdown
Contributor Author

Pete Gonzalez (@octogonz) would be awesome if you could have a look at this PR 🙏

@rbuckton

Ron Buckton (rbuckton) commented Apr 4, 2020

Copy link
Copy Markdown

I tried this on one of my projects and the links in the TOC for namespaces are broken (as in, clicking on them does nothing).

This is when using the YamlDocumenter API via new YamlDocumenter(apiModel, /*newDocfxNamespaces*/ true);.

@rbuckton

Copy link
Copy Markdown

Disregard that comment. After a clean build of my documentation it seems to be working fine.

@rbuckton

Copy link
Copy Markdown

I will add that this does fix the underlying issue for me. I've been using a local patch to work around this for my documentation builds and that patch is no longer necessary.

@santam85

Copy link
Copy Markdown

Happy to see there's a PR already in this advanced stage for this. This is a must to support api-extractor for Angular projects as well, as there's limited control on the typings output from the CLI

@lifeiscontent

Copy link
Copy Markdown

Pete Gonzalez (@octogonz) any updates here?

@octogonz

Copy link
Copy Markdown
Collaborator

Pete Gonzalez (@octogonz) any updates here?

To be clear, what's blocking this PR wasn't the code review, but rather some nontrivial work required to complete the implementation. (Some of which is identified by TODO in the author's comments.) I'm looking at it again this weekend to see if I can push it along.

@octogonz

Copy link
Copy Markdown
Collaborator

Today I got the .api.md file straightened out. The last step will be the .api.json file.

@octogonz

Copy link
Copy Markdown
Collaborator

🚀 This is finally ready to go!

I tested it by building a large production monorepo with lots of projects that use API Extractor.

@octogonz
Pete Gonzalez (octogonz) merged commit 3ade23f into microsoft:master Jun 30, 2021
@octogonz
Pete Gonzalez (octogonz) deleted the export-star-as-support branch June 30, 2021 06:12
@octogonz
Pete Gonzalez (octogonz) restored the export-star-as-support branch June 30, 2021 06:12
@octogonz

Copy link
Copy Markdown
Collaborator

Released with API Extractor 7.17.0

Qjuh pushed a commit to discordjs/rushstack that referenced this pull request Nov 7, 2023
microsoft#1796 (comment)

# Conflicts:
#	apps/api-extractor/src/analyzer/AstSymbolTable.ts
#	apps/api-extractor/src/analyzer/ExportAnalyzer.ts
#	apps/api-extractor/src/collector/Collector.ts
#	apps/api-extractor/src/generators/ApiModelGenerator.ts
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.

[api-extractor] Support "import * as __ from __" for local paths

10 participants