-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix some additional enableLegacyBabel5ModuleInterop cases (#807)
Follow-up from #804. * When exporting `{T as default}`, treat it as a type-only export that doesn't count as a real default export. * When explicitly doing `export default T`, treat it as a type-only export. * Treat `export enum` as a named export.
- Loading branch information
1 parent
631f64c
commit 58eac08
Showing
4 changed files
with
81 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import {ContextualKeyword} from "../parser/tokenizer/keywords"; | ||
import {TokenType as tt} from "../parser/tokenizer/types"; | ||
import type TokenProcessor from "../TokenProcessor"; | ||
|
||
/** | ||
* Starting at `export {`, look ahead and return `true` if this is an | ||
* `export {...} from` statement and `false` if this is a plain multi-export. | ||
*/ | ||
export default function isExportFrom(tokens: TokenProcessor): boolean { | ||
let closeBraceIndex = tokens.currentIndex(); | ||
while (!tokens.matches1AtIndex(closeBraceIndex, tt.braceR)) { | ||
closeBraceIndex++; | ||
} | ||
return ( | ||
tokens.matchesContextualAtIndex(closeBraceIndex + 1, ContextualKeyword._from) && | ||
tokens.matches1AtIndex(closeBraceIndex + 2, tt.string) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters