Skip to content
This repository was archived by the owner on Aug 4, 2021. It is now read-only.

Commit a67275d

Browse files
committed
Handle export abstract class
1 parent de0abac commit a67275d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## master
44
* Do not duplicate TypeScript's helpers ([#24](https://github.com/rollup/rollup-plugin-typescript/issues/24)
5+
* Handle `export abstract class` ([#23](https://github.com/rollup/rollup-plugin-typescript/issues/23)
56

67
### 0.4.1
78
* Does not attempt resolve or transform `.d.ts` files ([#22](https://github.com/rollup/rollup-plugin-typescript/pull/22))

src/fixExportClass.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ export default function fix ( code: string, id: string ): string {
3636
// Erase comments, strings etc. to avoid erroneous matches for the Regex.
3737
const cleanCode = tippex.erase( code );
3838

39-
const re = /export\s+(default\s+)?class(?:\s+(\w+))?/g;
39+
const re = /export\s+(default\s+)?((?:abstract\s+)?class)(?:\s+(\w+))?/g;
4040
let match;
4141

4242
while ( match = re.exec( cleanCode ) ) {
4343
// To keep source maps intact, replace non-whitespace characters with spaces.
44-
code = erase( code, match.index, match[ 0 ].indexOf( 'class' ) );
44+
code = erase( code, match.index, match[ 0 ].indexOf( match[ 2 ] ) );
4545

46-
let name = match[ 2 ];
46+
let name = match[ 3 ];
4747

4848
if ( match[ 1 ] ) { // it is a default export
4949

0 commit comments

Comments
 (0)