Skip to content

Commit a2d3991

Browse files
committed
Merge branch 'export-all-declaration-exported'
2 parents 99f11bd + e8a4c6a commit a2d3991

6 files changed

+20
-6
lines changed

escodegen.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,14 +1277,23 @@
12771277

12781278
ExportAllDeclaration: function (stmt, flags) {
12791279
// export * FromClause ;
1280-
return [
1280+
var result = [
12811281
'export' + space,
1282-
'*' + space,
1282+
'*' + space
1283+
];
1284+
1285+
if (stmt.exported) {
1286+
result.push('as ' + stmt.exported.name + ' ');
1287+
}
1288+
1289+
result = join(result, [
12831290
'from' + space,
12841291
// ModuleSpecifier
12851292
this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
12861293
this.semicolon(flags)
1287-
];
1294+
]);
1295+
1296+
return result;
12881297
},
12891298

12901299
ExpressionStatement: function (stmt, flags) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"source-map": "~0.6.1"
4040
},
4141
"devDependencies": {
42-
"acorn": "^7.3.1",
42+
"acorn": "^8.0.1",
4343
"bluebird": "^3.4.7",
4444
"bower-registry-client": "^1.0.0",
4545
"chai": "^4.2.0",

test/compare-acorn-es2020.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ function test(code, expected) {
3939
options = {
4040
ranges: false,
4141
locations: false,
42-
ecmaVersion: 11
42+
ecmaVersion: 11,
43+
sourceType: 'module'
4344
};
4445

4546
tree = acorn.parse(code, options);
@@ -58,7 +59,8 @@ function testMin(code, expected) {
5859
options = {
5960
ranges: false,
6061
locations: false,
61-
ecmaVersion: 11
62+
ecmaVersion: 11,
63+
sourceType: 'module'
6264
};
6365

6466
tree = acorn.parse(code, options);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * as name from 'OK';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export*as name from'OK'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * as name from 'OK';

0 commit comments

Comments
 (0)