mirror of https://github.com/webpack/webpack.git
				
				
				
			getCommentOptions renamed to getCommentOptionsStrict
and wrapped back in getCommentOptions to avoid possible breaking changes
This commit is contained in:
		
							parent
							
								
									1969485f05
								
							
						
					
					
						commit
						d91e7ecafc
					
				|  | @ -1994,7 +1994,7 @@ class Parser extends Tapable { | ||||||
| 		); | 		); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	getCommentOptions(range) { | 	getCommentOptionsStrict(range) { | ||||||
| 		const comments = this.getComments(range); | 		const comments = this.getComments(range); | ||||||
| 		if (comments.length === 0) return null; | 		if (comments.length === 0) return null; | ||||||
| 		const options = comments.map(comment => { | 		const options = comments.map(comment => { | ||||||
|  | @ -2015,6 +2015,14 @@ class Parser extends Tapable { | ||||||
| 		return options.reduce((o, i) => Object.assign(o, i), {}); | 		return options.reduce((o, i) => Object.assign(o, i), {}); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	getCommentOptions(range) { | ||||||
|  | 		try { | ||||||
|  | 			return this.getCommentOptionsStrict(range); | ||||||
|  | 		} catch (e) { | ||||||
|  | 			return {}; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	getNameForExpression(expression) { | 	getNameForExpression(expression) { | ||||||
| 		let expr = expression; | 		let expr = expression; | ||||||
| 		const exprName = []; | 		const exprName = []; | ||||||
|  |  | ||||||
|  | @ -34,7 +34,7 @@ class ImportParserPlugin { | ||||||
| 			const groupOptions = {}; | 			const groupOptions = {}; | ||||||
| 
 | 
 | ||||||
| 			try { | 			try { | ||||||
| 				importOptions = parser.getCommentOptions(expr.range); | 				importOptions = parser.getCommentOptionsStrict(expr.range); | ||||||
| 			} catch (e) { | 			} catch (e) { | ||||||
| 				parser.state.module.warnings.push( | 				parser.state.module.warnings.push( | ||||||
| 					new ImportOptionsCompileWarning( | 					new ImportOptionsCompileWarning( | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue