microsoft/rushstack

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

octogonz opened this issue · 4 comments

Summary

Issue #1029 and PR #1796 implemented support for this syntax:

import * as controls from './controls';
export { controls }

But there is a shorthand syntax which was NOT solved by that PR:

export * as controls from './controls';

This issue tracks the bit of work required to handle the shorthand syntax.

Standard questions

Question Answer
@microsoft/api-extractor version? 7.17.0
Operating system? Windows
TypeScript compiler version? 4.3.x

CC @Jack-Works @resynth1943 @clar-cmp @jasonswearingen

ran into this issue. Google brought me to the original thread: #1029. And now I'm here.

So is this still not supported? My error looks like:

--[ FAILURE: @azure/digital-twins-parser-generator ]--------[ 10.30 seconds ]--

Error: Internal Error: Unable to parse module specifier

I suspect it's because in my index.ts file I have:

export * as CodeGenerator from './codeGenerator';

Also, just a note: that's a terribly unhelpful error. Really no information to work off except a desperate Google attempt.

@octogonz, @iclanton wanted to check-in on this issue. In our package, we want to export the entirety of a file path which are individual constants representing "tokens". This allows folks using bundlers to tree shake out what isn't included or used. With the work around here, that ability isn't available and the error in API extractor means we either need to change our export or we need to export a growing number of individual named constants which are dynamically created...creating a maintenance nightmare.

Is there any way this can be prioritized in a coming workstream? Curious about the direction I should take depending on the timeline of getting this working.

🎉 @nirshar has fixed this in PR #4698