aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorMichał Gołębiowski <m.goleb@gmail.com>2016-12-04 01:16:36 +0100
committerMichał Gołębiowski <m.goleb@gmail.com>2016-12-05 18:43:10 +0100
commit4e50967725e61a5d71c2792131de61dec0520f9c (patch)
tree686088f1924c9f0ded24e75357065a9414067f5d /build
parent7fbab88110725c6e0b89f6513b9f7cff50320e1e (diff)
downloadjquery-4e50967725e61a5d71c2792131de61dec0520f9c.tar.gz
jquery-4e50967725e61a5d71c2792131de61dec0520f9c.zip
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
Diffstat (limited to 'build')
-rw-r--r--build/tasks/build.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/build/tasks/build.js b/build/tasks/build.js
index 1579691a0..69916bf02 100644
--- a/build/tasks/build.js
+++ b/build/tasks/build.js
@@ -17,7 +17,11 @@ module.exports = function( grunt ) {
read = function( fileName ) {
return grunt.file.read( srcFolder + fileName );
},
- wrapper = read( "wrapper.js" ).split( /\/\/ \@CODE\n\/\/[^\n]+/ ),
+
+ // Catch `// @CODE` and subsequent comment lines event if they don't start
+ // in the first column.
+ wrapper = read( "wrapper.js" ).split( /[\x20\t]*\/\/ @CODE\n(?:[\x20\t]*\/\/[^\n]+\n)*/ ),
+
config = {
baseUrl: "src",
name: "jquery",