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

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

Open
octogonz opened this issue Jun 30, 2021 · 3 comments · May be fixed by #4698
Open

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

octogonz opened this issue Jun 30, 2021 · 3 comments · May be fixed by #4698
Labels
enhancement The issue is asking for a new feature or design change

Comments

@octogonz
Copy link
Collaborator

octogonz commented Jun 30, 2021

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

@octogonz octogonz added the enhancement The issue is asking for a new feature or design change label Jun 30, 2021
ling1726 added a commit to ling1726/fluentui that referenced this issue Jul 11, 2021
This PR implements what was proposed in microsoft#18587 and exports all named
`key` values specified by w3c.

Also adds legacy keycode exports as a deep import. Happy to take any
suggestions to avoid this. Originallly this was the plan:

```ts
export * as keyCodes from './keyCodes'
```

but unfortunately API extractor does not support this syntax
microsoft/rushstack#2780
ling1726 added a commit to microsoft/fluentui that referenced this issue Jul 15, 2021
* feat(keyboard-keys): Export keys and legacy keyCodes

This PR implements what was proposed in #18587 and exports all named
`key` values specified by w3c.

Also adds legacy keycode exports as a deep import. Happy to take any
suggestions to avoid this. Originallly this was the plan:

```ts
export * as keyCodes from './keyCodes'
```

but unfortunately API extractor does not support this syntax
microsoft/rushstack#2780

* remove deep export

* update fixture
PeterDraex pushed a commit to PeterDraex/fluentui that referenced this issue Aug 6, 2021
* feat(keyboard-keys): Export keys and legacy keyCodes

This PR implements what was proposed in microsoft#18587 and exports all named
`key` values specified by w3c.

Also adds legacy keycode exports as a deep import. Happy to take any
suggestions to avoid this. Originallly this was the plan:

```ts
export * as keyCodes from './keyCodes'
```

but unfortunately API extractor does not support this syntax
microsoft/rushstack#2780

* remove deep export

* update fixture
@YoDaMa
Copy link

YoDaMa commented Nov 30, 2021

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';

@YoDaMa
Copy link

YoDaMa commented Nov 30, 2021

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

@chrisdholt
Copy link
Member

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is asking for a new feature or design change
Projects
Status: AE/AD
Development

Successfully merging a pull request may close this issue.

3 participants