🌐 AI搜索 & 代理 主页
Skip to content

Commit 4e50967

Browse files
committed
Build: Make the @CODE-replacing regex more robust
The code replacing @code in wrapper.js was written so that it expected both the code and the next line to start in the first column. This commit adjusts the regex so to get rid of that assumption and to work properly regardless of number of lines with comments after this block. While this is technically not necessary for our code, contributors sometimes re-format the wrapper file in their pull requests and the error messages they get don't tell them what's the real problem with their code. Closes gh-3429
1 parent 7fbab88 commit 4e50967

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

build/tasks/build.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ module.exports = function( grunt ) {
1717
read = function( fileName ) {
1818
return grunt.file.read( srcFolder + fileName );
1919
},
20-
wrapper = read( "wrapper.js" ).split( /\/\/ \@CODE\n\/\/[^\n]+/ ),
20+
21+
// Catch `// @CODE` and subsequent comment lines event if they don't start
22+
// in the first column.
23+
wrapper = read( "wrapper.js" ).split( /[\x20\t]*\/\/ @CODE\n(?:[\x20\t]*\/\/[^\n]+\n)*/ ),
24+
2125
config = {
2226
baseUrl: "src",
2327
name: "jquery",

0 commit comments

Comments
 (0)