File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -58,11 +58,24 @@ export default function unassert(options = {}) {
58
58
if ( ! filter ( id ) ) { return null ; }
59
59
60
60
return new Promise ( ( resolve ) => {
61
- const ast = acorn . parse ( code , { sourceType : 'module' , locations : true } ) ;
61
+ const comments = [ ] ;
62
+ const tokens = [ ] ;
63
+
64
+ const ast = acorn . parse ( code , {
65
+ sourceType : 'module' ,
66
+ ecmaVersion : 'latest' ,
67
+ locations : true ,
68
+ ranges : true ,
69
+ onComment : comments ,
70
+ onToken : tokens ,
71
+ } ) ;
72
+
73
+ escodegen . attachComments ( ast , comments , tokens ) ;
62
74
const unassertedAst = escodegen . generate ( unassertjs ( ast ) , {
63
75
sourceMap : id ,
64
76
sourceContent : code ,
65
- sourceMapWithCode : true
77
+ sourceMapWithCode : true ,
78
+ comment : true ,
66
79
} ) ;
67
80
68
81
const inMap = options . sourcemap && handleIncomingSourceMap ( code ) ;
You can’t perform that action at this time.
0 commit comments