Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix handling of comments with decorators before
export
(#15032)
Co-authored-by: liuxingbaoyu <30521560+liuxingbaoyu@users.noreply.github.com>
- Loading branch information
1 parent
b7d9c4a
commit 362f15b
Showing
32 changed files
with
1,236 additions
and
148 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
5 changes: 5 additions & 0 deletions
5
packages/babel-generator/test/fixtures/comments/decorators-after-export/input.js
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,5 @@ | ||
/* 1 */ export /* 2 */ @dec1 /* 3 */ @dec2 | ||
/* 4 */ class /* 5 */ C /* 6 */ { /* 7 */ } /* 8 */ | ||
|
||
/* A */ export /* B */ default /* C */ @dec1 /* D */ @dec2 | ||
/* E */ class /* F */ { /* G */ } /* H */ |
4 changes: 4 additions & 0 deletions
4
packages/babel-generator/test/fixtures/comments/decorators-after-export/options.json
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,4 @@ | ||
{ | ||
"plugins": [["decorators", { "decoratorsBeforeExport": false }]], | ||
"decoratorsBeforeExport": false | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/babel-generator/test/fixtures/comments/decorators-after-export/output.js
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,9 @@ | ||
/* 1 */export /* 2 */@dec1 | ||
/* 3 */@dec2 | ||
/* 4 */class /* 5 */C /* 6 */ {/* 7 */} /* 8 */ | ||
|
||
/* A */ | ||
export /* B */ | ||
default /* C */@dec1 | ||
/* D */@dec2 | ||
/* E */class /* F */{/* G */} /* H */ |
5 changes: 5 additions & 0 deletions
5
packages/babel-generator/test/fixtures/comments/decorators-before-export/input.js
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,5 @@ | ||
/* 1 */ @dec1 /* 2 */ @dec2 /* 3 */ | ||
export /* 4 */ class /* 5 */ C /* 6 */ { /* 7 */ } /* 8 */ | ||
|
||
/* A */ @dec1 /* B */ @dec2 /* C */ | ||
export /* D */ default /* E */ class /* F */ { /* G */ } /* H */ |
5 changes: 5 additions & 0 deletions
5
packages/babel-generator/test/fixtures/comments/decorators-before-export/options.json
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,5 @@ | ||
{ | ||
"BABEL_8_BREAKING": false, | ||
"plugins": [["decorators", { "decoratorsBeforeExport": true }]], | ||
"decoratorsBeforeExport": true | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/babel-generator/test/fixtures/comments/decorators-before-export/output.js
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,9 @@ | ||
/* 1 */@dec1 | ||
/* 2 */@dec2 | ||
/* 3 */export /* 4 */class /* 5 */C /* 6 */ {/* 7 */} /* 8 */ | ||
|
||
/* A */ | ||
@dec1 | ||
/* B */@dec2 | ||
/* C */export | ||
/* D */ default /* E */class /* F */{/* G */} /* H */ |
5 changes: 5 additions & 0 deletions
5
packages/babel-generator/test/fixtures/comments/decorators-legacy-before-export/input.js
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,5 @@ | ||
/* 1 */ @dec1 /* 2 */ @dec2 /* 3 */ | ||
export /* 4 */ class /* 5 */ C /* 6 */ { /* 7 */ } /* 8 */ | ||
|
||
/* A */ @dec1 /* B */ @dec2 /* C */ | ||
export /* D */ default /* E */ class /* F */ { /* G */ } /* H */ |
5 changes: 5 additions & 0 deletions
5
packages/babel-generator/test/fixtures/comments/decorators-legacy-before-export/options.json
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,5 @@ | ||
{ | ||
"BABEL_8_BREAKING": false, | ||
"plugins": ["decorators-legacy"], | ||
"decoratorsBeforeExport": true | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/babel-generator/test/fixtures/comments/decorators-legacy-before-export/output.js
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,9 @@ | ||
/* 1 */@dec1 | ||
/* 2 */@dec2 | ||
/* 3 */export /* 4 */class /* 5 */C /* 6 */ {/* 7 */} /* 8 */ | ||
|
||
/* A */ | ||
@dec1 | ||
/* B */@dec2 | ||
/* C */export | ||
/* D */ default /* E */class /* F */{/* G */} /* H */ |
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
Oops, something went wrong.