Skip to content

Commit 75f940c

Browse files
author
substack
committed
add opts.ecmaVersion
1 parent ce34e97 commit 75f940c

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function createStream (opts) {
8282
let ast
8383
const string = transformAst(source, {
8484
locations: true,
85-
ecmaVersion: 10,
85+
ecmaVersion: opts.ecmaVersion !== undefined ? opts.ecmaVersion : 10,
8686
inputFilename: row.file
8787
}, (node) => {
8888
if (node.type === 'Program') ast = node

readme.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ Handler called when a module cannot be tree-shaked for some reason.
9595
Handler called when tree-shaking is skipped entirely, usually because there is a dynamic `require` call in the source.
9696
`reasons` is an array of reasons for skipping tree-shaking.
9797

98+
### `ecmaVersion`
99+
100+
Parse with this ecmaVersion as interpreted by acorn. (default: 10)
101+
98102
## License
99103

100104
[MIT](./LICENSE)

0 commit comments

Comments
 (0)