Skip to content

Commit d91e7ec

Browse files
committed
getCommentOptions renamed to getCommentOptionsStrict
and wrapped back in getCommentOptions to avoid possible breaking changes
1 parent 1969485 commit d91e7ec

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/Parser.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1994,7 +1994,7 @@ class Parser extends Tapable {
19941994
);
19951995
}
19961996

1997-
getCommentOptions(range) {
1997+
getCommentOptionsStrict(range) {
19981998
const comments = this.getComments(range);
19991999
if (comments.length === 0) return null;
20002000
const options = comments.map(comment => {
@@ -2015,6 +2015,14 @@ class Parser extends Tapable {
20152015
return options.reduce((o, i) => Object.assign(o, i), {});
20162016
}
20172017

2018+
getCommentOptions(range) {
2019+
try {
2020+
return this.getCommentOptionsStrict(range);
2021+
} catch (e) {
2022+
return {};
2023+
}
2024+
}
2025+
20182026
getNameForExpression(expression) {
20192027
let expr = expression;
20202028
const exprName = [];

lib/dependencies/ImportParserPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class ImportParserPlugin {
3434
const groupOptions = {};
3535

3636
try {
37-
importOptions = parser.getCommentOptions(expr.range);
37+
importOptions = parser.getCommentOptionsStrict(expr.range);
3838
} catch (e) {
3939
parser.state.module.warnings.push(
4040
new ImportOptionsCompileWarning(

0 commit comments

Comments
 (0)