aboutsummaryrefslogtreecommitdiffstats
path: root/build/tasks/build.js
diff options
context:
space:
mode:
Diffstat (limited to 'build/tasks/build.js')
-rw-r--r--build/tasks/build.js30
1 files changed, 21 insertions, 9 deletions
diff --git a/build/tasks/build.js b/build/tasks/build.js
index e344f991b..61ec670fb 100644
--- a/build/tasks/build.js
+++ b/build/tasks/build.js
@@ -128,11 +128,11 @@ module.exports = function( grunt ) {
* Adds the specified module to the excluded or included list, depending on the flag
* @param {String} flag A module path relative to
* the src directory starting with + or - to indicate
- * whether it should included or excluded
+ * whether it should be included or excluded
*/
const excluder = flag => {
let additional;
- const m = /^(\+|\-|)([\w\/-]+)$/.exec( flag );
+ const m = /^(\+|-|)([\w\/-]+)$/.exec( flag );
const exclude = m[ 1 ] === "-";
const module = m[ 2 ];
@@ -150,10 +150,16 @@ module.exports = function( grunt ) {
// These are the removable dependencies
// It's fine if the directory is not there
try {
- excludeList(
- fs.readdirSync( `${ srcFolder }/${ module }` ),
- module
- );
+
+ // `selector` is a special case as we don't just remove
+ // the module, but we replace it with `selector-native`
+ // which re-uses parts of the `src/selector` folder.
+ if ( module !== "selector" ) {
+ excludeList(
+ fs.readdirSync( `${ srcFolder }/${ module }` ),
+ module
+ );
+ }
} catch ( e ) {
grunt.verbose.writeln( e );
}
@@ -232,14 +238,14 @@ module.exports = function( grunt ) {
// Remove the comma for anonymous defines
setOverride( `${ srcFolder }/exports/amd.js`,
read( "exports/amd.js" )
- .replace( /(\s*)"jquery"(\,\s*)/,
+ .replace( /(\s*)"jquery"(,\s*)/,
amdName ? "$1\"" + amdName + "\"$2" : "" ) );
}
grunt.verbose.writeflags( excluded, "Excluded" );
grunt.verbose.writeflags( included, "Included" );
- // Indicate a Slim build without listing all of the exclusions
+ // Indicate a Slim build without listing all the exclusions
// to save space.
if ( isPureSlim ) {
version += " slim";
@@ -260,7 +266,13 @@ module.exports = function( grunt ) {
// Replace excluded modules with empty sources.
for ( const module of excluded ) {
- setOverride( `${ srcFolder }/${ module }.js`, "" );
+ setOverride(
+ `${ srcFolder }/${ module }.js`,
+
+ // The `selector` module is not removed, but replaced
+ // with `selector-native`.
+ module === "selector" ? read( "selector-native.js" ) : ""
+ );
}
}