From ee0343dd1bf3d8b39a6cd10deb5b3ca59178bb65 Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Mon, 9 Sep 2013 09:50:12 -0400 Subject: Add AMD+CommonJS capabilities to the build script (for modules with long unreadable dependency lists) Conflicts: src/core.js --- build/tasks/build.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'build') diff --git a/build/tasks/build.js b/build/tasks/build.js index 79c7860e1..93c47c0ff 100644 --- a/build/tasks/build.js +++ b/build/tasks/build.js @@ -62,6 +62,14 @@ module.exports = function( grunt ) { .replace( /define\([^{]*?{/, "" ) .replace( rdefineEnd, "" ); + // Remove CommonJS-style require calls + // Keep an ending semicolon + contents = contents + .replace( /\w+ = require\(\s*(")[\w\.\/]+\1\s*\)([,;])/g, + function( all, quote, commaSemicolon ) { + return commaSemicolon === ";" ? ";" : ""; + }); + // Remove empty definitions contents = contents .replace( /define\(\[[^\]]+\]\)[\W\n]+$/, "" ); -- cgit v1.2.3