Skip to content

Commit 333c3aa

Browse files
cheedevongovett
authored andcommitted
Move JSAsset's options gathering code into separate method (#241)
* Move js asset's options code into separate method * rename getOptions -> getParserOptions
1 parent bd45866 commit 333c3aa

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/assets/JSAsset.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class JSAsset extends Asset {
3434
);
3535
}
3636

37-
async parse(code) {
37+
async getParserOptions() {
3838
// Babylon options. We enable a few plugins by default.
3939
const options = {
4040
filename: this.name,
@@ -56,6 +56,12 @@ class JSAsset extends Asset {
5656
options.plugins.push(...file.parserOpts.plugins);
5757
}
5858

59+
return options;
60+
}
61+
62+
async parse(code) {
63+
const options = await this.getParserOptions();
64+
5965
return babylon.parse(code, options);
6066
}
6167

0 commit comments

Comments
 (0)