Revert "include ace/requirejs/text in build to not depend on require text plugin"
This reverts commit 42219c2379.
Conflicts:
build_support/mini_require.js
This commit is contained in:
parent
2cf6f5a5e2
commit
e2b80ffb21
3 changed files with 40 additions and 52 deletions
|
|
@ -34,7 +34,7 @@
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
* the provisions above, a recipient may use your version of this file under
|
* the provisions above, a recipient may use your version of this file under
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
|
|
@ -170,21 +170,16 @@ function demo() {
|
||||||
ref = "";
|
ref = "";
|
||||||
version = "";
|
version = "";
|
||||||
}
|
}
|
||||||
|
var changeComments = function(data) {
|
||||||
function changeComments(data) {
|
return (data
|
||||||
return (data
|
.replace(/<!\-\-DEVEL[\d\D]*?DEVEL\-\->/g, "")
|
||||||
.replace(/<!\-\-DEVEL[\d\D]*?DEVEL\-\->/g, "")
|
.replace(/PACKAGE\-\->|<!\-\-PACKAGE/g, "")
|
||||||
.replace(/PACKAGE\-\->|<!\-\-PACKAGE/g, "")
|
.replace(/\/\*DEVEL[\d\D]*?DEVEL\*\//g, "")
|
||||||
.replace(/\/\*DEVEL[\d\D]*?DEVEL\*\//g, "")
|
.replace(/PACKAGE\*\/|\/\*PACKAGE/g, "")
|
||||||
.replace(/PACKAGE\*\/|\/\*PACKAGE/g, "")
|
.replace("%version%", version)
|
||||||
.replace("%version%", version)
|
.replace("%commit%", ref)
|
||||||
.replace("%commit%", ref)
|
);
|
||||||
);
|
}
|
||||||
};
|
|
||||||
|
|
||||||
function fixDocPaths(data) {
|
|
||||||
return data.replace(/"(demo|build)\//g, "\"");
|
|
||||||
}
|
|
||||||
|
|
||||||
copy({
|
copy({
|
||||||
source: ACE_HOME + "/kitchen-sink.html",
|
source: ACE_HOME + "/kitchen-sink.html",
|
||||||
|
|
@ -211,7 +206,9 @@ function demo() {
|
||||||
copy({
|
copy({
|
||||||
source: ACE_HOME + "/demo/kitchen-sink/demo.js",
|
source: ACE_HOME + "/demo/kitchen-sink/demo.js",
|
||||||
dest: demo,
|
dest: demo,
|
||||||
filter: [changeComments, fixDocPaths, function(data) {
|
filter: [changeComments, function(data) {
|
||||||
|
return data.replace(/"(demo|build)\//g, "\"");
|
||||||
|
}, function(data) {
|
||||||
return data.replace("define(", "define('kitchen-sink/demo',");
|
return data.replace("define(", "define('kitchen-sink/demo',");
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
|
@ -236,14 +233,6 @@ function buildAce(options) {
|
||||||
textPluginPattern: /^ace\/requirejs\/text!/
|
textPluginPattern: /^ace\/requirejs\/text!/
|
||||||
};
|
};
|
||||||
|
|
||||||
var modeNames = fs.readdirSync(ACE_HOME + "/lib/ace/mode").map(function(x) {
|
|
||||||
if (x.slice(-3) == ".js" && !/_highlight_rules|_test|_worker|xml_util|_outdent|behaviour/.test(x))
|
|
||||||
return x.slice(0, -3);
|
|
||||||
}).filter(function(x) { return !!x; });
|
|
||||||
var themeNames = fs.readdirSync(ACE_HOME + "/lib/ace/theme").map(function(x){
|
|
||||||
return x.slice(-3) == ".js" && x.slice(0, -3);
|
|
||||||
}).filter(function(x){ return !!x; });
|
|
||||||
|
|
||||||
var defaults = {
|
var defaults = {
|
||||||
targetDir: BUILD_DIR + "/src",
|
targetDir: BUILD_DIR + "/src",
|
||||||
ns: "ace",
|
ns: "ace",
|
||||||
|
|
@ -253,8 +242,13 @@ function buildAce(options) {
|
||||||
noconflict: false,
|
noconflict: false,
|
||||||
suffix: null,
|
suffix: null,
|
||||||
name: "ace",
|
name: "ace",
|
||||||
modes: modeNames,
|
modes: fs.readdirSync(ACE_HOME + "/lib/ace/mode").map(function(x) {
|
||||||
themes: themeNames,
|
if (x.slice(-3) == ".js" && !/_highlight_rules|_test|_worker|xml_util|_outdent|behaviour/.test(x))
|
||||||
|
return x.slice(0, -3);
|
||||||
|
}).filter(function(x) { return !!x; }),
|
||||||
|
themes: fs.readdirSync(ACE_HOME + "/lib/ace/theme").map(function(x){
|
||||||
|
return x.slice(-3) == ".js" && x.slice(0, -3);
|
||||||
|
}).filter(function(x){ return !!x; }),
|
||||||
workers: ["javascript", "coffee", "css", "json", "xquery"],
|
workers: ["javascript", "coffee", "css", "json", "xquery"],
|
||||||
keybindings: ["vim", "emacs"]
|
keybindings: ["vim", "emacs"]
|
||||||
};
|
};
|
||||||
|
|
@ -277,6 +271,7 @@ function buildAce(options) {
|
||||||
|
|
||||||
var filters = [
|
var filters = [
|
||||||
copy.filter.moduleDefines,
|
copy.filter.moduleDefines,
|
||||||
|
filterTextPlugin,
|
||||||
removeUseStrict,
|
removeUseStrict,
|
||||||
removeLicenceCmments
|
removeLicenceCmments
|
||||||
];
|
];
|
||||||
|
|
@ -377,6 +372,7 @@ function buildAce(options) {
|
||||||
|
|
||||||
filters = [
|
filters = [
|
||||||
copy.filter.moduleDefines,
|
copy.filter.moduleDefines,
|
||||||
|
filterTextPlugin,
|
||||||
removeUseStrict,
|
removeUseStrict,
|
||||||
removeLicenceCmments
|
removeLicenceCmments
|
||||||
];
|
];
|
||||||
|
|
@ -431,22 +427,6 @@ function cloneProject(project) {
|
||||||
|
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
copy.filter.addDefines = function(input, source) {
|
|
||||||
if (!source)
|
|
||||||
throw new Error('Missing filename for moduleDefines');
|
|
||||||
|
|
||||||
if (typeof input !== 'string')
|
|
||||||
input = input.toString();
|
|
||||||
|
|
||||||
var module = source.isLocation ? source.path : source;
|
|
||||||
|
|
||||||
input = input.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
||||||
input = '"' + input.replace(/\n/g, '\\n\\\n') + '"';
|
|
||||||
|
|
||||||
return 'define("ace/requirejs/text!' + module + '", [], ' + input + ');\n\n';
|
|
||||||
};
|
|
||||||
|
|
||||||
function copyFileSync(srcFile, destFile) {
|
function copyFileSync(srcFile, destFile) {
|
||||||
var BUF_LENGTH = 64*1024,
|
var BUF_LENGTH = 64*1024,
|
||||||
buf = new Buffer(BUF_LENGTH),
|
buf = new Buffer(BUF_LENGTH),
|
||||||
|
|
@ -473,12 +453,16 @@ function quoteString(str) {
|
||||||
return '"' + str.replace(/\\/, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\\n") + '"';
|
return '"' + str.replace(/\\/, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\\n") + '"';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function filterTextPlugin(text) {
|
||||||
|
return text.replace(/(['"])ace\/requirejs\/text\!/g, "$1text!");
|
||||||
|
}
|
||||||
|
|
||||||
function removeUseStrict(text) {
|
function removeUseStrict(text) {
|
||||||
return text.replace(/['"]use strict['"];/g, "");
|
return text.replace(/['"]use strict['"];/g, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeLicenceCmments(text) {
|
function removeLicenceCmments(text) {
|
||||||
return text.replace(/(;)\s*\/\*[\d\D]*?\*\//g, "$1").replace(/\n\/\/ vim.*\n(\/\/.*\n)+/g, "");
|
return text.replace(/(;)\s*\/\*[\d\D]*?\*\//g, "$1");
|
||||||
}
|
}
|
||||||
|
|
||||||
function namespace(ns) {
|
function namespace(ns) {
|
||||||
|
|
|
||||||
|
|
@ -207,10 +207,3 @@ function exportAce(ns) {
|
||||||
exportAce(ACE_NAMESPACE);
|
exportAce(ACE_NAMESPACE);
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
define('ace/requirejs/text', ['require', 'exports', 'module'], function(require, exports, module) {
|
|
||||||
// this won't be called it is needed only for included text modules
|
|
||||||
exports.load = function (name, req, onLoad, config) {
|
|
||||||
require("ace/lib/net").get(req.toUrl(name), onLoad);
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
|
||||||
13
install.js
13
install.js
|
|
@ -39,11 +39,22 @@
|
||||||
|
|
||||||
var buildAce = require("./Makefile.dryice").buildAce;
|
var buildAce = require("./Makefile.dryice").buildAce;
|
||||||
|
|
||||||
|
|
||||||
|
var ACE_HOME = __dirname;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
buildAce({
|
var aceProject = {
|
||||||
|
roots: [
|
||||||
|
ACE_HOME + '/lib',
|
||||||
|
ACE_HOME + '/demo'
|
||||||
|
],
|
||||||
|
textPluginPattern: /^ace\/requirejs\/text!/
|
||||||
|
};
|
||||||
|
buildAce(aceProject, {
|
||||||
compress: false,
|
compress: false,
|
||||||
noconflict: false,
|
noconflict: false,
|
||||||
suffix: "",
|
suffix: "",
|
||||||
|
compat: true,
|
||||||
name: "ace"
|
name: "ace"
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue