From 68096ff38d155068f44280d7ba2d6da22750aabf Mon Sep 17 00:00:00 2001 From: nightwing Date: Tue, 11 Feb 2014 20:40:31 +0400 Subject: [PATCH] run extension files automatically --- Makefile.dryice.js | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/Makefile.dryice.js b/Makefile.dryice.js index 549f3665..49bf0b28 100755 --- a/Makefile.dryice.js +++ b/Makefile.dryice.js @@ -280,7 +280,7 @@ function addSuffix(options) { } } -function getWriteFilters(options, projectType) { +function getWriteFilters(options, projectType, main) { var filters = [ copy.filter.moduleDefines, removeUseStrict, @@ -310,11 +310,9 @@ function getWriteFilters(options, projectType) { return text; }); - if (options.exportModule && projectType == "main") { - if (options.noconflict) - filters.push(exportAce(options.ns, options.exportModule, options.ns)); - else - filters.push(exportAce(options.ns, options.exportModule)); + if (options.exportModule && projectType == "main" || projectType == "ext") { + filters.push(exportAce(options.ns, options.exportModule, + options.noconflict ? options.ns : "", projectType == "ext" && main)); } return filters; } @@ -390,7 +388,7 @@ var buildAce = function(options) { project: cloneProject(project), require: [ 'ace/ext/' + ext ] }], - filter: getWriteFilters(options, "ext"), + filter: getWriteFilters(options, "ext", 'ace/ext/' + ext), dest: targetDir + "/ext-" + ext + ".js" }); }); @@ -650,7 +648,7 @@ function namespace(ns) { }; } -function exportAce(ns, module, requireBase) { +function exportAce(ns, module, requireBase, extModule) { requireBase = requireBase || "window"; module = module || "ace/ace"; return function(text) { @@ -666,7 +664,16 @@ function exportAce(ns, module, requireBase) { }); })(); }; - + + if (extModule) { + module = extModule; + template = function() { + (function() { + REQUIRE_NS.require(["MODULE"], function() {}); + })(); + }; + } + return (text + ";" + template .toString() .replace(/MODULE/g, module)